Get name of the current file in Vim

后端 未结 6 1460
清歌不尽
清歌不尽 2020-12-14 00:52

I\'m trying to find the name of the file I\'m editing inside of Vim. So I can use it to map F5 to compile this file. Would of course be great if I could recognize

6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-14 01:53

    You can use the % character in vim commands to get the current filename with the extension. For example,

    :!javac %

    to run javac on the current file.

    You can find out more with

    :help filename-modifiers

提交回复
热议问题