diff options
author | David Morgan <djm_uk@protonmail.com> | 2021-08-27 14:09:23 +0100 |
---|---|---|
committer | David Morgan <djm_uk@protonmail.com> | 2021-08-27 14:09:23 +0100 |
commit | 43075251e1a6eae37ec5811e8f45fb565f115390 (patch) | |
tree | 598f79d215e415815252461ab00b37c2689eb13b | |
parent | 2e9a27187399d74103549b019ea87a8cf5b88729 (diff) | |
download | dotfiles-43075251e1a6eae37ec5811e8f45fb565f115390.tar.gz |
Wrap vertico-directory-enter to play nicely with Projectile
-rw-r--r-- | .emacs.d/lisp/init-completion.el | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/.emacs.d/lisp/init-completion.el b/.emacs.d/lisp/init-completion.el index 9baeefa..91f57f7 100644 --- a/.emacs.d/lisp/init-completion.el +++ b/.emacs.d/lisp/init-completion.el @@ -158,6 +158,19 @@ ;; See init-packages.el for fetching of Vertico Extenions ;; Required extensions must be in the vertico-extensions var (use-package vertico-directory + :init + (defvar switching-project nil) + (defun vertico-directory-enter-or-switch-project () + "Wrapper around vertico-directory-enter that plays nicely with Projectile." + (interactive) + (if switching-project + (vertico-exit) + (vertico-directory-enter))) + (defun read-project (orig &rest args) + (let ((switching-project t)) + (apply orig args))) + (advice-add 'projectile-completing-read :around + 'read-project) :config (defun vertico-directory-slash () (interactive) @@ -174,7 +187,7 @@ (insert "~"))) :load-path vertico-extensions-dir :bind (:map vertico-map - ;("RET" . vertico-directory-enter) + ("RET" . vertico-directory-enter-or-switch-project) ("/" . vertico-directory-slash) ("~" . vertico-directory-home) ("DEL" . vertico-directory-delete-char) |