Wikia

Vim Tips Wiki

Changes: Show file modification time and more on status bar

Edit

Back to page

(Remove html character entities)
(Insert TipProposed template + minor manual clean)
 
Line 2: Line 2:
 
{{TipImported
 
{{TipImported
 
|id=1483
 
|id=1483
|previous=1479
+
|previous=1472
 
|next=1484
 
|next=1484
 
|created=January 21, 2007
 
|created=January 21, 2007

Latest revision as of 03:54, January 6, 2010

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.

CommentsEdit

Around Wikia's network

Random Wiki