vim save file as code example
Example 1: how to insert in vim and save
vim filename #open file in vim
//To insert text press i and you can start editing
//Press Esc key and type :wq to save a file AND exit
//Press Esc key and type :w to save WITHOUT exiting
Example 2: vim save file
// Save a new file (if you have entered vim without first creating a file)
:w <filename>
// Save file and exit
:x