Update README.md

This commit is contained in:
James Cherti
2024-08-12 21:34:21 -04:00
parent 3ea6cfdf59
commit cbf649864a

View File

@@ -395,21 +395,6 @@ You can also add `vdiff`, a package that provides Vimdiff-like functionality to
(vdiff-only-highlight-refinements t))
```
You can also add `evil-commentary`, which allows you to comment and uncomment by pressing `gc` in both normal and visual modes:
``` emacs-lisp
(use-package evil-commentary
:after evil
:ensure t
:defer t
:commands (evil-commentary evil-commentary-line)
:custom
(comment-empty-lines t)
:init
(with-eval-after-load "evil"
(evil-define-key 'visual 'global (kbd "gc") #'evil-commentary)
(evil-define-key 'normal 'global (kbd "gc") #'evil-commentary-line)))
```
The `evil-visualstar` package allows using `*` or `#` search from the visual selection:
``` emacs-lisp
(use-package evil-visualstar
@@ -430,6 +415,16 @@ The `evil-surround` package simplifies handling surrounding characters, such as
:hook (after-init . global-evil-surround-mode))
```
You can also add the following code to enable commenting and uncommenting by pressing `gcc` in normal mode and `gc` in visual mode (Special thanks to Reddit user u/mistakenuser for this contribution, which replaces the evil-commentary package):
``` emacs-lisp
(with-eval-after-load "evil"
(evil-define-operator my-evil-comment (beg end)
"Toggle comment from BEG to END."
(interactive "<r>")
(comment-or-uncomment-region beg end))
(evil-define-key 'normal 'global (kbd "gc") 'my-evil-comment))
```
### 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`: