summary refs log tree commit diff
diff options
context:
space:
mode:
authornoa@gaiwan.org2024-06-13 20:34:14 +0000
committernoa@gaiwan.org2024-06-13 20:34:14 +0000
commit1865c2748fc7a55e32eab3a3ea14b30531c94881 (patch)
tree968e9e02811f0a90f69d92732cf8a799ed0a7aa4
parent75cdc6e584767816e6f9e15dda0349633d48bf9a (diff)
Update vertico completion configuration
-rw-r--r--emacs/init.el77
1 files changed, 38 insertions, 39 deletions
diff --git a/emacs/init.el b/emacs/init.el
index 8b1d69a..7bcc64d 100644
--- a/emacs/init.el
+++ b/emacs/init.el
@@ -19,56 +19,55 @@
 (define-key input-decode-map [?\C-m] [C-m])
 
 (use-package tubthumping-theme
-	:config
-	(load-theme 'tubthumping t))
-
+  :config
+  (load-theme 'tubthumping t))
 
-(global-set-key (kbd "<backspace>") 'backward-delete-char-untabify)
 
 ;; I make my caps lock a menu key, so i can open the command palette with it
-;; https://alexschroeder.ch/wiki/2020-07-16_Emacs_everything
-
 (define-key context-menu-mode-map (kbd "<menu>") nil)
 (global-unset-key (kbd "M-x"))
 (global-set-key (kbd "<menu>") 'execute-extended-command)
 
 (setopt minibuffer-depth-indicate-mode t)
 
-;;; candidate completion
-(use-package vertico
-	:ensure t
-	:custom
-	(vertico-mode t)
-	(vertico-count 12)
-	(vertico-cycle t)
-	(read-buffer-completion-ignore-case t)
-	(read-file-name-completion-ignore-case t)
-	(completion-ignore-case t)
-	(vertico-multiform-mode t)
-	:config
-	(add-to-list 'vertico-multiform-categories '(embark-keybinding grid))
-(vertico-multiform-mode)
-)
-(use-package vertico-directory
-	:after vertico
-	:ensure nil
-	;; More convenient directory navigation commands
-	:bind (
-		:map vertico-map
-		("RET" . vertico-directory-enter)
-		("<backspace>" . vertico-directory-delete-char)
-		("C-<backspace>" . vertico-directory-delete-word)
-	)
-	;; Tidy shadowed file names
-	:hook (rfn-eshadow-update-overlay . vertico-directory-tidy)
-)
+;;; Minibuffer candidate completion
+
+;; Vertico is a package for a nice minibuffer completion experience.  It displays a vertical list of candidates.  It integrates well with the emacs ecosystem and lets me use other packages that also play nicely.
+(use-package vertico :ensure t)
+(setopt vertico-mode t)
+
+;; We want vertico to take up a maximum of 12 lines on the display.  My screen is quite small, so that's fine, but if i had a bigger screen, i might want to look into setting a percentage or increasing this.
+(setopt vertico-count 12)
+
+;; We also want to be able to jump to the bottom of the list by moving up from the top of the list, and the opposite.  I've rarely made use of this functionality and i don't know if it's actually a best practice from an interaction perspective, but i'm going to keep it on until it causes an issue for me.
+(setopt vertico-cycle t)
+
+;; Multiform mode will allow us to set different layouts for different completion categories.  For example, after pressing a prefix key,  i can press C-h to view a list of all possible following keys.  For this, i want vertico to display a grid of choices, rather than one completion per line.
+(setopt vertico-multiform-mode t)
+
+;; And of course, i want to be able to interact with vertico with the mouse.
+(setopt vertico-mouse-mode t)
+
+;; When completing a filename, i want to be able to easily delete directories in one fell swoop, instead of character by character or word by word.  Usually C-<backspace> would be fine, but if directories have a hyphen or space in their name, i have to press multiple times, which is almost never desirable.
+(bind-key (kbd "RET") #'vertico-directory-enter 'vertico-map)
+(bind-key (kbd "<backspace>") #'vertico-directory-delete-char 'vertico-map)
+(bind-key (kbd "<C-<backspace>") #'vertico-directory-delete-word 'vertico-map)
+
+;; Tidy shadowed file names
+;; :hook (rfn-eshadow-update-overlay . vertico-directory-tidy)
+
+(setopt read-buffer-completion-ignore-case t)
+(setopt read-file-name-completion-ignore-case t)
+(setopt completion-ignore-case t)
+
+
 
 (use-package orderless
-	:ensure t
-	:custom
-	(completion-styles '(orderless basic))
-	(completion-category-defaults nil)
-	(completion-category-overrides '((file (styles partial-completion)))))
+  :ensure t
+  :custom
+  (completion-styles '(orderless basic))
+  (completion-category-defaults nil)
+  (completion-category-overrides '((file (styles partial-completion)))))
 
 (setopt confirm-nonexistent-file-or-buffer 'after-completion)