Nivir
Nivir

Reputation: 31188

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.

Upvotes: 2

Views: 5246

Answers (1)

EvergreenTree
EvergreenTree

Reputation: 2058

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'

Upvotes: 9

Related Questions