在vim状态栏显示文件上次修改日期

  • 九月 12th, 2007

有时候我们在使用vim编辑文件的时候会查看文件的上次修改日期,通过这个脚本可以在vim状态栏显示文件上次修改日期。放在vimrc文件里面即可。

下载: code.vim
set statusline+=\ %{FileTime()}
 
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

to “在vim状态栏显示文件上次修改日期”

给我回复