The Only Text Editor You’ll Ever Need
November 8, 2007
For quite a while now, I’ve been using the Vi IMproved (vim) extension of vi for text editing. Many people cringe at the mention of vim or any other modal editor. I have a vivid memory of a friend recoiling in disgust as I mentioned using it at work. It’s true — vim has a bit of a learning curve if you’re not familiar with modal editing. But once you get the hang of it, it’s indispensable.
A modal editor separates insertion keystrokes from commands. For instance, if you were to open vim and press the “j” key, you would not see a “j” inserted into the file. Instead, vim would interpret this key press as a command and move the cursor to the left. In order to actually insert a “j” into the file, you must first enter insertion mode by pressing “i”. While in insertion mode, key strokes are interpreted as additions to the file, not commands. To exit this mode, press the escape key.
I know, I know — this seems like a lot of work just to add some text to a file. In truth, vim is overkill for quick, simple writing tasks. In my opinion, vim’s true calling is programming. Its ability to move around a file with ease, searches and substitutions, the concept of multiple buffers for storing text — these are just a few of vim’s more powerful functions. And let’s not forget that all of vim’s functionality is accessible from the keyboard, so there’s no need to involve that pesky mouse
I don’t have a favorite tutorial or documentation site, but you can always check out vim.org for more information. Or just google it. Also, check out gVim for a GUI version.