: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.
TL;DR – How to Exit Vim If you didn't make any changes, type :q and press Enter / return. If you made some changes and would like to keep them, type :wq and press Enter / return. If you made some changes and would rather discard them, type :q! and press Enter / return.
Use CTRL-Break on MS-DOS |dos-CTRL-Break|. In Normal mode, any pending command is aborted.
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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With