VIM怎么获取正在编辑文件的文件名

VIM怎么获取正在编辑文件的文件名,第1张

Vim确告携实没有单独重命名命令

可型桐以自己写

:command! -nargs=1 Rename let tpname = expand('%:t') | saveas <袜租伏args>| edit <args>| call delete(expand(tpname))!

Register % contains the name of the current file, and register # contains the name of the alternate file. These registers allow the name of the current or alternate files to be displayed or inserted. The name, or full path, or directory containing the file can be used.

For example, in directory /abc the command vim def/my.txt would edit file /abc/def/my.txt. The following commands could be entered to display the information shown.


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/tougao/8152993.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-13
下一篇 2023-04-13

发表评论

登录后才能评论

评论列表(0条)

保存