Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How select a rectangle in emacs

In Notepad++, you can press Alt-LeftMouseClick-Drag to select a rectangular region.

How do I do this in emacs (windows) ?

I tried the methods in http://www.emacswiki.org/emacs/RectangleCommands but my selection happens as a regular region instead of rectangular shape:

http://i.stack.imgur.com/tBMBN.png

I also tried enabling/disabling cua mode.

like image 780
user3740959 Avatar asked Jul 31 '14 17:07

user3740959


People also ask

How do you set a mark in Emacs?

Or, you can set the mark at the end of the text, move to the beginning, and then type C-x C-u . The most common way to set the mark is with the C- SPC command ( set-mark-command ). This sets the mark where point is. Then you can move point away, leaving the mark behind.

How do I delete a column in Emacs?

You can delete a rectangle with delete-rectangle ( C-x r d ) or kill-rectangle ( C-x r k ). Either one will kill the rectangle with corners defined by the point and the mark. kill-rectangle will also save it for yanking with yank-rectangle .


1 Answers

In Emacs 24.4 and greater, C-x SPC is bound to rectangle-mark-mode which selects a rectangle visually.

http://emacsredux.com/blog/2014/01/01/a-peek-at-emacs-24-dot-4-rectangular-selection/ describes this in greater detail.

like image 166
dgtized Avatar answered Sep 19 '22 02:09

dgtized