1. 程式人生 > >通用vim配置檔案

通用vim配置檔案

配置檔案

1.建立/home/user/.vimrc檔案。

2.配置vim常用特性,及外掛等。

3."在配置檔案中表示註釋。

.vimrc檔案內容

syntax on
set nocompatible              " be iMproved, required
filetype on                  " required
set ts=4
set expandtab
set autoindent
set cindent
set smartindent
set tabstop=4
set shiftwidth =4
set fileencodings=utf-8-bom,ucs-bom,utf-8,cp936,gb18030,ucs,big5
set number

"設定Vundle的執行路徑並初始化
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" Vundle安裝位置與外掛路徑不同時,需要Vundle外掛的路徑
"call vundle#begin('~/some/path/here')
"------------------要安裝的外掛不能寫在此行前!------------------

"Vundle對自己的呼叫,不可刪去
Plugin 'VundleVim/Vundle.vim'

"以下是所支援的各種不同格式的示例
"需要安裝的外掛應寫在呼叫的vundle#begin和vundle#end之間

"如果外掛託管在Github上,寫在下方,只寫作者名/專案名就行了

"Plugin 'Valloric/YouCompleteMe'
"Plugin 'file://~/.vim/bundle/YouCompleteMe'
Plugin 'majutsushi/tagbar'
Plugin 'vim-syntastic/syntastic'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'vim-airline/vim-airline'

"如果外掛來自vim-scripts(官方),寫外掛名就行了
 Plugin 'L9'
 Plugin 'a.vim'
 Plugin 'jiangmiao/auto-pairs'
 Plugin 'scrooloose/nerdtree'
 Plugin 'Valloric/ListToggle'
 Plugin 'Lokaltog/vim-powerline'
 Plugin 'Yggdroot/indentLine'
 Plugin 'davidhalter/jedi'
 Plugin 'grep.vim'
 Plugin 'OmniCppComplete'
 Plugin 'AutoComplPop'
"如果Git倉庫不在Github上,需要提供完整的連結
" Plugin 'git://git.wincent.com/command-t.git'

"本地的外掛需要提供檔案路徑
" Plugin 'file:///home/gmarik/path/to/plugin'
"一定要確保外掛就在提供路徑的資料夾中(沒有子資料夾,直接在這層目錄下)

"執行時目錄的路徑
"Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}

"避免外掛間的命名衝突
"Plugin 'ascenator/L9', {'name': 'newL9'}

"------------------要安裝的外掛不能寫在此行後!------------------
call vundle#end()            " required
filetype plugin indent on    " required
"要忽略外掛縮排更改,請改用:
"filetype plugin on
"
" 安裝外掛的相關指令
":PluginList            - 列出已安裝外掛
":PluginInstall         - 安裝新新增的外掛;新增`!`或使用`:PluginUpdate`來更新已安裝外掛
":PluginSearch xxx      - 尋找名字帶有xxx的外掛;新增`!`重新整理本地快取
":PluginClean           - 刪除已經從列表移除的外掛;新增`!`靜默解除安裝
":h                     - 幫助和說明文件
"Vundle的設定到此為止了

map <C-n> :NERDTreeToggle<CR>
set tags+=/home/xsw/wlot_xsw/tagswlot
set tags+=/home/xsw/wlot_new/tagswlot
"let g:ycm_global_ycm_extra_conf='~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
"nnoremap <leader>jd :YcmCompleter GoToDefinitionElseDeclaration<CR>
"let g:ycm_python_binary_path = '/usr/bin/python3'
"nmap<C-a> :YcmCompleter FixIt<CR>
"ctags -af /home/xsw/access_svr/tags/accesstags -R --c++-kinds=+p --fields=+iaS --extra=+q /home/xsw/access_svr/
"ctags -R --c++-kinds=+p --fields=+iaS --extra=+q

怎樣為某個工程生成相應的tags?

假如工程資料夾為access_svr,那麼為這個工程生成一個tags名為“accesstags",生成命令如下:

ctags -af /home/xsw/access_svr/accesstags -R --c++-kinds=+p --fields=+iaS --extra=+q /home/xsw/access_svr/