Expand region

I posted recently about cutting text by word, line and sentence, but by default most of the commands cut from the point to the beginning or end of the word/line/sentence. I previously posted a nice fix for cutting a whole line, but in this post I’ll cover a more general solution.

The package expand region expands the selected region by semantic units i.e. going from word to sentence to paragraph in prose, but also by sensible units for code as well.

If you use my recommended setup, prelude then the command you need is already there – just hit C-– and away you go.

Otherwise, install the package expand-region, and then add the following to your emacs config file

;;expand region
(require 'expand-region)
(global-set-key (kbd "C-=") 'er/expand-region)

I would make an animated gif to illustrate this, but there is a great emacs rocks video by the author of the package. Check out the other videos in that series for more good things.