Close
Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

LABS
Column Edit Mode in VI

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.

Comments
  1. matt says:

    you guys are so helpful. pivotal is the best

  2. Mark Wilden says:

    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

  3. Garry says:

    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.

  4. Garry,

    Ruby does have block comments:

    =begin
    this is all
    commented out
    =end

    I’ve rarely seen them ever used though.

  5. Brian Takita says:

    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

  6. Shep says:

    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.

  7. Allen says:

    I have to press ‘esc’ twice, my changes to each line will be applied.

Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *