sponsor Vim development Vim logo Vim Book Ad

basic Tip #1483: Show Last modified time (and others) in status bar

 tip karma   Rating 1/3, Viewed by 1809 

Read and edit this tip on the Vim tip wiki. The wiki may have a more recent version of this tip.

created:   January 21, 2007 7:50      complexity:   basic
author:   Ace and someone in the IRC community      as of Vim:   5.7

autocmd BufWrite  *  call SetStatusLine()
autocmd BufRead   *  call SetStatusLine()

function! SetStatusLine()
    set statusline=[%n]\ %f\ %(\ \ (%M%R%H)%)\ \ \ %=\t%{ShowTab()}\ \ \ Modified:\ %{Time()}\ \ [%3l:%3L,%2c]\ %p%%\
endfunction

function! Time()
    return strftime("%c", getftime(bufname("%")))
endfunction

See also: vimtip #1472

 rate this tip  Life Changing Helpful Unfulfilling 

<< Convert hex to dec | When jumping on a tag, automatically split the window if the current buffer has been modified >>

Additional Notes

Anonymous, January 21, 2007 7:56
Woops, missed:

fu ShowTab()
   let TabLevel = (indent('.') / &ts; )
   if TabLevel == 0
      let TabLevel='*'
   endif
   return TabLevel
endf
[email protected], January 21, 2007 8:06
Ok, this is my first tip... so bare with me if any other misstakes are there.
I can also add that it shows all those nice things like [which row/total rows, column] % of the file shown...
If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo