介绍一些关于Gvim(windows 7 32位 Vim 7.4)的基本配置,除了特别说明,代码一律添加在安装目录下的_vimrc文件中。
1、取消自动备份,这行代码需要添加在 _vimrc文件中的behave mswin之后才能生效:
set nobackup
2、F4一键添加作者信息:
map :call TitleDet()'s
function AddTitle()
call append(,"/*============================================================================")
call append(,"* Author : vitah")
call append(,"* Mail : linw1225@163.com")
call append(,"* Last modified : ".strftime("%Y-%m-%d %H:%M"))
call append(,"* Filename : ".expand("%:t"))
call append(,"* Description :")
call append(,"*")
call append(,"=============================================================================*/")
echohl WarningMsg | echo "Successful in adding the copyright." | echohl None
endf
"更新最近修改时间和文件名
function UpdateTitle()
normal m'
"" execute '/* Last modified:/s@:.*$@\=strftime(":\t%Y-%m-%d %H:%M")@'
execute '/* Last modified :/s@:.*$@\=strftime(": %Y-%m-%d %H:%M")@'
normal ''
normal mk
execute '/* Filename :/s@:.*$@\=": ".expand("%:t")@'
execute "noh"
normal 'k
echohl WarningMsg | echo "Successful in updating the copy right." | echohl None
endfunction
"判断前10行代码里面,是否有Last modified这个单词,
"如果没有的话,代表没有添加过作者信息,需要新添加;