sponsor Vim development Vim logo Vim Book Ad

basic Tip #1472: VIMRC

 tip karma   Rating 20/15, Viewed by 5254 

Read and edit this tip on the Vim tip wiki. The wiki may have a more recent version of this tip.

created:   January 13, 2007 7:00      complexity:   basic
author:   Display File last modification time on status bar      as of Vim:   5.7

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()}

fu! 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
endf

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

 rate this tip  Life Changing Helpful Unfulfilling 

<< Status line to display more information | VIM and PL/SQL programming >>

Additional Notes

Anonymous, January 18, 2007 1:13
This gets the file's mtime on each update. Isn't this somewhat of an overkill?
kbtrace AT yahoo.com, January 15, 2007 3:22
so cool
anonym, January 15, 2007 11:30
this tips doesn't work for me in vom 7
[email protected], January 13, 2007 13:44
wow good tip :)

ernesto schutz
If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo