Skip to content

Commit

Permalink
Add documentation of interaction with evil-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
dajva committed Sep 12, 2021
1 parent 3a33279 commit fd6da38
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docs/configuration.org
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,30 @@
#+END_SRC
:END:

* Use with evil-mode
Some key bindings clash with /evil-mode/. Recommendation is to use
evil /motion/ state for the results buffer and then switch to
evil /normal/ mode when editing in /wgrep-mode/. Some adjustments
need to be done to avoid the clashes though.

This is a start of a configuration. This let /rg-mode/'s key bindings
override the motion state map bindings based on that these motion
keys are not important in an /rg/ results buffer.
Adjust this to your preferred use case:
#+begin_src elisp
(with-eval-after-load 'rg
(advice-add 'wgrep-change-to-wgrep-mode :after
#'evil-normal-state)
(advice-add 'wgrep-to-original-mode :after
#'evil-motion-state)
(defvar rg-mode-map)
(add-to-list 'evil-motion-state-modes 'rg-mode)
(evil-add-hjkl-bindings rg-mode-map 'motion
"e" #'wgrep-change-to-wgrep-mode
"g" #'rg-recompile
"t" #'rg-rerun-change-literal))
#+end_src

* Customizing the menu
:PROPERTIES:
:CUSTOM_ID: customizing_the_menu
Expand Down

0 comments on commit fd6da38

Please sign in to comment.