save in vim and exit code example
Example 1: vi save and exit
//Save
:w
//Exit
:q
Example 2: vim save and quit
// Save & exit
:wp
Example 3: close vim
wq – Save the file and exit Vim
//Save
:w
//Exit
:q
// Save & exit
:wp
wq – Save the file and exit Vim