Vim Tips Wiki
No edit summary
 
(Insert TipProposed template + minor manual clean)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{review}}
 
{{review}}
  +
{{TipImported
{{Tip
 
 
|id=1483
 
|id=1483
  +
|previous=1472
|title=Show Last modified time (and others) in status bar
 
  +
|next=1484
|created=January 21, 2007 7:50
+
|created=January 21, 2007
 
|complexity=basic
 
|complexity=basic
|author=Ace and someone in the IRC community
+
|author=Ace
 
|version=5.7
 
|version=5.7
 
|rating=1/3
 
|rating=1/3
  +
|category1=
|text=
 
  +
|category2=
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: [[VimTip1472]]
 
 
}}
 
}}
  +
<pre>
 
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()
== Comments ==
 
 
return strftime("%c", getftime(bufname("%")))
Woops, missed:
 
 
endfunction
 
fu ShowTab()
 
let TabLevel = (indent('.') / &amp;ts )
 
if TabLevel == 0
 
let TabLevel='*'
 
endif
 
return TabLevel
 
endf
 
   
 
function! ShowTab()
 
let TabLevel = (indent('.') / &ts )
 
if TabLevel == 0
 
let TabLevel='*'
  +
endif
 
return TabLevel
  +
endfunction
  +
</pre>
   
 
See also [[VimTip1472]].
'''Anonymous'''
 
, January 21, 2007 7:56
 
----
 
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...
 
   
 
==Comments==
danielakesson--AT--gmail.com
 
, January 21, 2007 8:06
 
----
 
<!-- parsed by vimtips.py in 0.661542 seconds-->
 

Latest revision as of 03:54, 6 January 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.

Comments[]