ITPub博客

首页 > 应用开发 > IT综合 > VIM的配置 一例

VIM的配置 一例

原创 IT综合 作者:helloxchen 时间:2010-10-21 11:03:35 0 删除 编辑
  1. set syntax=on
  2. set cinoptions+={2,0,p0,t0
  3. set nobackup
  4. set cindent
  5. set syntax=cpp
  6. set formatoptions=tcqr
  7. "注释掉某行
  8. function Mycomm()
  9. call append(line(".")-1,"/*")
  10. call setline(line("."),getline("."))
  11. call append(line("."), "date:".strftime("%c"))
  12. call append(line(".")+1, "*/")
  13. endf
  14. "往文件开头增加一个文件说明
  15. function Mytitle()
  16. call append(0,"/**********************************************")
  17. call append(1,"作者:leapApple")
  18. call append(2,"时间:".strftime("%c"))
  19. call append(3,"文件名:".expand("%"))
  20. call append(4,"描述:")
  21. call append(5,"**********************************************/")
  22. endf
  23. "往某行后面增加一个注释
  24. function Mycomment()
  25. if &syntax=="cpp" || &syntax=="c"
  26. execute "normal a/* */2hi"
  27. elseif &syntax=="perl" || &syntax=="sh"
  28. execute "normal a# a"
  29. endif
  30. endf
  31. map :call Mycomment()
  32. map :call Mytitle():$o
  33. map :call Mycomm()
  34. map :1,$g/^$/dgg=G
复制代码
[@more@]

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/24790158/viewspace-1040137/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
  • 博文量
    171
  • 访问量
    311117