、设置家目录下的.vimrc内容为一下:

  1. set ignorecase
  2. set cursorline
  3. set autoindent
  4. set sw=4 # shiftwidth=4
  5. autocmd BufNewFile *.sh exec ":call SetTitle()"
  6. func SetTitle()
  7. if expand("%:e") == 'sh'
  8. call setline(1,"#!/bin/bash")
  9. call setline(2,"#")
  10. call setline(3,"#********************************************************************")
  11. call setline(4,"#Author: zhangshang")
  12. call setline(6,"#Date: ".strftime("%Y-%m-%d"))
  13. call setline(8,"#URL: http://blog.vservices.top/myblog")
  14. call setline(9,"#Description: The test script")
  15. call setline(10,"#Copyright (C): ".strftime("%Y")." All rights reserved")
  16. call setline(11,"#********************************************************************")
  17. call setline(12,"")
  18. endif
  19. endfunc
  20. autocmd BufNewFile * normal G
  21. 每次在生成空的新脚本时,就会自动添加标题头,很方便吧。
  22. set ignorecase :在vim中搜索忽略大小写
  23. set cursorline :开启下划线
  24. set autoindent : 开启自动缩进模式
  25. set sw=4 :设置默认缩进的大小为4

还有更多的vim参数设置,在需要用到的设置的时候可以参考一下

这个哥们写的还挺好,直接把链接粘过来了

http://webcache.googleusercontent.com/search?q=cache:http://yyq123.blogspot.com/2010/10/vim-indent.html&gws_rd=cr&dcr=0&ei=lWoXWqmREKqt0gL4oa24CQ

文档更新时间: 2018-12-13 18:35   作者:张尚