Vim Tips Wiki
Register
(Remove html character entities)
m (Reverted edits by 101.160.152.109 (talk | block) to last version by JohnBot)
 
(4 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
|id=1472
 
|id=1472
 
|previous=1470
 
|previous=1470
|next=1479
+
|next=1483
 
|created=January 13, 2007
 
|created=January 13, 2007
 
|complexity=basic
 
|complexity=basic
|author=Anon
+
|author=
 
|version=5.7
 
|version=5.7
 
|rating=18/13
 
|rating=18/13
Line 12: Line 12:
 
|category2=
 
|category2=
 
}}
 
}}
Put in your [[vimrc]] file:
+
Put in your [[vimrc]]:
   
 
<pre>
 
<pre>
Line 19: Line 19:
 
"set rulerformat=%<%f%<%{FileTime()}%<%h%m%r%=%-20.(line=%03l,col=%02c%V,totlin=%L%)\%h%m%r%=%-30(,BfNm=%n%Y%)\%P\*%=%{CurTime()}
 
"set rulerformat=%<%f%<%{FileTime()}%<%h%m%r%=%-20.(line=%03l,col=%02c%V,totlin=%L%)\%h%m%r%=%-30(,BfNm=%n%Y%)\%P\*%=%{CurTime()}
   
fun! FileTime()
+
function! FileTime()
 
let ext=tolower(expand("%:e"))
 
let ext=tolower(expand("%:e"))
 
let fname=tolower(expand('%<'))
 
let fname=tolower(expand('%<'))
Line 26: Line 26:
 
let msg=msg." ".strftime("(Modified %b,%d %y %H:%M:%S)",getftime(filename))
 
let msg=msg." ".strftime("(Modified %b,%d %y %H:%M:%S)",getftime(filename))
 
return msg
 
return msg
  +
endfunction
endf
 
   
fun! CurTime()
+
function! CurTime()
 
let ftime=""
 
let ftime=""
 
let ftime=ftime." ".strftime("%b,%d %y %H:%M:%S")
 
let ftime=ftime." ".strftime("%b,%d %y %H:%M:%S")
 
return ftime
 
return ftime
  +
endfunction
endf
 
 
</pre>
 
</pre>
   

Latest revision as of 02:02, 5 May 2014

Tip 1472 Printable Monobook Previous Next

created January 13, 2007 · complexity basic · version 5.7


Put in your vimrc:

set statusline=%<%f%<%{FileTime()}%<%h%m%r%=%-20.(line=%03l,col=%02c%V,totlin=%L%)\%h%m%r%=%-30(,BfNm=%n%Y%)\%P\*%=%{CurTime()}
set rulerformat=%15(%c%V\ %p%%%)
"set rulerformat=%<%f%<%{FileTime()}%<%h%m%r%=%-20.(line=%03l,col=%02c%V,totlin=%L%)\%h%m%r%=%-30(,BfNm=%n%Y%)\%P\*%=%{CurTime()}

function! FileTime()
  let ext=tolower(expand("%:e"))
  let fname=tolower(expand('%<'))
  let filename=fname . '.' . ext
  let msg=""
  let msg=msg." ".strftime("(Modified %b,%d %y %H:%M:%S)",getftime(filename))
  return msg
endfunction

function! CurTime()
  let ftime=""
  let ftime=ftime." ".strftime("%b,%d %y %H:%M:%S")
  return ftime
endfunction

Comments[]

This gets the file's mtime on each update. Isn't that somewhat of an overkill?