Basic survival guide in vim

You were following a crazy tutorial frow the web where they asked you to open a file in vim and now you're stucked in this fucking black console and you can't write anything. You can't even quit ?! Ok, here is the bare minimum to know how to edit text and how to exit this shit.

  • To open a file in vim : vim /my/file It's like any other console editor.

  • To write in the file you need to go in the INSERT mode. The easiest way to do so it to press i.

To exit from the INSERT mode you'll have to press Esc.

  • To save your file : while in normal mode you have to enter :write or :w .

  • To exit : while in normal mode just type :quit or :q .

  • Exiting with unsaved changes : in normal mode : :q!

  • PROTIP : save&exit : normal mode :wq

You have to validate your commands by pressing Return key.

I know that's very minimalistic but it's intended. Just use this for a day or two and it'll be good. It's not better than any other text editor (except emacs ofcourse :-þ ) but you'll discover vim's advantages later on.