开发者

how to copy editing file in same location but different name with VIM

I am trying to find a combinati开发者_StackOverflow社区on of commands, macro or a plugin to copy the file I am editing in VIM (actually macvim) to the same location but with a different name. I am sure this could be achieved with a simple:

 !cp $CURRENT_FILE_PATH $NEW_PATH

but I don't know what variables to use nor the syntax.


:saveas %:p:h/new_name

For more information:

:h :saveas


:!cp % %:h/new_name
  • % expands to the current filename
  • %:h expands to the current filename's directory

To learn more:

  • :help expand()
  • :help filename-modifiers
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜