diff options
author | Franck Cuny <franck@fcuny.net> | 2023-11-10 17:55:59 -0800 |
---|---|---|
committer | Franck Cuny <franck@fcuny.net> | 2023-11-10 17:55:59 -0800 |
commit | bd9f04552209267bc4c2d160fcfc3e7d55f88720 (patch) | |
tree | fbecf07d1ebdcfbe91ba68d31bd309d48ed0eae9 | |
parent | remove extra configuration (diff) | |
download | emacs.d-bd9f04552209267bc4c2d160fcfc3e7d55f88720.tar.gz |
simplify a number of things in the configuration
The configuration for the completion system is a bit complex and I don't understand what I use, what I need, what are the defaults, etc. Let's reset the configuration to a bare minimum I understand and then build from there.
Diffstat (limited to '')
-rw-r--r-- | init.org | 178 |
1 files changed, 11 insertions, 167 deletions
diff --git a/init.org b/init.org index 78cd4b1..80a717a 100644 --- a/init.org +++ b/init.org @@ -319,54 +319,7 @@ The =consult= package provides search and navigation commands based on Emacs com ("M-g g" . consult-goto-line) ("M-g M-g" . consult-goto-line) ("M-g m" . consult-mark) - ("M-g k" . consult-global-mark)) - - ;; Enable automatic preview at point in the *Completions* buffer. This is - ;; relevant when you use the default completion UI. - :hook (completion-list-mode . consult-preview-at-point-mode) - - :custom - (consult-narrow-key "<") - - :functions - (consult-register-format - consult-register-window - consult-xref) - - :init - ;; Optionally configure the register formatting. This improves the register - ;; preview for `consult-register', `consult-register-load', - ;; `consult-register-store' and the Emacs built-ins. - (setq register-preview-delay 0.5 - register-preview-function #'consult-register-format) - - ;; Optionally tweak the register preview window. - ;; This adds thin lines, sorting and hides the mode line of the window. - (advice-add #'register-preview :override #'consult-register-window) - - ;; Use Consult to select xref locations with preview - (setq xref-show-xrefs-function #'consult-xref - xref-show-definitions-function #'consult-xref) - - ;; Configure other variables and modes in the :config section, - ;; after lazily loading the package. - :config - (use-package consult-xref) - - (consult-customize - consult-theme - :preview-key '(:debounce 0.2 any) - consult-ripgrep - consult-git-grep - consult-grep - consult-bookmark - consult-recent-file - consult-xref - consult--source-bookmark - consult--source-file-register - consult--source-recent-file - consult--source-project-recent-file - :preview-key '(:debounce 0.4 any))) + ("M-g k" . consult-global-mark))) #+end_src *** corfu @@ -380,7 +333,6 @@ Corfu enhances in-buffer completion with a small completion popup. :map corfu-map ("C-n" . corfu-next) ("C-p" . corfu-previous) - ("<escape>" . corfu-quit) ("<return>" . corfu-insert) ("M-d" . corfu-info-documentation) ("M-l" . corfu-info-location) @@ -397,8 +349,6 @@ Corfu enhances in-buffer completion with a small completion popup. (corfu-min-width 80) (corfu-max-width corfu-min-width) ; Always have the same width - (corfu-count 14) - (corfu-scroll-margin 4) (corfu-cycle t) ;; `nil' means to ignore `corfu-separator' behavior, that is, use the older @@ -446,7 +396,6 @@ Corfu enhances in-buffer completion with a small completion popup. ;; the `corfu-popupinfo' popup. (corfu-echo-documentation nil)) #+end_src - *** cape #+begin_src emacs-lisp @@ -454,80 +403,31 @@ Corfu enhances in-buffer completion with a small completion popup. :demand t :ensure t :bind (("C-c . p" . completion-at-point) - ("C-c . t" . complete-tag) ("C-c . h" . cape-history) ("C-c . f" . cape-file) - ("C-c . k" . cape-keyword) - ("C-c . s" . cape-symbol) ("C-c . a" . cape-abbrev) ("C-c . l" . cape-line) ("C-c . w" . cape-dict) - ("C-c . \\" . cape-tex) - ("C-c . _" . cape-tex) - ("C-c . ^" . cape-tex) - ("C-c . &" . cape-sgml) ("C-c . r" . cape-rfc1345)) :init ;; Add `completion-at-point-functions', used by `completion-at-point'. (add-to-list 'completion-at-point-functions #'cape-file) (add-to-list 'completion-at-point-functions #'cape-abbrev)) #+end_src - -*** embark - -#+begin_src emacs-lisp - (use-package embark - :ensure t - :bind (("M-." . embark-act) - ("C-h b" . embark-bindings) ;; alternative for `describe-bindings' - - :map embark-collect-mode-map - ("C-c C-a" . embark-collect-direct-action-minor-mode)) - :init - ;; Optionally replace the key help with a completing-read interface - (setq prefix-help-command #'embark-prefix-help-command) - - ;; Show the Embark target at point via Eldoc. You may adjust the Eldoc - ;; strategy, if you want to see the documentation from multiple providers. - (add-hook 'eldoc-documentation-functions #'embark-eldoc-first-target) - - :config - ;; Hide the mode line of the Embark live/completions buffers - (add-to-list 'display-buffer-alist - '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*" - nil - (window-parameters (mode-line-format . none))))) -#+end_src - -**** embark-consult - -#+begin_src emacs-lisp - (use-package embark-consult - :ensure t - :hook - (embark-collect-mode . consult-preview-at-point-mode)) -#+end_src - *** marginalia - - #+begin_src emacs-lisp (use-package marginalia :ensure t ;; Either bind `marginalia-cycle' globally or only in the minibuffer - :bind (("M-A" . marginalia-cycle) - :map minibuffer-local-map - ("M-A" . marginalia-cycle)) + :bind (:map minibuffer-local-map + ("M-A" . marginalia-cycle)) - ;; The :init configuration is always executed (Not lazy!) - :config + :init ;; Must be in the :init section of use-package such that the mode gets ;; enabled right away. Note that this forces loading the package. (marginalia-mode)) #+end_src - *** orderless - #+begin_src emacs-lisp (use-package orderless :demand t @@ -536,80 +436,25 @@ Corfu enhances in-buffer completion with a small completion popup. (completion-styles '(orderless basic)) (completion-category-defaults nil)) #+end_src - *** vertico - - #+begin_src emacs-lisp (use-package vertico - :demand t :ensure t - :bind (("C-c . ." . vertico-repeat) - :map vertico-map - ("C-j" . vertico-exit-input) - ("C-M-n" . vertico-next-group) - ("C-M-p" . vertico-previous-group)) - :hook - (minibuffer-setup . vertico-repeat-save) - (rfn-eshadow-update-overlay . vertico-directory-tidy) - :custom - (vertico-count 10) - (vertico-resize nil) - (vertico-cycle t) - :preface - (defun crm-indicator (args) - (cons (format "[CRM%s] %s" - (replace-regexp-in-string - "\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" "" - crm-separator) - (car args)) - (cdr args))) :config - (vertico-mode) - - ;; Add prompt indicator to `completing-read-multiple'. - ;; We display [CRM<separator>], e.g., [CRM,] if the separator is a comma. - (advice-add #'completing-read-multiple :filter-args #'crm-indicator) - - ;; Do not allow the cursor in the minibuffer prompt - (setq minibuffer-prompt-properties - '(read-only t cursor-intangible t face minibuffer-prompt)) - - (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode) - - ;; Hide commands in M-x which do not work in the current mode. Vertico - ;; commands are hidden in normal buffers. - (setq read-extended-command-predicate - #'command-completion-default-include-p)) + (vertico-mode)) #+end_src - *** yasnippet - #+begin_src emacs-lisp (use-package yasnippet :ensure t :diminish - :commands yas-minor-mode-on - :bind (("C-c y d" . yas-load-directory) - ("C-c y i" . yas-insert-snippet) - ("C-c y f" . yas-visit-snippet-file) - ("C-c y n" . yas-new-snippet) - ("C-c y l" . yas-describe-tables) - ("C-c y g" . yas-global-mode) - ("C-c y m" . yas-minor-mode) - ("C-c y r" . yas-reload-all) - ("C-c y x" . yas-expand) - :map yas-keymap - ("C-i" . yas-next-field-or-maybe-expand)) :mode ("/emacs\\.d/snippets/" . snippet-mode) - :hook (prog-mode . yas-minor-mode-on) - :custom - (yas-prompt-functions '(yas-completing-prompt yas-no-prompt)) - (yas-snippet-dirs (list (emacs-path "snippets"))) - (yas-triggers-in-field t) - (yas-wrap-around-region t) + :config - (yas-load-directory (emacs-path "snippets"))) + (yas-load-directory (emacs-path "snippets")) + + :init + (yas-global-mode 1)) #+end_src ** dired @@ -1000,7 +845,6 @@ A convenient package to create link to a code location in GitHub, or other forge ** js2-mode ** languages *** eglot - After experimenting with [[https://emacs-lsp.github.io/lsp-mode/][lsp-mode]] and [[https://github.com/joaotavora/eglot][eglot]] I decided to go with eglot for LSP integration. For languages where I want to use LSP, I need to add ~:hook (nix-mode . englot-ensure)~ in the ~use-package~ definition for the language. @@ -1008,11 +852,11 @@ For languages where I want to use LSP, I need to add ~:hook (nix-mode . englot-e #+begin_src emacs-lisp (use-package eglot :ensure t + :after yasnippet :bind (:map eglot-mode-map ("C-c l a" . eglot-code-actions) ("C-c l r" . eglot-rename))) #+end_src - *** tree-sitter #+begin_src emacs-lisp |