about summary refs log tree commit diff stats
path: root/.emacs.d/lisp
diff options
context:
space:
mode:
authorDavid Morgan <djm_uk@protonmail.com>2021-08-20 16:01:24 +0100
committerDavid Morgan <djm_uk@protonmail.com>2021-08-20 16:01:24 +0100
commit3d01ddd1365a5ed082a5a5d78b4e04c302acdf5f (patch)
treed0faee1d44ce179815b0685906f3b0e2cd358185 /.emacs.d/lisp
parent19d5d5b8889a47ef5aa74b3a8bfde2c7f65a3fe7 (diff)
downloaddotfiles-3d01ddd1365a5ed082a5a5d78b4e04c302acdf5f.tar.gz
Add vertico-directory-home
Diffstat (limited to '.emacs.d/lisp')
-rw-r--r--.emacs.d/lisp/init-completion.el7
1 files changed, 7 insertions, 0 deletions
diff --git a/.emacs.d/lisp/init-completion.el b/.emacs.d/lisp/init-completion.el
index a1f0449..a3b8c71 100644
--- a/.emacs.d/lisp/init-completion.el
+++ b/.emacs.d/lisp/init-completion.el
@@ -165,10 +165,17 @@
              (vertico-directory--completing-file-p))
         (vertico-insert)
       (insert "/")))
+  (defun vertico-directory-home ()
+    (interactive)
+    (if (and (string-suffix-p "/" (vertico--candidate))
+             (vertico-directory--completing-file-p))
+        (insert "~/")
+      (insert "~")))
   :load-path vertico-extensions-dir
   :bind (:map vertico-map
               ("RET" . vertico-directory-enter)
               ("/" . vertico-directory-slash)
+              ("~" . vertico-directory-home)
               ("DEL" . vertico-directory-delete-char)
               ("M-DEL" . vertico-directory-delete-word))
   ;; Tidy shadowed file names