Wikia

Vim Tips Wiki

Show file modification time and more on status bar

Talk0
1,613pages on
this wiki
Revision as of 00:23, September 30, 2008 by JohnBot (Talk | contribs)

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.

Comments

Around Wikia's network

Random Wiki