Open files in existing Gvim in multiple (new) tabs

前端 未结 6 1917
耶瑟儿~
耶瑟儿~ 2020-12-12 10:47

I have put some aliases in my .bashrc to open a group of project files in gvim, each in their own tab:

gvim -p 

        
6条回答
  •  没有蜡笔的小新
    2020-12-12 11:35

    If vim is compiled with the clientserver option, you can do it. Start your vim instance with the following flag:

    $ gvim --servername GVIM  # GVIM is the server name. It can be anything.
    

    To open more tabs in this instance, you can run the command:

    $ gvim --servername GVIM --remote-tab file1 file2 file3 ...
    

    The clientserver feature in vim is very handy. It's not limited to opening files; it can be used to send any command to vim using the command-line. For example, to close a vim instance remotely, you can use:

    $ gvim --servername GVIM --remote-send ':wqa'
    

提交回复
热议问题