feat: emacs insert relative file path

This commit is contained in:
Flinner 2022-03-18 23:00:16 +03:00
parent ad8424935d
commit ebb1acb76a
Signed by: flinner
GPG Key ID: 95CE0DA7F0E58CA6
1 changed files with 12 additions and 0 deletions

View File

@ -302,6 +302,17 @@ Edit: honestly I have no clue wtf that meant, or why I wrote it, but I will keep
(defun my/keybind/capture-inbox ()
(interactive)
(org-capture nil "gi"))
(defun my/counsel-insert-file-path ()
"Insert relative file path using counsel minibuffer"
(interactive)
(unless (featurep 'counsel) (require 'counsel))
(ivy-read "Insert filename: " 'read-file-name-internal
:matcher #'counsel--find-file-matcher
:action
(lambda (x)
(insert (file-relative-name x)))))
#+end_src
*** leader-keys
@ -429,6 +440,7 @@ Capture
#+begin_src emacs-lisp
"i" '(:ignore t :which-key "Insert")
"ie" '(emoji-insert :which-key "Emoji")
"if" '(my/counsel-insert-file-path :which-key "Insert Relative path")
#+end_src
**** Buffers (b)