- 论坛徽章:
- 0
|
本帖最后由 cnscn2008 于 2012-05-03 14:07 编辑
"手动添加#CnsModify
let g:ComType=""
if expand("%:p:e") == "sh"
let g:ComType="#"
elseif expand("%:p:e") == "c" || expand("%:p:e") == "cpp"
let g:ComType="//"
endif
function AddCnsModify(ComType)
let cnstm = strftime("%Y-%m-%d %H:%M:%S")
exe "normal O".g:ComType."CnsModify ".cnstm
exe ":g+".g:ComType.g:ComType."CnsModify+s+".g:ComType.g:ComType."CnsModify+".g:ComType."CnsModify+"
exe "normal ''"
endfunction
map \d :call AddCnsModify(g:ComType)<CR>
"自动添加#CnsModify
autocmd BufWritePre *
\ if &mod |
\ let [l,c] = searchpos(g:ComType.'CnsModify','ws') |
\ if c == 1 |
\ call AddCnsModify(g:ComType) |
\ endif |
\ endif |
|