Skip to content

Commit

Permalink
Emacs: define fun and kbd for file path killing
Browse files Browse the repository at this point in the history
This is super useful for example in Python when wanting to import an
opened file from another.
  • Loading branch information
Indy2222 committed May 12, 2019
1 parent 81dbbe4 commit ea7641d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions emacs/init.el
Original file line number Diff line number Diff line change
Expand Up @@ -401,5 +401,15 @@
:config
(setq company-show-numbers 1))

(defun indy/kill-file-name ()
"Place buffer-file-name kill ring and display it."
(interactive)
(if buffer-file-name
(progn (kill-new buffer-file-name)
(message "Buffer file: %s" buffer-file-name))
(error "Current buffer is not visiting a file!")))

(global-set-key "\C-cif" 'indy/kill-file-name)

(when (file-exists-p custom-file)
(load custom-file))

0 comments on commit ea7641d

Please sign in to comment.