How to save a file in vim editor without quit

Solution 1:

ESC, :, w, Enter

The w is "write", the q is "quit"; use only "write".

Solution 2:

Here's another shorcut that works, if you're interested in saving a keystroke or two. Run the below commands (as long as your Vim(rc) config file matches the below target destination):

`$ echo "noremap ww :w<CR>" >> ~/.vimrc`
`$ source ~/.vimrc`    .

This should add a line to your Vim config file, noremap ww :w<CR>, which: (1.) Declares it's going to create a new Normal-Mode "Remap" (noremap); (2.) Designates what we can consider a new operator, or operating keystroke, ww, for the...; (3.) ...for the operand command, :w<CR>, which stands for "[Enter the] command mode, with ':', then key stroke 'w', following with a Carrige Return ()", and is the how the operator will behave when called. In case you're not familiar with Vim's Normal mode shortcuts: For example, using my example, you'd literally just type the letters 'ww', and read the bottom for confirmation that lines were written. (There are no "CTRL-... or CMD- or Shift-"-like combinations necessary.)