我的vim 配置

$HOME目录下的.vimrc的 配置

不得不说vim确实是很强大的代码编辑器,虽然开始学习比较其他编辑器时间长,但真的值啦!

下面是我的vim一些配置。

  1. set nocompatible
  2. set nu
  3. set relativenumber "相对行号
  4. set ignorecase
  5. source $VIMRUNTIME/vimrc_example.vim
  6. source $VIMRUNTIME/mswin.vim
  7. behave mswin
  8. set enc=utf-8
  9. set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936
  10. set langmenu=zh_CN.UTF-8
  11. language message zh_CN.UTF-8
  12. set guifont=Bitstream_Vera_Sans_Mono:h10:cANSI
  13. "解决菜单中文乱码问题
  14. source $VIMRUNTIME/delmenu.vim
  15.  source $VIMRUNTIME/menu.vim
  16. set foldmethod=indent "代码折叠
  17. set foldminlines=15
  18. set ignorecase
  19. set directory=$HOME
  20. "隐藏工具栏和菜单栏
  21. set guioptions-=m
  22. set guioptions-=T
  23. "与Windows共享剪贴板
  24. set clipboard+=unnamed
  25. colorscheme molokai
  26. let mapleader = ","
  27. set diffexpr=MyDiff()
  28. function MyDiff()
  29.   let opt = '-a --binary '
  30.   if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
  31.   if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
  32.   let arg1 = v:fname_in
  33.   if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
  34.   let arg2 = v:fname_new
  35.   if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
  36.   let arg3 = v:fname_out
  37.   if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
  38.   let eq = ''
  39.   if $VIMRUNTIME =~ ' '
  40. if &sh =~ '\<cmd'
  41. let cmd = '""' . $VIMRUNTIME . '\diff"'
  42.       let eq = '"'
  43.     else
  44.       let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
  45. endif
  46. else
  47. let cmd = $VIMRUNTIME . '\diff'
  48.   endif
  49.   silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
  50. endfunction
  51. filetype on
  52. " 此处规定Vundle的路径
  53. set rtp+=$VIM/vimfiles/bundle/vundle/
  54. call vundle#rc('$VIM/vimfiles/bundle/')
  55. Bundle 'gmarik/vundle'
  56. filetype plugin indent on
  57. " original repos on github<br>Bundle 'mattn/zencoding-vim'
  58. Bundle 'drmingdrmer/xptemplate'
  59. " vim-scripts repos 插件管理
  60. Bundle 'L9'
  61. Bundle 'a.vim'
  62. Bundle 'OmniCppComplete'
  63. Bundle 'FuzzyFinder'
  64. Bundle 'bufexplorer.zip'
  65. Bundle 'taglist.vim'
  66. Bundle 'Mark'
  67. Bundle 'The-NERD-tree'
  68. Bundle 'matrix.vim'
  69. Bundle 'closetag.vim'
  70. Bundle 'The-NERD-Commenter'
  71. Bundle 'matchit.zip'
  72. Bundle 'AutoComplPop'
  73. Bundle 'jsbeautify'
  74. Bundle 'YankRing.vim'
  75. Bundle 'Markdown'
  76. Bundle 'Markdown-syntax'
  77. Bundle "honza/vim-snippets"
  78. filetype plugin indent on " required!
  79. "插件配置
  80. "let g:vim_markdown_folding_disabled=1
  81. "快捷键(F9)打开TagList
  82. map <silent> <F9> :TlistToggle<cr>
  83. map <silent> <F8> :NERDTree<cr>
  84. "set TEMP='C:\Documents and Settings\Administrator\Local Settings\Temp'
  85. "let Tlist_Ctags_Cmd='D:\Program Files\Vim\vim74\ctags.exe'
  86. let Tlist_Ctags_Cmd='D:\ctags.exe'
  87. let Tlist_Show_One_File=1
  88. let Tlist_Exit_OnlyWindow=1
  89. "如果taglist窗口是最后一个窗口,则退出vim
  90. let Tlist_Exit_OnlyWindow = 1
  91. "在右侧窗口中显示taglist窗口
  92. let Tlist_Use_Right_Window = 1
  93. set tags+=$VIM/vimfiles/tags/cpp
  94. set tags=tags;
  95. map <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
  96. let OmniCpp_NamespaceSearch = 1
  97. let OmniCpp_GlobalScopeSearch = 1
  98. let OmniCpp_ShowAccess = 1
  99. let OmniCpp_ShowPrototypeInAbbr = 1 " show function parameters
  100. let OmniCpp_MayCompleteDot = 1 " autocomplete after .
  101. let OmniCpp_MayCompleteArrow = 1 " autocomplete after ->
  102. let OmniCpp_MayCompleteScope = 1 " autocomplete after ::
  103. let OmniCpp_DefaultNamespaces = ["std", "_GLIBCXX_STD"]
  104. " automatically open and close the popup menu / preview window
  105. au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif
  106. set completeopt=menuone,menu,longest,preview
  107. let g:snipMate = {}
  108. let g:snipMate.scope_aliases = {}
  109. let g:snipMate.scope_aliases['ruby'] = 'ruby,rails'
  110. augroup filetypedetect
  111. au! BufRead,BufNewFile *nc setfiletype nc
  112. augroup END

上述快捷键

F8: 文件目录,
F9: 生成taglist标签,
:A : 打开对应头文件的源文件(.h 与.c 文件切换)
“,+c+space”:反/注释代码

下面 是以上配置效果图





附件列表

     

    posted @ 2014-11-24 20:16  i-小乐  阅读(278)  评论(0编辑  收藏  举报