VIM - Cheatsheet - Exiting

    :w - write (save) the file, but don't exit

    :wq or :x or ZZ - write (save) and quit

    :w !sudo tee % - write out the current file using sudo

    :q - quit (fails if there are unsaved changes)
    :q! or ZQ - quit and throw away unsaved changes

    :wqa - write (save) and quit on all tabs