Show file modification time and more on status bar

From Vim Tips Wiki

Jump to: navigation, search
Tip 1483 Printable Monobook Previous Next

created January 21, 2007 · complexity basic · author Ace · version 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

function! ShowTab()
  let TabLevel = (indent('.') / &ts )
  if TabLevel == 0
    let TabLevel='*'
  endif
  return TabLevel
endfunction

See also VimTip1472.

[edit] Comments

Personal tools