How to delete multiple buffers in Vim?

后端 未结 8 1337
北恋
北恋 2021-01-29 18:51

Assuming I have multiple files opened as buffers in Vim. The files have *.cpp, *.h and some are *.xml. I want to close all the XML files w

8条回答
  •  一个人的身影
    2021-01-29 19:47

    TAB will only autocomplete one file for you as of Vim 7.4.282
    use to autocomplete all files.

    You can just use:

    bd filetype
    

    then just use to facilitate the completion of all open files of specified filetype.

    for example, you have 1.xml, 2.xml, 3.xml, and 4.xml, you can do:

    bd xml
    

    then press

    vim will autocomplete for you as follow:

    bd 1.xml 2.xml 3.xml 4.xml
    

    you can just press enter to complete the command.

    if you have made changes in one of the files mentioned above, do remember to do:

    bd! xml
    

提交回复
热议问题