简体   繁体   中英

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:

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

%{} executes any vim statements contained within the {} brackets. If you want a different time format, read the below help topic on the strftime function:

:help strftime()

Also, if you need more help on the special printf style % characters, read this:

:help 'statusline'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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