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
"
" Vim Configure
"
syntax on

set tabstop=4
set shiftwidth=4
set smarttab
set autoindent
set cindent
set cursorline
set nu

set incsearch

" Show space in color
highlight WhitespaceEOL ctermbg=red guibg=red
match WhitespaceEOL /\s\+$/

map <F8> : TagbarToggle<CR>

" Gtags variables
let Gtags_Auro_Map = 1
let Gtags_Auto_Update = 1

" Gtags-cscope
let GtagsCscope_Auto_Map = 1
let GtagsCscope_Auto_Load = 1
set cscopetag


"
" Vundle Vim Config
"
set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
Plugin 'L9'
" Git plugin not hosted on GitHub
Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Install L9 and avoid a Naming conflict if you've already installed a
" different version somewhere else.
" Plugin 'ascenator/L9', {'name': 'newL9'}
" YouCompleteMe
Plugin 'Valloric/YouCompleteMe'
" Tagbar: a class outline viewer for Vim
" https://github.com/majutsushi/tagbar
Plugin 'majutsushi/tagbar'

" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line

" YouCompleteMe Configure
let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
let g:ycm_complete_in_comments=1   " auto complement in comments
let g:ycm_complete_in_strings = 1
let g:ycm_collect_identifiers_from_tags_files=1
let g:ycm_seed_identifiers_with_syntax=1
set completeopt=longest,menu
(不定時更新)

沒有留言:

張貼留言