The following post is part of my new Emacs Writing Setup. You can find the complete setup here on GitHub: https://github.com/ballantony/emacs-writing
A big part of writing is putting the notes I’ve made into some sort of order. I spend a lot of time joining notes together to make scenes and then rearranging those scenes. Scrivener is good at the rearranging part (I’ve written about this here.) Where Scrivener falls down is the flexibility of search. Emacs allows me to home in on a scene, an idea or a sentence almost instantly.
I copied some of my writing process from Scrivener’s model, even going as far as writing a simple Emacs Scrivener mode. Doom Emacs has rendered that unnecessary. Tools like ripgrep and consult make it far quicker to find what I’m looking for. If you’re unfamliar with the following commands, try them out. You’ll be pleased that you did.
One last thing. Doom Emacs calls different commands depending on which completion engine you’re using. This means the search syntax may vary. I use the default (vertico at the time of writing) which means that searching for apples oranges will return lines containing apples and oranges. In other words: when searching, type one word for an initial selection, then a second to narrow it down.
10.0.1 Searching in Projects
SPC SPCfind file in project
SPC s psearch project for text
SPC s Psearch another project for text
SPC s dsearch files in directory for text
10.0.2 Searching in Buffers
SPC s shelper function search for text in current buffer. Matches are displayed in another window.
SPC s jhelper function that goes to entry in evil’s jump list
SPC m .Jump to org heading (uses consult-org-heading)
And don’t forget
10.0.3 Useful Tips
SPC s oSearch online. t will search online dictionary, T thesaurus
- Find an unmatched quote using this regex
10.0.4 M-x consult-ripgrep
For a more flexible search try consult-ripgrep. It’s worth reading the documentation, but here’s a taste:
#alpha betaSearch for alpha and beta in any order.
#alpha.*betaSearch for alpha before beta.
#\(alpha\|beta\)Search for alpha or beta (Note Emacs syntax!)
#word -- -C3Search for word, include 3 lines as context
#first#secondSearch for first, quick filter for second.