VIM格式打印日期到当前文件
我试图将2022年1月1日星期一格式的当前格式打印到我当前的VIM文件中。到目前为止,我已经尝试了以下命令,但是%
符号作为当前文件放入命令中。
:0r !date '+%a, %d %b %Y'
最终为我提供了类似于下面的输出。
/home/user/file.txta, /home/user/file.txtd /home/user/fileb /home/user/fileY
问题在于,像VIM一样,为%
设置了当前文件的路径,但这导致了当前用例的问题。
任何帮助都将受到赞赏
I am trying to print the current formatted as Mon, 1 Jan 2022 into my current file in vim. So far I've tried the following command, but the %
sign gets put into the command as the current file.
:0r !date '+%a, %d %b %Y'
This ends up giving me an output similar to seen below.
/home/user/file.txta, /home/user/file.txtd /home/user/fileb /home/user/fileY
The issue is that the path to the current file is put in place for %
as vim does, but that is causing issues for the current use case.
Any help is appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
直接解决方案显然是要逃脱
%
:但是您可能对内置的
:help strftime()
不需要逃脱:The immediate solution is obviously to escape the
%
:But you might be interested by the built-in
:help strftime()
, which doesn't require escaping: