re: I started using VIM a few weeks ago, now I am addicted. Ask Me Anything! VIEW POST

re: How to exit vim? scnr Welcome to team vim, I love this piece of software


There are a few keystrokes that can be used to exit vim depending on the situation and the task. To simply exit the editor you can type (in command mode) :q

But after you finish your editing tasks, you might want to save your work before you exit, you can use the following key combinations (make sure you are in command mode) :w to save and :q to quit. you can combine both to save and exit at once with the command :wq
There is another situation that I daily find myself in, where the command :q! which allows to exit without saving, comes handy. Sometimes when opening a file with the command vim namefile, misspelling the name file for instance, will tell vim to create a new file with the misspelled name while opening, so I basically have to force quit the editor as mentioned above.



If you haven't changed anything in the misspelled file, you can just :q to quit.

Because there was no change at all. I somehow redo my changes back to blank and press :q otherwise.

Thanks for the long answer :D never thought to get a serious one there

code of conduct - report abuse