Add SPC f y n and SPC f y N to copy the name of a file
This commit is contained in:
parent
ba93316939
commit
9f8b867af1
|
@ -2395,6 +2395,8 @@ Files manipulation commands (start with ~f~):
|
|||
| ~SPC f y c~ | show and copy current file absolute path with line and column number in the minibuffer |
|
||||
| ~SPC f y d~ | show and copy current directory absolute path in the minibuffer |
|
||||
| ~SPC f y l~ | show and copy current file absolute path with line number in the minibuffer |
|
||||
| ~SPC f y n~ | show and copy current file name with extensionin the minibuffer |
|
||||
| ~SPC f y N~ | show and copy current file name without extensionin the minibuffer |
|
||||
| ~SPC f y y~ | show and copy current file absolute path in the minibuffer |
|
||||
|
||||
**** Frame manipulation key bindings
|
||||
|
|
|
@ -565,6 +565,21 @@ ones created by `magit' and `dired'."
|
|||
(message "%s" (kill-new file-path))
|
||||
(message "WARNING: Current buffer is not attached to a file!")))
|
||||
|
||||
(defun spacemacs/copy-file-name ()
|
||||
"Copy and show the file name of the current buffer."
|
||||
(interactive)
|
||||
(if-let (file-name (file-name-nondirectory (spacemacs--file-path)))
|
||||
(message "%s" (kill-new file-name))
|
||||
(message "WARNING: Current buffer is not attached to a file!")))
|
||||
|
||||
(defun spacemacs/copy-file-name-base ()
|
||||
"Copy and show the file name without its final extension of the current
|
||||
buffer."
|
||||
(interactive)
|
||||
(if-let (file-name (file-name-base (spacemacs--file-path)))
|
||||
(message "%s" (kill-new file-name))
|
||||
(message "WARNING: Current buffer is not attached to a file!")))
|
||||
|
||||
(defun spacemacs/copy-file-path-with-line ()
|
||||
"Copy and show the file path of the current buffer, including line number."
|
||||
(interactive)
|
||||
|
|
|
@ -228,6 +228,8 @@
|
|||
"fyc" 'spacemacs/copy-file-path-with-line-column
|
||||
"fyd" 'spacemacs/copy-directory-path
|
||||
"fyl" 'spacemacs/copy-file-path-with-line
|
||||
"fyn" 'spacemacs/copy-file-name
|
||||
"fyN" 'spacemacs/copy-file-name-base
|
||||
"fyy" 'spacemacs/copy-file-path)
|
||||
;; frame ----------------------------------------------------------------------
|
||||
(spacemacs/set-leader-keys
|
||||
|
|
Loading…
Reference in a new issue