[defaults] Add function+shortcut for copy buffer name

This commit is contained in:
Ivan Yonchovski 2020-04-16 14:45:46 +03:00 committed by Maximilian Wolff
parent acdb59767c
commit 9f75a65398
3 changed files with 9 additions and 1 deletions

View File

@ -862,6 +862,7 @@ Other:
root with line number
- ~SPC f y Y~ to show and copy current file path relative to the project
root
- ~SPC f y b~ to show and copy buffer name.
(thanks to Codruț Constantin Gușoi)
- New ~SPC f e e~ to open spacemacs.env file (thanks to Sylvain Benner)
- New ~SPC f e E~ to reload environment variable from env file

View File

@ -690,6 +690,12 @@ ones created by `magit' and `dired'."
(message "%s" file-name))
(message "WARNING: Current buffer is not attached to a file!")))
(defun spacemacs/copy-buffer-name ()
"Copy and show the name of the current buffer."
(interactive)
(kill-new (buffer-name))
(message "%s" (buffer-name)))
(defun spacemacs/copy-file-name-base ()
"Copy and show the file name without its final extension of the current
buffer."

View File

@ -373,7 +373,8 @@
("l" spacemacs/copy-file-path-with-line "File path with line number")
("n" spacemacs/copy-file-name "File name")
("N" spacemacs/copy-file-name-base "File name without extension")
("y" spacemacs/copy-file-path "File path")))))
("y" spacemacs/copy-file-path "File path")
("b" spacemacs/copy-buffer-name "Buffer name")))))
;; frame ----------------------------------------------------------------------
(spacemacs/set-leader-keys
"Ff" 'spacemacs/find-file-other-frame