UnidentifiedSkinny · 2022-11-10 05:55
Often I find myself wanting to do the classic vim/evil pattern of
* search for <keyword>
* do something (e.g., a macro) to the text at/near <keyword>
* press \`n\` to go the next occurence of <keyword>
and so on...
This works great for buffers, but I wish there was an equivalent behavior of \`n\`/\`N\`, but for entire *projects*. I know you can use projectile to find and replace regexps, but I like the flexibility and ease of use of the \`n\`/\`N\` + macros flow.
__rompy · 2022-11-10 08:59
Why don't you use `projectile-ripgrep` (or `projectile-grep`, or whatever similar function from `project.el`) and instead of `n/N` you can use `next-error`/`previous-error` to go to items.
I have `next-error` and `previous-error` mapped to `M-]` and `M-[` for example, so a `M-p s r` (mapped to `projectile-ripgrep`) followed by `M-]` and `<F4>` to replay the macro over each item.
This is a bit unrelated, but projectile grep, ripgrep, etc. combined with `wgrep` is another way to do it.
dig1 · 2022-11-10 09:47
Emacs comes with `project-find-regexp` (from `project.el` module which
is loaded automatically) and by hitting `n` or `p` inside search results
(xref buffer), you can iterate over occurences across the
project. Make sure you enable Emacs state for xref buffer so evil-mode
does not shadow those keys.
You can also do search-and-replace across the project (similar to what
`wgrep` does), by hitting `r`.
In my init.el I have these aliases:
```
(evil-ex-define-cmd "pff[ile]" 'project-find-file)
(evil-ex-define-cmd "pfr[egexp]" 'project-find-regexp)
```
so every time I type `:pff` or `:pfr` I can jump in to project-wide
search for a file or regexp, without having to install projectile
or wgrep.
[deleted] · 2022-11-10 15:42
[deleted]
UnidentifiedSkinny · 2022-11-12 18:12
Ah interesting, thank you. any equivalents for vertico?
__rompy · 2022-11-14 17:11
I don't think `vertico` offers this, if I understand your question correctly. It should be possible though with `consult` (eg: `consult-grep`) and `embark`.