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:
I also tried enabling/disabling cua mode.
In Emacs, whether a command affects a continuous piece of text or a rectangle depends on the command, not on what the selection looks like.
I'm not aware of any way to make the selection appear as a rectangle on the screen (but see this answer), but if you use any of the rectangle commands listed in the page you linked to, such as
C-x r k or
C-x r t, you'll see that they operate on the rectangle defined by the beginning and the end of the selection, despite the fact that the selection looks like a regular region.
How select a rectangle in emacs, Rectangle commands were originally part of Emacs's PictureMode and Delete the selected rectangle: delete-rectangle 'C-x r d'; Insert a M-x. At the prompt, enter: set-mark. Move the cursor one space beyond the lower-right corner of the region you are going to cut. Delete the rectangle into the kill buffer by pressing: M-x. At the prompt, enter: kill-rectangle. Move the cursor to the upper-left corner of the area where you want to paste the rectangle.
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.
Rectangle Commands, kill-rectangle 【 Ctrl + x r k 】 → Delete selected column of text. Put your cursor before 646f. Alt + x set-mark-command 【 Ctrl + Space 】. If you want only one or some of the columns of the data, use the rectangle commands of Emacs. Hit ‘C-SPC’at the beginning of the first entry in the column you want, and then move to the final entry in the last tabular column you want, then hit ‘C-x r k’. This kills the rows of the column(s) you’re interested in.
One more fun one to add to the list.
If you're using
evil-mode (ie, the Vim emulation layer), you can use
evil-visual-block (default binding of
C-v) to select a rectangle visually.
Emacs: Edit Column Text, Rectangle Commands, Two options come to mind. The first is rectangles (as mentioned in another answer). The explicit directions for that are: goto first line, first column; C-SPC; goto The only non-prefixed rectangle command is the initiator C-x SPC (rectangle-mark-mode), but that's easy enough to remember, being a lot like the very common C-SPC (set-mark-command). It looks like in recent Emacs versions, the selected region is working well to show exactly what's selected.
You use rectangle commands by placing the mark at one corner of the rectangle and point at the opposite corner. Even though the region will be displayed as normal, the rectangle commands will act on the rectangle delimited by point and mark. CUA mode doesn't affect this.
You just have to use your imagination :)
How to do select column then do editing in GNU Emacs?, How do I select a rectangle in emacs? Rectangle commands operate on rectangular areas of the text: all the characters between a certain pair kill-rectangle. Put your cursor before 646f. Alt + x set-mark-command 【 Ctrl + Space 】. Move cursor to end of 6964. Alt + x kill-rectangle .
If you want to see the rectangular selection, use CUA rectangles instead. Enable it with
M-RET to start the selection, move the cursor to change it (you can also hit
RET to move the cursor to different corners),
C-? to get a list of commands to operate on the rectangle.
M-RET with the selection active cancels the selection, as does
CUA selection mode does not enable the rest of CUA, so
C-v, etc. will not change.
How to select and kill column in Emacs, , and drag the mouse to the end of the area. If you're using a C-x r command, then there's no need to select the region with C-x SPC C-x r commands work on a normally selected region, just imagining a rectangle drawn with the point at one corner, and the mark at the opposite.
In Emacs, how do I select a region of text?, Cutting and pasting rectangular regions of a document is especially useful when you need to edit the contents of multi-column tables. If you are running Emacs in its own window (and not within an "xterm" window) as part of an X Window session, you can select the region simply by using the mouse. Click the mouse's left button at the start of the area to be selected, and drag the mouse to the end of the region. The area you selected should be highlighted.
How to copy/select a whole file or buffer in Emacs?, I didn't find any easy way to do what you want, but make a my-rectangle-forward-search command myself, I am not sure what can I do when find a matching In Emacs-24.4, the rectangle commands are alo made available via rectangular selection: hit C-x SPC and then move around to select a rectangle (it should be highlighted visually), after which you can use the usual C-w to remove it.
GNU Emacs Manual, Here is a solution: (defun mouse-start-rectangle (start-event) (interactive "e") (deactivate-mark) (mouse-set-point start-event) Using the arrow keys select the bottom right corner of the region. Say go to 's' in 'novices' ( Now, the cursor will be blinking in that point, let it be) Now type the "Crtl+x r r r " < press x holding Crtl then leave it, now press r 3 times >