I’ve found that typing in column mode to be very useful when using editors like IntelliJ or TextMate. VI also has a column edit mode, that is a little tricky to use.
To use it, press:
- Ctrl + V to go into column mode
- Select the columns and rows where you want to enter your text
- Shift + i to go into insert mode in column mode
- Type in the text you want to enter. Dont be discouraged by the fact that only the first row is changed.
- Esc to apply your change (or alternately Ctrl+c)
You will now see your changed applied.
you guys are so helpful. pivotal is the best
December 27, 2007 at 5:26 pm
Brian, can you give an example of where this capability (inserting the same thing in front of a number of lines) would be used?
For example, I could imagine using it to comment out some lines, but without “comment-in” capability, that wouldn’t be helpful.
///ark
December 27, 2007 at 8:35 pm
Mark,
I use column edit mode for comments, mostly (since Ruby doesn’t have block comments). After the ‘shift-i’ I just type “# ” and ESC (or ctrl-c or ctrl-[)
It is also useful to indent a block of lines forward/back. There are other ways to deal with block indenting, but I tend to use column edit probably b/c I just haven’t build muscle memory for the other methods.
December 27, 2007 at 11:01 pm
Garry,
Ruby does have block comments:
=begin
this is all
commented out
=end
I’ve rarely seen them ever used though.
December 28, 2007 at 6:27 am
Mark, If I understand you correctly, you can comment in by
* going into column select mode
* selecting the block you want to delete
* press x
December 28, 2007 at 6:51 am
Also hitting “v” in VI will get you into Visual mode which is also very helpful if you need to change lines rather than blocks.
December 28, 2007 at 4:51 pm
I have to press ‘esc’ twice, my changes to each line will be applied.
September 4, 2009 at 12:43 am