How to use Vim - beginners

Short version

Vim has a lot of command and when we are a new user it can be too much. that's why you are reading this post, below the main command you have to know to correctly use Vim.

Understand how Vim works:

Vim works with several modes, each mode can be activated with a specific key, for this beginners version, I will introduce only two modes: normal & insert, good to know, these modes are present in Vim AND Vi. Mouse is useless, in theory, personaly, I am using my mouse to select or copy/paste, so feel free to use it as well. Before each action you have to enable the correct mode and after quit the mode to go back in normal mode, example:

normal mode go to insert mode
Make your modification go to normal mode

Main commands:

Tap these commands in normal mode:

ESC go to normal mode  
i insert mode, to add, remove or modify text  
x remove caracter before the cursor  
DEL remove caracters under the cursor  
dd remove line  
: go to line number :252
/ find function (tap 'n' to go to the next occurance) /key word to search
END go to the end of line  
HOME go to the begining of line  
PgUp Navigate in file  
PgDn Navigate in file  
ZZ exit and save file  
:q exit, fail when changes have been made  
:q! exit without saving  
:wq exit and save file (like ZZ), you can create a new file with your modification as well :wq newfile
:wq! force to exit and save file, you can create a new file with your modification as well :wq! newfile

Copy/Paste works when you are in insert mode.

That is ! Now, you are able to work with Vi and Vim easilly ! No thank you, it is my pleasure.

Wrote by Raspaud Alexandre at May 10 2018, contact