How do you return from 'gf' in Vim

前端 未结 11 1067
执念已碎
执念已碎 2020-12-12 09:23

I am using Vim for windows installed in Unix mode. Thanks to this site I now use the gf command to go to a file under the cursor.

I\'m looking for a com

11条回答
  •  既然无缘
    2020-12-12 10:16

    I haven't looked at your gf command but I imagine it uses the :e or :find command.
    Assuming that this is correct, simply replace the :e or :find with :new (or :vnew for a vertical split) and the file will open in a new window instead of the same one.

    e.g.

    "Switch between header and cpp
    nmap ,s :find %:t:r.cpp
    nmap ,S :new %:t:r.cpp
    nmap ,h :find %:t:r.h
    nmap ,H :new %:t:r.h
    nmap ,F :new =expand(":t")
    nmap ,d :new =expand("") 
    

提交回复
热议问题