Back in January I wrote about Magnar Sveen’s expand-region package that he described in Emacs Rocks #9. I recently loaded the code with ELPA and have been using it for my day-to-day work. I really like this package. It’s extraordinary how often selecting by semantic unit is the right thing. For a long time I selected text by typing 【Ctrl+Space】 and then manually moving the point with 【Ctrl+f】, 【Meta+f】 or something similar.
In almost every case expand-region
will do the right thing with a call or two of 【Ctrl+=】. Take another look at Sveen’s video on expand-region
and then download the code. You’ll need to set a keybinding for it in your .emacs
or init.el
. I use
(global-set-key (kbd "C-=") 'er/expand-region)
but you can, of course, set it to suit yourself. It’s also a good idea to checkout the package’s README on github, which explains how you can extend the package.