Use Hippie expand instead of Dabbrev

This commit is contained in:
Vedang Manerikar 2024-11-23 09:55:01 +05:30
parent 701a593b54
commit f0364953b8
2 changed files with 21 additions and 10 deletions

View file

@ -1722,8 +1722,7 @@ basis.
#+begin_quote
The built-in ~dabbrev~ package provides a text completion method that
reads the contents of a buffer and expands the text before the cursor
to match possible candidates. This is done with =M-/= (~dabbrev-expand~)
which is what I use most of the time to perform in-buffer completions.
to match possible candidates...
The term "dabbrev" stands for "dynamic abbreviation". Emacs also has
static, user-defined abbreviations ([[#h:fd84b79a-351e-40f0-b383-bf520d77834b][Settings for static text expansion
@ -1734,10 +1733,6 @@ static, user-defined abbreviations ([[#h:fd84b79a-351e-40f0-b383-bf520d77834b][S
(use-package dabbrev
:ensure nil
:commands (dabbrev-expand dabbrev-completion)
:bind
;; Swap the default key-bindings
(("M-/" . dabbrev-completion)
("C-M-/" . dabbrev-expand))
:config
;;;; `dabbrev' (dynamic word completion (dynamic abbreviations))
(setq dabbrev-abbrev-char-regexp "\\sw\\|\\s_")
@ -1753,6 +1748,20 @@ static, user-defined abbreviations ([[#h:fd84b79a-351e-40f0-b383-bf520d77834b][S
'(archive-mode image-mode docview-mode pdf-view-mode)))
#+end_src
** The =unravel-completion.el= settings for dynamic text expansion (~hippie~)
Hippie is a built-in expansion mechanism that competes with dabbrev. I prefer hippie because of the simpler configuration and detailed expansion options it provides.
Hippie uses Dabbrev as one of the expansion sources, so all the dabbrev settings above are still important.
#+begin_src emacs-lisp :tangle "unravel-modules/unravel-completion.el"
(use-package hippie-ext
:ensure nil
:bind
;; Replace the default dabbrev
("M-/" . hippie-expand))
#+end_src
** The =unravel-completion.el= for in-buffer completion popup (~corfu~)
:PROPERTIES:
:CUSTOM_ID: h:804b858f-7913-47ef-aaf4-8eef5b59ecb4

View file

@ -168,10 +168,6 @@
(use-package dabbrev
:ensure nil
:commands (dabbrev-expand dabbrev-completion)
:bind
;; Swap the default key-bindings
(("M-/" . dabbrev-completion)
("C-M-/" . dabbrev-expand))
:config
;;;; `dabbrev' (dynamic word completion (dynamic abbreviations))
(setq dabbrev-abbrev-char-regexp "\\sw\\|\\s_")
@ -186,6 +182,12 @@
(setq dabbrev-ignored-buffer-modes
'(archive-mode image-mode docview-mode pdf-view-mode)))
(use-package hippie-ext
:ensure nil
:bind
;; Replace the default dabbrev
("M-/" . hippie-expand))
;;; Corfu (in-buffer completion popup)
(use-package corfu
:ensure t