How can I expand the full path of the current file to pass to a command in Vim?

前端 未结 6 1956
无人共我
无人共我 2020-11-30 17:39

When I go to command mode and type

:!mycommand %

I get my command executed on the current file (% is expanded to the current

6条回答
  •  被撕碎了的回忆
    2020-11-30 17:54

    The other two answers didn’t work for me (for some reason). However, I found that this combo displays the full path when typed in Normal mode:

    Press 1 then CtrlG

    Source: “Get the name of the current file” on the Vim Tips Wiki. See also the {count}CTRL-G section of :help CTRL-G.

提交回复
热议问题