windows下 gvim8.0 編譯器配置

最近因爲各類緣由,IDE從source insight換成了vim,參考了諸多博客的文章,折騰了很久折騰了個大概的樣子,如今總結一下經驗:php

主要參考:git

改造vim變成source insightgithub

Winxp下 gvim 編程環境搭建數據庫

VIM學習筆記 摺疊 (Fold)編程

效果圖(新:Taglist+NERD_Tree+SrcExpl),圖爲自動補全狀態:vim

 

 

效果圖(舊:WinManager+SrcExpl):bash

 

 

 

1. 安裝:學習

下載gvim8.0安裝就能夠了字體

剛裝完是這個樣子的:ui

 

2. 插件安裝:

選用的插件以下表 (嘗試後發現WinManager和SrcExpl衝突,改用Trinity)

插件名

做用

下載地址

 安裝方法(vimrc在後面統一配置)

taglist

基於ctags的taglist

http://www.vim.org/scripts/script.php?script_id=273

解壓到.\vim80目錄下面

WinManager

將FileExplore和Taglist整合

http://www.vim.org/scripts/script.php?script_id=95

解壓到.\vim80目錄下面

Ctags

ctags,用於生成tag文件(符號連接)

http://ctags.sourceforge.net

將ctags.exe放到.\vim80路徑下,並將vim80添加到環境變量/ctags.exe放到system32路徑下

Snipmate

提供經常使用代碼快速輸入(Tab補齊)

http://www.vim.org/scripts/script.php?script_id=2540

解壓到.\vimfiles目錄下面

Supertab

用Tab鍵自動補齊

http://www.vim.org/scripts/script.php?script_id=1643

Open the file in vim ($ vim supertab.vmb)
Source the file (:so %)

SrcExpl

實現source insight的預覽框的功能

http://www.vim.org/scripts/script.php?script_id=2179

解壓到.\vimfiles目錄下面

Cscope

ctags的強化版,不只能夠生成源tag還能生成調用tag

http://sourceforge.net/projects/mslk/files/

將壓縮包解壓並將目錄加入環境變量path中

Trinity

NERD_Tree+taglist+SrcExpl的組合版

http://www.vim.org/scripts/script.php?script_id=2347

解壓到.\vimfiles目錄下面

3. 主題安裝:

vim主題選用monokai,字體選用consolas

主題地址:https://github.com/sickill/vim-monokai

更改文件名爲monokai.vim後放到vim80\colors\裏

我的喜愛的一些修改:(修改到monokai.vim對應的行)

hi Search term=reverse cterm=NONE ctermfg=231 ctermbg=24 gui=NONE guifg=#f8f8f2 guibg=#AA0000
hi Folded ctermfg=242 ctermbg=235 cterm=NONE guifg=#75715e guibg=#272822 gui=NONE
hi FoldColumn ctermfg=242 ctermbg=235 cterm=NONE guifg=#75715e guibg=#272822 gui=NONE

  

4.vimrc更改:

 在_vimrc文件後增長以下:

"設置Taglist
let Tlist_Show_One_File=1
let Tlist_Exit_OnlyWindow=1

"使用F8打開Taglist
"nmap <silent> <F8> :TlistToggle<CR>
"經過WinManager插件來將TagList窗口和netrw窗口整合起來
let g:winManagerWindowLayout='FileExplorer|TagList'
"nmap <F8> :WMToggle<cr>
"使用F9打開SrcExpl
"nmap <F9> :SrcExplToggle<CR>

"Trinity 設置
" Open and close all the three plugins on the same time 
nmap <F8>   :TrinityToggleAll<CR> 
" Open and close the srcexpl.vim separately 
nmap <F9>   :TrinityToggleSourceExplorer<CR> 
let g:SrcExpl_jumpKey = "<ENTER>" 
let g:SrcExpl_gobackKey = "<SPACE>" 
let g:SrcExpl_prevDefKey = "<F3>" 
let g:SrcExpl_nextDefKey = "<F4>" 

"設置SuperTab,用tab鍵打開cppcomplet的自動補全功能。
let g:SuperTabRetainCompletionType=2
let g:SuperTabDefaultCompletionType="<C-X><C-O>"
"顯示行號
set number
"設置主題顏字體
colorscheme monokai
set guifont=Consolas:h12
"爲了使用智能補全,打開文件類型檢測,關閉VI兼容模式
filetype plugin indent on
set nocp
"字符匹配單詞
set incsearch
"代碼摺疊
set fdm=syntax
set foldlevel=1
set foldcolumn=2
"不換行
set nowrap
"縮進設置
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab
set softtabstop=4

  

F8開啓所有插件,F9開關SrcExpl(Trinity版)

Winmanager的設置被注視掉了(發現和SrcExpl衝突)

cscope設置:(我沒用到)

詳見:http://cscope.sourceforge.net/cscope_maps.vim

"cscope
nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-\>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-\>d :cs find d <C-R>=expand("<cword>")<CR><CR>

 

5. 一些其餘設置:

tags生成(雖然Source Explore支持每次打開調用時更新,但若是首次打開沒有tags會在當前目錄生成,若是打開的是工程內部文件就會致使tags不全,因此首次運行最好生成一下)

ctags -R ./Drvlib ./Source ./Include

cscope數據庫生成(路徑更改成本身的)

find -P ./Drvlib ./Source ./Include > cscope.files
cscope -bq

cscope數據庫包含(路徑更改成本身的)

cscope add ..\cscope.out
相關文章
相關標籤/搜索