(Emacs)~ripgrep -> ripgrep + grep
+bindings for the in-built grep systems, for compatibility
This commit is contained in:
@@ -935,16 +935,47 @@ for exiting insert state. Otherwise, I don't really need it.
|
|||||||
(key-chord-define evil-insert-state-map "jk" #'evil-normal-state)
|
(key-chord-define evil-insert-state-map "jk" #'evil-normal-state)
|
||||||
(key-chord-mode +1))
|
(key-chord-mode +1))
|
||||||
#+end_src
|
#+end_src
|
||||||
** Ripgrep
|
** (Rip)grep
|
||||||
The ripgrep package provides utilities to grep projects and files for
|
*** Grep Preamble
|
||||||
strings via the rg tool. Though [[*Ivy][ivy]] comes with =counsel-rg= using it
|
Grep is a historical artefact. It is a searching utility that allows
|
||||||
makes me dependent on the ivy framework, and this configuration is
|
one to search files for certain regex patterns. The fact that there
|
||||||
intentionally built to be modular and switchable.
|
have been so many attempts to replace grep (with some success) only
|
||||||
|
goes to show how important a tool it is.
|
||||||
|
|
||||||
|
Ripgrep is a grep-like utility written in Rust. It subsumes not only
|
||||||
|
the ability to search a given file but also to search multiple files
|
||||||
|
within a directory (which is usually only found by composing the
|
||||||
|
program find with grep to search multiple files). Being incredibly
|
||||||
|
fast through its regex optimisations, it also uses ignore files such
|
||||||
|
as =.gitignore= to remove files from its searches.
|
||||||
|
|
||||||
|
Grep has default Emacs utilities that use a =compilation= style buffer
|
||||||
|
to search a variety of differing data sets. =grep= searches files,
|
||||||
|
=rgrep= searches in a directory using the =find= binary and =zgrep=
|
||||||
|
searches archives. This is a great solution for most environments as
|
||||||
|
most of them will have grep and find installed. Even when you =ssh=
|
||||||
|
into a remote machine, they're likely to have these tools.
|
||||||
|
|
||||||
|
The ripgrep package provides utilities to ripgrep projects and files
|
||||||
|
for strings via the rg binary. Though [[*Ivy][ivy]] comes with =counsel-rg=
|
||||||
|
using it makes me dependent on the ivy framework, and this
|
||||||
|
configuration is intentionally built to be modular and switchable. Of
|
||||||
|
course, this requires installing the rg binary which is available in
|
||||||
|
most common repositories nowadays. In terms of general speed, this is
|
||||||
|
better.
|
||||||
|
*** Grep
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(use-package grep
|
||||||
|
:straight nil
|
||||||
|
:general
|
||||||
|
(leader
|
||||||
|
"sd" #'rgrep))
|
||||||
|
#+end_src
|
||||||
|
*** rg
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package rg
|
(use-package rg
|
||||||
:after evil
|
|
||||||
:general
|
:general
|
||||||
(leader "r" #'rg)
|
(leader "sr" #'rg)
|
||||||
(:keymaps 'rg-mode-map
|
(:keymaps 'rg-mode-map
|
||||||
"]]" #'rg-next-file
|
"]]" #'rg-next-file
|
||||||
"[[" #'rg-prev-file
|
"[[" #'rg-prev-file
|
||||||
|
|||||||
Reference in New Issue
Block a user