-
-
Save anticomputer/ea71ecab639326bf540418f31c600e09 to your computer and use it in GitHub Desktop.
ivy compliant vertico config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use-package vertico | |
;; using quelpa until elpa version contains vertico-preselect | |
:quelpa | |
:ensure t | |
:demand | |
:config | |
(setq vertico-cycle t) | |
(setq vertico-preselect 'directory) | |
:init | |
(vertico-mode) | |
;; make things compatible with my ivy muscle memory | |
;; if first candidate is a directory then "/" should | |
;; vertico-insert, if not, then it should just do the | |
;; char | |
(defun my/vertico-insert () | |
(interactive) | |
(let* ((mb (minibuffer-contents-no-properties)) | |
(lc (if (string= mb "") mb (substring mb -1)))) | |
;; make sure we can still reset to ~ and // ivy style, also consider tramp prefixes | |
(cond ((string-match-p "^[/~:]" lc) (self-insert-command 1 ?/)) | |
((file-directory-p (vertico--candidate)) (vertico-insert)) | |
(t (self-insert-command 1 ?/))))) | |
:bind (:map vertico-map | |
("/" . #'my/vertico-insert))) | |
;; Configure directory extension. | |
(use-package vertico-directory | |
;; using quelpa until elpa version contains vertico-preselect | |
:quelpa | |
:after vertico | |
:ensure t | |
:demand | |
;; More convenient directory navigation commands | |
:bind (:map vertico-map | |
("RET" . vertico-directory-enter) | |
("DEL" . vertico-directory-delete-char) | |
("M-DEL" . vertico-directory-delete-word)) | |
;; Tidy shadowed file names | |
:hook (rfn-eshadow-update-overlay . vertico-directory-tidy)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment