- set syntax=on
- set cinoptions+={2,0,p0,t0
- set nobackup
- set cindent
- set syntax=cpp
- set formatoptions=tcqr
- "注释掉某行
- function Mycomm()
- call append(line(".")-1,"/*")
- call setline(line("."),getline("."))
- call append(line("."), "date:".strftime("%c"))
- call append(line(".")+1, "*/")
- endf
- "往文件开头增加一个文件说明
- function Mytitle()
- call append(0,"/**********************************************")
- call append(1,"作者:leapApple")
- call append(2,"时间:".strftime("%c"))
- call append(3,"文件名:".expand("%"))
- call append(4,"描述:")
- call append(5,"**********************************************/")
- endf
- "往某行后面增加一个注释
- function Mycomment()
- if &syntax=="cpp" || &syntax=="c"
- execute "normal a/* */2hi"
- elseif &syntax=="perl" || &syntax=="sh"
- execute "normal a# a"
- endif
- endf
- map :call Mycomment()
- map :call Mytitle():$o
- map :call Mycomm()
- map :1,$g/^$/dgg=G
复制代码 |
[@more@]
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/24790158/viewspace-1040137/
,如需转载,请注明出处,否则将追究法律责任。