Skip navigation

Tag Archives: vim

Vim is my favorite text editor (sorry Emacs guys). Anything that I write on my computer gets written in Vim. I used to be a word processor fan until they started to annoy me with spell-check. While I love how word processors can fix my spelling mistakes, I want them to do it after I write. I absolutely hate how they underline every misspelling. Writing and editing are two separate processes and writing always goes first. That’s why I started to blog using Vim.

There are a lot of great things about Vim, but before you dive in, know that it takes some adjusting if you’ve never used a command-line text editor. You don’t get your open and save buttons like you do in most applications. Everything you do in Vim is done with the keyboard, which in turn means that you need to learn some commands, and some of them are a little odd to say the least. How about we start with the basics though, shall we?

If you haven’t brought up a terminal window yet, do so. Ready? Okay, here we go. Type vim and press Enter. You should be greeted by a nice welcome screen or you’ll be met with an error saying that it doesn’t exist. If you received the latter and you’re on Ubuntu, type sudo apt-get install vim and you should be good to go.

Once you reach that nice intro screen, you’ll probably realize that you can’t type anything. This is because you have to press ‘i’ to enter insert mode. Write a little bit, just to test it out. When you have some text down, press the ‘Esc’ key. This exits insert mode. Now I can show you some of Vim’s commands.

The commands you are going to use the most are :w, :q!, and ZZ. The :w command tells Vim to write the buffer out to a file (in simple terms, it saves your work), while :q tells Vim that you want to quit. Try typing something without saving and exit using :q. It won’t let you will it? You see, if you modify a buffer without writing that buffer to a file, Vim won’t let you quit. That’s why you should use :q! instead. It overrides that default behavior, letting you quit without saving. You can combine the save and quit commands with ZZ.

Those commands are all you need to know to start using Vim, but there are tons more. One easy way to learn them all (or to avoid using them) is to use GVim. GVim is Vim with a graphical interface. It teaches you by showing the keyboard commands next to the actions in the menu. For example, it will say ‘Paste’ in the menu, but to the right of it you’ll see "+gP. This makes GVim a great app if you’re just getting started.

The true power of Vim lies in it’s simplicity. It separates the two parts of the writing process (writing and editing), by forcing you to do only one at a time. It also helps you concentrate on your work. No distractions, no notifications, just a clean environment where you put your thoughts into words.

Vim can be used by programmers as well. It supports syntax highlighting for a variety of languages and has many features just for developers. In fact, Vim is meant more for programming than writing, but it does both equally well.

For more information about Vim, go over to where you can read some documentation and download Vim for other platforms. I also highly recommend downloading GVim (it’s at the Vim website). It helps during the learning process and will get you up and running in no time.