简体   繁体   English

我怎样才能在Vim状态栏中显示时间?

[英]How I can show the time in Vim Status Bar?

This is the following code I am using 这是我正在使用的以下代码

set statusline=\PATH:\ %r%F\ \ \ \ \LINE:\ %l/%L/%P  

In the same statusline how I can show the time information ? 在同一状态行中我如何显示时间信息? Thanks for suggestion. 谢谢你的建议。

Vim allows you to evaluate vim commands inside of the status line, so something like this should do the trick: Vim允许你评估状态行中的vim命令,所以像这样的东西应该做的伎俩:

set statusline=\PATH:\ %r%F\ \ \ \ \LINE:\ %l/%L/%P\ TIME:\ %{strftime('%c')}

%{} executes any vim statements contained within the {} brackets. %{}执行{}括号中包含的任何vim语句。 If you want a different time format, read the below help topic on the strftime function: 如果您需要不同的时间格式,请阅读strftime函数的以下帮助主题:

:help strftime()

Also, if you need more help on the special printf style % characters, read this: 另外,如果您需要有关特殊printf样式%字符的更多帮助,请阅读:

:help 'statusline'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM