James Dyer has a useful short post on indexing his init.el file. His scheme is simple. His init.el
is broken into sections each of which starts with
;; ;; -> Section-name ;;
Then he used occur
to generate the actual index. Rather than call occur
each time with the need to provide the regex, he wrote a 4-line function that does it for him. He doesn’t say whether he bound it to a key sequence but that, of course, is trivial.
One of the commenters suggested using imenu
. That’s would have the advantage of having the results show up in the echo area rather than a separate buffer but it’s not clear that that’s the right thing. You might want to visit more than one section, in which case having a (semi) persistent index is a win.
Regardless, using imenu
instead would be an easy change, especially if you’re using counsel-imenu
. For simplicity, though, it would be hard to beat Dyer’s short function using occur
. The nice thing is that with either solution you don’t need to install anything (other than a short function): everything you need is already there.