Difference between revisions of "Expand region"

From WikEmacs
Jump to navigation Jump to search
(added a page on expand-region)
 
 
(6 intermediate revisions by 4 users not shown)
Line 2: Line 2:
 
|name=expand-region
 
|name=expand-region
 
|description=Emacs extension to increase selected region by semantic units.
 
|description=Emacs extension to increase selected region by semantic units.
 +
|author=Magnar Sveen
 
|maintainer=Magnar Sveen
 
|maintainer=Magnar Sveen
 
|source=https://github.com/magnars/expand-region.el
 
|source=https://github.com/magnars/expand-region.el
 +
|in_emacs=No
 
}}
 
}}
  
Line 16: Line 18:
 
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.
 
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 =
+
== Basic setup ==
  
 
<source lang="lisp">
 
<source lang="lisp">
Line 23: Line 25:
 
</source>
 
</source>
  
= Helpful keybindings =
+
== Helpful keybindings ==
  
= Common Customization =
+
If you expand too far, you can contract the region again by giving a negative prefix.
  
= See Also =
+
== Common Customization ==
  
= Project Pages =
+
=== Replacing the Region ===
* [https://github.com/magnars/expand-region GitHub Repo]
 
  
= Tutorial Pages =
+
{{Command|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 ==
 +
 
 +
* [https://github.com/magnars/expand-region.el GitHub Repo]
 +
 
 +
== Tutorial Pages ==
  
 
*[http://emacsrocks.com/e09.html Screencast]
 
*[http://emacsrocks.com/e09.html Screencast]
  
 
[[Category:Project Management]][[Category:Convenience]][[Category:Third Party Package]]
 
[[Category:Project Management]][[Category:Convenience]][[Category:Third Party Package]]

Latest revision as of 08:59, 10 April 2012

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

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

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