feat(default): may include project name for SPC f Y

+default/yank-buffer-path-relative-to-project: with non-nil prefix arg,
copy the file name relative to the project root's parent.

Sometimes we also want to specify the project name to let others know
which is the currently mentioned project.
This commit is contained in:
Daanturo 2021-08-19 17:26:22 +07:00 committed by Henrik Lissner
parent 33e922645b
commit e19a6523ae

View file

@ -46,10 +46,14 @@
(error "Couldn't find filename in current buffer"))) (error "Couldn't find filename in current buffer")))
;;;###autoload ;;;###autoload
(defun +default/yank-buffer-path-relative-to-project () (defun +default/yank-buffer-path-relative-to-project (&optional include-root)
"Copy the current buffer's path to the kill ring." "Copy the current buffer's path to the kill ring.
(interactive) With non-nil prefix INCLUDE-ROOT, also include the project's root."
(+default/yank-buffer-path (doom-project-root))) (interactive "P")
(+default/yank-buffer-path
(if include-root
(file-name-directory (directory-file-name (doom-project-root)))
(doom-project-root))))
;;;###autoload ;;;###autoload
(defun +default/insert-file-path (arg) (defun +default/insert-file-path (arg)