Bind 'SPC i {f,F}' to insert current file name/path

This commit is contained in:
Henrik Lissner 2019-11-15 15:36:07 -05:00
parent 46bea60ad3
commit 21eeb5c1a5
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 13 additions and 0 deletions

View file

@ -333,3 +333,14 @@ ARG is set, prompt for a known project to search from."
(while (server-running-p)
(sit-for 1))
(server-start))
;;;###autoload
(defun +default/insert-file-path (arg)
"Insert the file name (absolute path if prefix ARG).
If `buffer-file-name' isn't set, uses `default-directory'."
(interactive "P")
(let ((path (or buffer-file-name default-directory)))
(insert
(if arg
(abbreviate-file-name path)
(file-name-nondirectory path)))))