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

前端 未结 6 1960
无人共我
无人共我 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:53

    Append :p, e.g.

    :!mycommand %:p
    

    And %:p:h will give you the path of the directory that the file resides in.

提交回复
热议问题