===Vim + Taglist + Ctags + Cssope + NERDTree + MinBufExplorer + QucikFixList 一键化配置===

最终实现效果:

1、左上 FileList  文件列表显示

2、左下 TagList  当前代码函数变量提示灯

3、MinBufExplorer 文件缓冲区

4、QucikFixList  cscope搜索时结果显示框

5、NERDTree  文件列表

6、Ctags 自动加载 自动加载顶层代码tags文件

7、cscope 自动加载 自动加载生成的cscpoe.in cscpoe.out 文件

8、代码自动补全提示 

快捷键:F1vim help 、F2打开/关闭FilesList & TagList 、F3打开NERDTree 、F4折叠10行代码 、F5取消所有折叠 、F6 grep光标所在单词 、F7显示当前文件路径

配置文件:http://note.youdao.com/noteshare?id=69469910c64c828266fecd3e1cb8abf6

使用方法:执行config_vim.sh脚本即可完成配置。

索引文件:在源码顶层目录执行cscope.sh 脚本即可生成cscope索引文件 和 ctags 文件。

================================================================================

我的.vimrc 

" .vimrc - Vim configuration file.
"
" Maintainer: Gavin Ge <gavin_hi@163.com>
"    Created: 2010-01-01
" LastChange: 2018-04-22

" GENERAL SETTINGS: {{{1
" To use VIM settings, out of VI compatible mode.
set nocompatible
" Enable file type detection.
filetype plugin indent on
" Syntax highlighting.
syntax on

" Other settings.
set   autoindent
set   autoread

set   background=dark
set   backspace=indent,eol,start
set   nobackup
set   cindent
set   cinoptions=:0
set   cursorline
set   completeopt=longest,menuone
set   noexpandtab
set   fileencodings=utf-8,gb2312,gbk,gb18030
set   fileformat=unix
set   foldenable
set   foldmethod=manual
set   guioptions-=T
set   guioptions-=m
set   guioptions-=r
set   guioptions-=l
set   helpheight=10
set   helplang=cn
set   hidden
set   history=1000
set   hlsearch
set   incsearch
set   nowrapscan
set   ignorecase smartcase
set   laststatus=2
set   mouse=a
set   number
set   pumheight=10
set   ruler
set   scrolloff=5
set   shiftwidth=4
set   showcmd
set   smartindent
set   smartcase
set   tabstop=4
set   termencoding=utf-8
set   textwidth=80
set   whichwrap=h,l
set   wildignore=*.bak,*.o,*.e,*~
set   wildmenu
set   wildmode=list:longest,full
set nowrap
set nocp
filetype plugin on
set noswapfile

colorscheme default

hi Pmenu ctermfg=black ctermbg=gray  guibg=#444444
hi PmenuSel ctermfg=7 ctermbg=4 guibg=#555555 guifg=#ffffff

" AUTO COMMANDS: {{{1
" auto expand tab to blanks
"autocmd FileType c,cpp set expandtab
" Restore the last quit position when open file.
autocmd BufReadPost *
    \ if line("'\"") > 0 && line("'\"") <= line("$") |
    \     exe "normal g'\"" |
    \ endif

" SHORTCUT SETTINGS: {{{1
" Set mapleader
let mapleader=","
" Space to command mode.
nnoremap <space> :
vnoremap <space> :
" Switching between buffers.
nnoremap <C-h> <C-W>h
nnoremap <C-j> <C-W>j
nnoremap <C-k> <C-W>k
nnoremap <C-l> <C-W>l
inoremap <C-h> <Esc><C-W>h
inoremap <C-j> <Esc><C-W>j
inoremap <C-k> <Esc><C-W>k
inoremap <C-l> <Esc><C-W>l
" "cd" to change to open directory.
let OpenDir=system("pwd")
nmap <silent> <leader>cd :exe 'cd ' . OpenDir<cr>:pwd<cr>

" PLUGIN SETTINGS: {{{1
" taglist.vim
let g:Tlist_Auto_Update=1
let g:Tlist_Process_File_Always=1
let g:Tlist_Exit_OnlyWindow=1
let g:Tlist_Show_One_File=1
let g:Tlist_WinWidth=30
let g:Tlist_Enable_Fold_Column=0
let g:Tlist_Auto_Highlight_Tag=1
let Tlist_Show_Menu=1

" WinManager_setting_FileExplorer

let g:winManagerWindowLayout="FileExplorer|TagList"
let g:bufExplorerMaxHeight=30
let g:winManagerWidth=30
let g:AutoOpenWinManager=1
let g:miniBufExplorerMoreThanOne=0
nmap <silent> <F2> :WMToggle<cr>

" NERDTree.vim
let g:NERDTreeWinPos="right"
let g:NERDTreeWinSize=20
let g:NERDTreeShowLineNumbers=1
let g:NERDTreeQuitOnOpen=0
nmap  <F3> :NERDTreeToggle<cr>


" Ctags_setting
" set tags=~/code/E7T_master_0320/tags
" set tags=tags
set autochdir

" cscope.vim
set cscopequickfix=s-,c-,d-,i-,t-,e-
if has("cscope")
    set csto=1
    set cst
    set nocsverb
    if filereadable("cscope.out")
        cs add cscope.out
    else
        let cscope_file=findfile("cscope.out", ".;")
        let cscope_pre=matchstr(cscope_file, ".*/")
        if !empty(cscope_file) && filereadable(cscope_file)
            exe "cs add" cscope_file cscope_pre
        endif
    endif
    set csverb
endif

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

nmap <C-n> :cnext<CR>
nmap <C-p> :cprev<CR>
nmap <C-t> :colder<CR>:cc<CR>

" OmniCppComplete.vim
"set nocp 
"filetype plugin on 
let g:OmniCpp_DefaultNamespaces=["std"]
let g:OmniCpp_MayCompleteScope=1
let g:OmniCpp_SelectFirstItem=2

" VimGDB.vim
if has("gdb")
    set asm=0
    let g:vimgdb_debug_file=""
    run macros/gdb_mappings.vim
endif

" LookupFile setting
let g:LookupFile_TagExpr='"./tags.filename"'
let g:LookupFile_MinPatLength=2
let g:LookupFile_PreserveLastPattern=0
let g:LookupFile_PreservePatternHistory=1
let g:LookupFile_AlwaysAcceptFirst=1
let g:LookupFile_AllowNewFiles=0

nmap <silent> <F4> zf10j
nmap <silent> <F5> zE

nmap  <F6> :vimgrep /<C-R>=expand("<cword>")<cr>/ **/*.c **/*.h<cr><C-o>:cw<cr>

nmap <silent> <F7> :pwd<cr>

" map ta :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>

 

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值