How do I close all open tabs at once?

后端 未结 8 1070
-上瘾入骨i
-上瘾入骨i 2021-01-29 17:28

If I have 10 tabs opened, I have to close each one using \":q\" separately.

How can I close them all at once?

相关标签:
8条回答
  • 2021-01-29 17:39

    Shortest/simplest/fastest way would be:

    :qa
    

    To save work in all tabs and quit:

    :wqa
    
    0 讨论(0)
  • 2021-01-29 17:41
    :qall
    

    This closes all tabs and open buffers.

    0 讨论(0)
  • 2021-01-29 17:44

    I often use :tabo (:tabonly) to close all other tabs.

    0 讨论(0)
  • 2021-01-29 17:53

    That can be done with the following command (in normal or escape mode):

    :tabdo :q
    

    "tabdo" apparently executes the command for all the open tabs.

    0 讨论(0)
  • 2021-01-29 17:55

    You can use any of these Vim Ex commands to Exit Multiple Windows And Buffers:

    1. :qa :qall

      Exit Vim, unless there are some buffers which have been changed. (Use :bmod to go to the next modified buffer). When 'autowriteall' is set all changed buffers will be written, like :wqall.

    2. :conf qa :confirm qall

      Exit Vim. Bring up a prompt when some buffers have been changed. See :confirm.

    3. :qa! :qall!

      Exit Vim. Any changes to buffers are lost. Also see :cquit, it does the same but exits with a non-zero value.

    4. :quita :quitall :quita! :quitall!

      Same as :qall.

    5. :wqa :wqall :xa :xall

      Write all changed buffers and exit Vim. If there are buffers without a file name, which are readonly or which cannot be written for another reason, Vim will not quit.

    6. :conf wqa :confirm wqall :conf xa :confirm xall

      Write all changed buffers and exit Vim. Bring up a prompt when some buffers are readonly or cannot be written for another reason. See :confirm.

    7. :wqa! :xa! :wqall! :xall!

      Write all changed buffers, even the ones that are readonly, and exit Vim. If there are buffers without a file name or which cannot be written for another reason, Vim will not quit.

    To read about these in Vim, type the following Ex command

    :help window-exit
    
    0 讨论(0)
  • 2021-01-29 17:55

    here is an Dark Side way of closing ALL VIM INSTANCES on Linux/Mac

    :!killall vim -9
    

    Do not use it. It does what you ask but probably not the best way but fun way

    0 讨论(0)
提交回复
热议问题