Expand region

From WikEmacs
Revision as of 08:59, 10 April 2012 by 193.90.174.156 (talk) (→‎Helpful keybindings)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Expand region increases the selected region by semantic units. Just keep pressing the key until it selects what you want.

expand-region
Description Emacs extension to increase selected region by semantic units.
Author Magnar Sveen
Maintainer Magnar Sveen
Source https://github.com/magnars/expand-region.el
Part of Emacs No

An example:

(setq alphabet-start "abc def")

With the cursor at the c, it starts by marking the entire word abc, then expand to the contents of the quotes abc def, then to the entire quote "abc def", then to the contents of the sexp setq alphabet-start "abc def" and finally to the entire sexp.

Basic setup

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

Helpful keybindings

If you expand too far, you can contract the region again by giving a negative prefix.

Common Customization

Replacing the Region

M-x delete-selection-mode is sometimes used in conjunction with Expand region. Delete selection is a minor mode that allows you to delete and replace the contents of the current region by simply typing over it.

See Also

Project Pages

Tutorial Pages