2016年9月12日 星期一

VIM環境設置 - .vimrc

這一篇主要是為了做個紀錄,為了以後有需要時可以馬上參考

  1. 語法有色彩、自動縮排、顯示行號以及顯示多餘的行未空白
  2. TagBar plugin : 很方便的工具,可以快速知道這份文件有使用哪些變數及函式名稱。加一個Mapping,按F8可以自由開關。(官網在這)
  3. Global(Gtags) : Trace code必備!相同功能的有ctags, etags, cscope等等…(官網在這)
  4. Vim Vundle : 管理vim套件。說實話不太會用,主要是為了安裝YouCompleteMe。(官網在這)
  5. YouCompleteMe : 程式會自動補完的工具。由於要自行編譯,安裝過程複雜而且容易失敗。(官網在這)

.vimrc
  1. "
  2. " Vim Configure
  3. "
  4. syntax on
  5.  
  6. set tabstop=4
  7. set shiftwidth=4
  8. set smarttab
  9. set autoindent
  10. set cindent
  11. set cursorline
  12. set nu
  13.  
  14. set incsearch
  15.  
  16. " Show space in color
  17. highlight WhitespaceEOL ctermbg=red guibg=red
  18. match WhitespaceEOL /\s\+$/
  19.  
  20. map <F8> : TagbarToggle<CR>
  21.  
  22. " Gtags variables
  23. let Gtags_Auro_Map = 1
  24. let Gtags_Auto_Update = 1
  25.  
  26. " Gtags-cscope
  27. let GtagsCscope_Auto_Map = 1
  28. let GtagsCscope_Auto_Load = 1
  29. set cscopetag
  30.  
  31.  
  32. "
  33. " Vundle Vim Config
  34. "
  35. set nocompatible " be iMproved, required
  36. filetype off " required
  37.  
  38. " set the runtime path to include Vundle and initialize
  39. set rtp+=~/.vim/bundle/Vundle.vim
  40. call vundle#begin()
  41. " alternatively, pass a path where Vundle should install plugins
  42. "call vundle#begin('~/some/path/here')
  43.  
  44. " let Vundle manage Vundle, required
  45. Plugin 'VundleVim/Vundle.vim'
  46.  
  47. " The following are examples of different formats supported.
  48. " Keep Plugin commands between vundle#begin/end.
  49. " plugin on GitHub repo
  50. Plugin 'tpope/vim-fugitive'
  51. " plugin from http://vim-scripts.org/vim/scripts.html
  52. Plugin 'L9'
  53. " Git plugin not hosted on GitHub
  54. Plugin 'git://git.wincent.com/command-t.git'
  55. " git repos on your local machine (i.e. when working on your own plugin)
  56. Plugin 'file:///home/gmarik/path/to/plugin'
  57. " The sparkup vim script is in a subdirectory of this repo called vim.
  58. " Pass the path to set the runtimepath properly.
  59. Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
  60. " Install L9 and avoid a Naming conflict if you've already installed a
  61. " different version somewhere else.
  62. " Plugin 'ascenator/L9', {'name': 'newL9'}
  63. " YouCompleteMe
  64. Plugin 'Valloric/YouCompleteMe'
  65. " Tagbar: a class outline viewer for Vim
  66. " https://github.com/majutsushi/tagbar
  67. Plugin 'majutsushi/tagbar'
  68.  
  69. " All of your Plugins must be added before the following line
  70. call vundle#end() " required
  71. filetype plugin indent on " required
  72. " To ignore plugin indent changes, instead use:
  73. "filetype plugin on
  74. "
  75. " Brief help
  76. " :PluginList - lists configured plugins
  77. " :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
  78. " :PluginSearch foo - searches for foo; append `!` to refresh local cache
  79. " :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
  80. "
  81. " see :h vundle for more details or wiki for FAQ
  82. " Put your non-Plugin stuff after this line
  83.  
  84. " YouCompleteMe Configure
  85. let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
  86. let g:ycm_complete_in_comments=1 " auto complement in comments
  87. let g:ycm_complete_in_strings = 1
  88. let g:ycm_collect_identifiers_from_tags_files=1
  89. let g:ycm_seed_identifiers_with_syntax=1
  90. set completeopt=longest,menu
(不定時更新)

沒有留言:

張貼留言