When editing files over ssh, I prefer to use VIM over editors like nano. While it is certainly easier to find the save button in nano, most other actions in nano are just clunky. And while I never really understood the obsession with home row navigation, since my brain is usually the limiting factor rather than how fast I can type or navigate through an editor, I do prefer how VIM just gets the job done.

One thing I would have benefited from when learning to use this editor is just a cheat sheet with the most common actions you would want to do in an editor like VIM. So I made one.

Understanding VIM

VIM over SSH. Annotated: (1) Cursor location, (2) Highlighted bracket matching bracket under cursor, (3) Filename, 18 lines, 288 characters, (4) line number 1, column 1

When opening a file with VIM, you start in a sort-of command mode. You can navigate the file, but you can not edit. To enter edit-mode, press i or insert. If you press insert more than once, you toggle between insert-mode (add text under the cursor) and replace-mode (replace text under the cursor). To get back into command-mode, press Esc.

If you are stuck, you can usually get out of whatever you just did by mashing Esc and sometimes typing : q Enter. When you are back in command mode, and there is no weird prompt anymore in the bottom you can return to edit mode via i or insert.

When in command mode, pressing keys like :, / and ? will move the cursor to the bottom. These are the beginning of commands. If you don’t want to do a command, just mash Esc to get back to what you were doing.

VIM over ssh with an arrow pointing at the bottom command line

Cheat sheet

All of these commands happen in command mode (see above). Get in the habit of pressing Esc before doing any of these.

Critical commands

That’s all you really need to get going. You can just navigate using the arrow keys and keys like home, end, page up and page down do exactly what you expect them to do.

Cut / Copy / Paste

VIM has it’s own “clipboard”. If you paste something that is not copied through one of VIM’s commands, just enter insert mode and (if you are using ssh for example) press the right mouse button to paste your own clipboard.

VIM over ssh. Annotated: (1) Position where visual mode was activated with “v”, (2) current position of the cursor (e.g. reached by “down”, “down”, “end”), (3) the bottom bar shows that visual mode has been activated.

When combined, you can do many things. For example

Undo / redo


In VIM you can search from the beginning of the file to the end of the file with / and from the end of the file to the beginning of the file with ?. This only affects the order of the search results you get.

When pressing “n”, if no more search results can be found, the bottom row will tell you that it continued back at the edge of the file you started searching at.