Add corfu and cape to README.md
This commit is contained in:
42
README.md
42
README.md
@@ -435,6 +435,7 @@ You can also add the following code to enable commenting and uncommenting by pre
|
|||||||
|
|
||||||
To set up Language Server Protocol (LSP) servers using Eglot, you can configure it in your Emacs setup as follows. This configuration ensures minimal disruption from Eglot’s progress reporting and optimizes performance by disabling unnecessary logging.
|
To set up Language Server Protocol (LSP) servers using Eglot, you can configure it in your Emacs setup as follows. This configuration ensures minimal disruption from Eglot’s progress reporting and optimizes performance by disabling unnecessary logging.
|
||||||
|
|
||||||
|
To configure `eglot`, add the following to `~/.emacs.d/post-init.el`:
|
||||||
``` emacs-lisp
|
``` emacs-lisp
|
||||||
(use-package eglot
|
(use-package eglot
|
||||||
:ensure nil
|
:ensure nil
|
||||||
@@ -478,6 +479,47 @@ Here is an example of how to configure Eglot to enable or disable certain option
|
|||||||
(add-hook 'python-ts-mode-hook #'eglot)
|
(add-hook 'python-ts-mode-hook #'eglot)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Code completion with corfu
|
||||||
|
|
||||||
|
Corfu enhances in-buffer completion by displaying a compact popup with current candidates, positioned either below or above the point. Candidates can be selected by navigating up or down.
|
||||||
|
|
||||||
|
Cape, or Completion At Point Extensions, extends the capabilities of in-buffer completion. It integrates with Corfu or the default completion UI, by providing additional backends through completion-at-point-functions.
|
||||||
|
|
||||||
|
To configure `corfu` and `cape`, add the following to `~/.emacs.d/post-init.el`:
|
||||||
|
``` emacs-lisp
|
||||||
|
(use-package corfu
|
||||||
|
:ensure t
|
||||||
|
:defer t
|
||||||
|
:commands (corfu-mode global-corfu-mode)
|
||||||
|
|
||||||
|
:hook ((prog-mode . corfu-mode)
|
||||||
|
(shell-mode . corfu-mode)
|
||||||
|
(eshell-mode . corfu-mode))
|
||||||
|
|
||||||
|
:custom
|
||||||
|
;; Hide commands in M-x which do not apply to the current mode.
|
||||||
|
(read-extended-command-predicate #'command-completion-default-include-p)
|
||||||
|
;; Disable Ispell completion function. As an alternative try `cape-dict'.
|
||||||
|
(text-mode-ispell-word-completion nil)
|
||||||
|
(tab-always-indent 'complete)
|
||||||
|
|
||||||
|
;; Enable Corfu
|
||||||
|
:config
|
||||||
|
(global-corfu-mode))
|
||||||
|
|
||||||
|
(use-package cape
|
||||||
|
:ensure t
|
||||||
|
:defer t
|
||||||
|
:commands (cape-dabbrev cape-file cape-elisp-block)
|
||||||
|
:bind ("C-c p" . cape-prefix-map)
|
||||||
|
:init
|
||||||
|
;; Add to the global default value of `completion-at-point-functions' which is
|
||||||
|
;; used by `completion-at-point'.
|
||||||
|
(add-hook 'completion-at-point-functions #'cape-dabbrev)
|
||||||
|
(add-hook 'completion-at-point-functions #'cape-file)
|
||||||
|
(add-hook 'completion-at-point-functions #'cape-elisp-block))
|
||||||
|
```
|
||||||
|
|
||||||
### How to configure straight.el?
|
### How to configure straight.el?
|
||||||
|
|
||||||
[Add the straight.el bootstrap code](https://github.com/radian-software/straight.el?tab=readme-ov-file#getting-started) to `~/.emacs.d/pre-init.el`:
|
[Add the straight.el bootstrap code](https://github.com/radian-software/straight.el?tab=readme-ov-file#getting-started) to `~/.emacs.d/pre-init.el`:
|
||||||
|
|||||||
Reference in New Issue
Block a user