Efficient Editing with vim


 

In his article, Efficient Editing with vim, Jonathan McPherson covers the basics of efficient vim editing. The article assumes at least novice-level experience with vi.

Among the helpful nuggets of info:

  • Stay out of insert mode
  • Use h, j, k, and l instead of the arrow keys to move through a file
  • Enter insert mode intelligently (e.g. use ‘A’ to append to the current line)
  • Avoid repetition by using the . command (a period) to quickly repeat the last command

He did leave out one of my favorites, however — the double right square bracket (]]) to skip to the bottom of the file.


 

4 Responses to Efficient Editing with vim

  1. JC says:

    You know, I don’t think it’s remotely possible to create a text editor less user friendly than vi. I think geeks use it just so they can seem like geeks. I’ll stick with pico for any command line editing, thanks. :-)

  2. Brian says:

    Ugh, pico. ;)

    Seriously – vi (and especially Vim) is a tool that can be incredibly useful, once you get past that nasty sharp learning curve. I’m so much faster these days with it. I love it.

    Also, I didn’t know about ]] to go to the end of the file. Simply typing a cap G will do it as well. #G will jump to line number #, but no number and it goes to the bottom. I’ll tend to use sequences like ggVG to go to the top, go into Visual Line mode, then go to the bottom to select the whole buffer (and I’d bet there’s a better key sequence for that).

  3. Nicole says:

    Like Brian said, it’s the nasty learning curve that is the toughest to get past. But once past it, vi is an incredibly efficient way to edit. I use it primarily for writing perl scripts and doing text file manipulation.

    :%s/^M//g

Leave a Comment

Your email address will not be published.

*