A useful binding for expand-region in Emacs

I’ve always found expand-region really useful in Emacs… when I remember to use it, which is rarely.

That all changed for me when Henrik Lissner (developer of Doom Emacs) posted a clever key binding on Doom’s Discord server:

(map!
 (:map 'override
   :v "v" #'er/expand-region
   :v "V" #'er/contract-region))

This is only useful for those using evil (Vim) bindings in Doom, but it is spectacularly useful because it uses the v binding for visual mode, in visual mode. This means that you can still hit v and then a movement command to select a word, sentence, block or whatever, but if you hit v repeatedly, it activates expand-region, selecting progressively larger contexts (e.g. the contents of a pair of quotes, then the contents and the quotes, then the sentence, then the paragraph, etc.). You can hit V (capital v) to reverse and contract the selection progressively.

This is genius because whenever I don’t quite know what I want to select, I tend to use visual selection. Now I can just keep mashing v until I’m happy with the selection, using V if I overcook it and want to reverse.

But She's A Girl @bsag