Back

vim blogs posts are popular, but:

The problem is they all tell you how to use vim — but none of them tell you how to learn vim.

This is how you learn vim.

Set your editor to vim

This step depends on your operating system. On Linux/OSX you just need to set your EDITOR environment variable. If you're using bash (or zsh), just add this line to your .bashrc (or .zshrc).

export EDITOR=vim

If you're using Windows, you might just have to say "I am using vim now".

Learn how to open files, edit them, and quit.

To open a file with vim, pass the path as an argument.

$ vim ./path/to/my/file.txt

Now you're in vim and the file is open. vim has two main "modes".

To check which mode you're in look at the bottom of the screen.

To enter insert mode press i. Now you can navigate the file with arrow keys or page up/down and you can also type and use backspace/delete exactly like you would expect.

To leave insert mode press escape.

To save your changes and quit vim:

You could also just write your changes with :w, or quit and discard your changes with :q!.

Congratulations, you now know enough to use vim

Learn vim

Grab a sticky note and a pen and write down i, escape, :wq, :q!. Stick it on the bottom edge of your monitor so you see it all the time.

Now you just need to use vim daily. Refer to your sticky note each time you use vim and try to put the skills on your note into practice. Once you have the note learnt, discard it, pick some useful operations from this list, create a new sticky note, and repeat the process.

This is how I learnt vim.