Dave Horner's Website - Yet another perspective on things...
Home Tech Talk Programming Rectangular selection or column mode - the best text editor feature ever.
79 guests
Rough Hits : 1829279
moon and stars
how did u find my site?





 
this website would be better without ads?!




 
There is grandeur in this view of life, with its several powers, having been originally breathed into a few forms or into one; and that, whilst this planet has gone cycling on according to the fixed law of gravity, from so simple a beginning endless forms most beautiful and most wonderful have been, and are being, evolved.
--Charles Robert Darwin
0, 1, 1, 2, 3, 5, 8, 13, 21, 34,...
xn = xn-1 + xn-2

Rectangular selection or column mode - the best text editor feature ever.

Monday, 04 September 2006 07:09
I'm writing this page because I've spoken to many fellow co-workers that haven't yet heard of the column mode (or sometimes called rectangular selection...maybe even vertical selection) feature available in many nice text editors. If you don't know what rectangular selection is...and you are a programmer, then get ready for a wonderful tool to put in your toolbox. This information has saved me hours of text editing time.

Column-mode in a text editor allows you to select text on a column by column basis not line by line.
At first thought this may not seem like such a cool feature... but it is really great.

When programming, you often have to add the same information to many lines of code. With column mode, you can quickly make the change on all the lines at the same time.

Access keys and methods are a bit different in every editor.

First thing to learn in any text editor is the selection capabilities. I would like this page to serve as a teaching tool for how to do column selection in all of my favorite editors (Ultraedit, JEdit, Vim, emacs, VS2008, etc).


First on my list is Ultraedit, which is the IDE I first learned about column mode selection goodness.

Ultraedit

Column-mode editing allows you to select, copy and paste a rectangular block of text. In Ultraedit, you can select a single column (with width=0 characters), start typing and whatever you type is inserted in every line selected.


Visual Studio 2010 Box Selection

Wow! The visual studio team implemented a zero width selection, multi-line edit and insert, with virtual space box selection/editing (editing in the file where there aren't bytes in the file already). This makes VS2010 a very significant upgrade to me. Woot! Woot!
Letters from the editor : Box selection - great link about the new selection features in 2010 and a video from the product manager of visual studio editor team...



Visual Studio (VS2003,VS2008)

To enable rectangular selection in visual studio just hold down the ALT key while selecting text.


I think this is a would-be-great feature of visual studio. However, I don't like that you can't select a zero width column. Forcing you to destroy some part of your input. With zero width column selection, you just start typing in front of your selected text.

Just as a side note, here is what you get in VS2008 when you try and make a zero width selection by SHIFT-ALT Left Arrowing the selection above. Sad, I'm not sure that selection is even useful. Maybe someday there will be a plugin/setting to fix it...

Then, to make matters worse, when you begin to type, it unselects your selection and places the input on the first line. How is that useful? I'm not really fond of capabilities of visual studio's implementation. :(



Here are some other interesting textual selection shortcut keys for visual studio.

Edit.CharLeftExtendColumn - SHIFT + ALT + LEFT/RIGHT ARROW - Moves the cursor to the left/right one character, extending the column selection.
Edit.GoToBraceExtend - CTRL + SHIFT + ] - Moves the cursor to the next brace, extending the selection.
Edit.SelectCurrentWord - CTRL + W - Selects the word containing the insertion point or the word to the right of the cursor.
Edit.WordNextExtend - CTRL + SHIFT + RIGHT ARROW - Extends the selection one word to the right.


JEdit

JEdit is a nice cross platform programmer's editor. It is open source java.
Selecting Text in jEdit
JEdit Doxygen


VIM

vim box select || how to select a box in vim || visual block mode = Ctrl-V
VIM has the ability to select text in rectangular blocks in VISUAL BLOCK mode. Hit CTRL-V and you can extend the selection column by column. This doesn't allow you to have 0 width selections or to move and extend the selection into columns that do not exist on disk however (huge drawback!). I'm still not sure how to then insert text on each line either. A work in progress... if you know how, please let me know. Thank you Jonathan Lee! - Here's what I know: After selecting a block with Ctrl-v, press I (shift-i) to insert text in front of the block. While you are editing, it will only show the insertion on the first row. Once you are done, press ESC and the insertion will be done on all of the other rows. To append data after a block, press A (shift-a), type in the text you want then press ESC. If you want to insert data at the end of a block of rows, select the rows you want vertically then press $. This will select everything to the right of the column you were on. Now press A (shift-a) as before, enter the text you want then press ESC.

Selecting columns with visual block mode - vimcasts.org on column commands and using visual block mode.
command action
c change selection (delete and switch to insert mode)
I insert in front of cursor
A append after cursor
r replace every character in selection
d delete selection
o toggle cursor to opposite corner


Eclipse

Eclipse has native column mode "block mode" support since 2009. Alt-Shift-A (Thanks Bill Foster)
Eclipse Tip: Block Selection Mode « Vasanth Dharmaraj’s Blog
Columns Plug-in for Eclipse 3.3.1 - this is a pretty nice plugin with many options (shown above). My only gripe with this plugin, is that it doesn't show the selection as-is...it still highlights characters outside of the selection. Though, it is better than nothing and it does what it should.
Column Mode for Eclipse Text Editors - i've tried to install, but it wouldn't work for me...

Emacs

true true
EmacsW32 Home Page
emacs-fu - useful tricks for emacs blog.
EmacsWiki: Site Map
The Craft of Text Editing - a thesis on text editing.
Emacs as a tiling window manager
Self-contained emacs mariusaeriksen/make-emacs · GitHub - simple, self-contained, relocatable emacs
Emacs and tmux - PerlStalker's SysAdmin Notes


nEdit

NEdit - the multi-purpose X Window System editor
Lucas Vieites writes Hi, I am too a big fan of this feature that is absent from all the "big" programming editors out there. I miss it very much since I had to quit using "Nedit" a few years ago because of it's lack of unicode support. In Nedit you can do Ctrl+drag to select columns and copy/cut & paste them wherever you like.


Geany

Lucas Vieites also noted geany which I had not seen before...it also includes column mode.
Geany : Home Page -a text editor using the GTK2 toolkit with basic features of an integrated development environment.
Geany is based on Scintilla and SciTE and is gtk based.


Homepage of Crimson Editor - Free Text Editor, Html Editor, Programmers Editor for Windows


Introduction - Textadept - talks of rectangular selection in Adept Editing - Textadept

< Prev  Next >
Last Updated on Saturday, 12 April 2014 04:49