Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 700
J4cK Avatar asked Dec 05 '25 13:12

J4cK


1 Answers

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'
like image 167
EvergreenTree Avatar answered Dec 07 '25 03:12

EvergreenTree