diff options
author | noa@gaiwan.org | 2024-06-23 16:39:20 +0000 |
---|---|---|
committer | noa@gaiwan.org | 2024-06-23 16:39:20 +0000 |
commit | dda528cc90fdfa4d96a2b3c01ce9a5d4ad13a277 (patch) | |
tree | d35ad586020bb68f20c23ef58bd23d92dede677d | |
parent | 2a79f3e40ca323830da6bfac0bd058df95e2ab78 (diff) |
Update completion style configuration
-rw-r--r-- | config.org | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/config.org b/config.org index 5214885..10f7fe6 100644 --- a/config.org +++ b/config.org @@ -158,25 +158,31 @@ If i type ~/ etc in a find-file prompt, get rid of the preceding directory names (add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy) #+end_src +* Completion styles +When given a prompt to select from a list of candidates, there are quite a lot of things we can tweak to improve the experience. + +The first thing we do is to ignore case, which in these cases is rarely useful. I find that thinking about the case of a candidate is slower than just typing more to narrow down the options. I don't actually know if these make any difference when i've specified a different completion style. + #+begin_src elisp (setopt read-buffer-completion-ignore-case t) (setopt read-file-name-completion-ignore-case t) (setopt completion-ignore-case t) #+end_src +Next, we want to set orderless and basic as the two completion style. Basic matches candidates with the same text before the point, and the text after the point as a substring. Orderless takes any number of space separated components and displays candidates that much every component in any order. We specify basic first. What this means in practice is that first we will try and complete exactly what i've input, and if that fails, widen the search with orderless to pick up more options. + #+begin_src elisp - (package-ensure '(orderless - :url "https://github.com/oantolin/orderless")) - (setopt completion-styles '(orderless basic)) - (setopt completion-category-defaults nil) - (setopt completion-category-overrides '((file (styles partial-completion)))) + (package-ensure 'orderless) + (setopt completion-styles '(basic orderless)) #+end_src +By default, emacs overrides the completion styles for email address, but i'm happy with my configuration above. + #+begin_src elisp -(setopt confirm-nonexistent-file-or-buffer 'after-completion) + (setopt completion-category-defaults nil) #+end_src -** Replace the mode line with a header line +* Replace the mode line with a header line First, we set the mode line to nil. On my graphical display, this collapses it so all i get is a thin black line separating the buffer from the echo area. #+begin_src elisp @@ -464,11 +470,9 @@ As mentioned in the vertico configuration above, we can set vertico to use a dif (setopt prefix-help-command #'embark-prefix-help-command) #+end_src -Because i use consult, it's recommended to have this package installed. +Because i use consult, it's recommended to set this up. #+begin_src elisp - (package-ensure '(embark-consult - :url "https://github.com/oantolin/embark.git")) (add-hook 'embark-collect-mode-hook #'consult-preview-at-point-mode) #+end_src |