Reputation: 78478
:q
only closes the current window. If you are using tabs or split windows, you need to do :q
for all of them. Also, plugins like NERDTree and MiniBufExpl have their own windows, which need to be closed individually.
Is there a command to quit all these open windows and quit Vim in a single stroke? However, if there is some buffer or window with unsaved changes, I should be asked to save it or not. Any command to achieve this?
I hope this is not a strange request, because this is how most non-Vim editors with tab or splits work.
Upvotes: 60
Views: 22682
Reputation: 211
you can user the
:qall
:qa
quit all the tabs opened
then you can use the command
:tabo
quit all other's tabs
if your's vim is not tabs you can use
:on
quit all windows
Upvotes: 12
Reputation: 71810
You can quit all loaded and open buffers, splits and tabs with:
:qa
If you want to quit without saving:
:qa!
You could assign a mapping to do this with a single stroke, this assigns the comma to quit everything without prompting to save:
nnoremap , :qa!<CR>
:wqall
writes before closing, that might be useful.
Type :he :qa
in vim for more info
Upvotes: 91