2014-02-10 59 views
1

我確實使用帶有Tagbars和The-NERD-tree插件的vim。我也想啓用autochdir。但有時候,當我用NERD-tree插件在文件之間切換時,Tagbar不會刷新它的內容,而是堅持使用以前文件中的標籤。如果我再次執行「TagbarToggle」 - 第二個Tagbar窗口會顯示當前文件標籤。如果我禁用autochdir - 它似乎工作正常。我該如何解決這個問題?當前.vimrc已附加。謝謝。vim Tagbar插件

syntax on   " syntax hl by default 
set background=dark " dark background 
set shortmess+=I " no startup uganda msg 
set showcmd   " Show (partial) command in status line. 
set showmatch  " Show matching brackets. 
set incsearch  " Incremental search 
set autowrite  " Automatically save before commands like :next and :make 
set hidden   " Hide buffers when they are abandoned 
set mouse=a   " Enable mouse usage (all modes) 
set number   " line numbers 
set guioptions-=T " no toolbar 
set vb t_vb=  " no beeps 
set ruler   " status bar and ruller for each windows 
set showmatch  " show matching brace 
set autoindent  " the current line's indent level to set the indent level of new lines) 
set smartindent  " attempt to intelligently guess the indent level 
set smartcase  " Do smart case matching 
set ignorecase  " Do case insensitive matching 
set virtualedit=all " This setting allows the cursor to freely roam anywhere it likes in command mode. 
"set autochdir  " Automaticly changes dir to active 
"set autowriteall " Autosave files 

"-color scheme------------------------------------------- 
"colorscheme ir_black 

"-tabs configs------------------------------------------- 
set expandtab 
set tabstop=4 
set showtabline=4 
set shiftwidth=4 

"-ctags configs------------------------------------------ 
"search for tag files until root 
set tags=tags;/ 

"-autosave configs--------------------------------------- 
set autowrite 

"-search configs----------------------------------------- 
set hlsearch 
" seek for selected test 
nnoremap * *N 
"turn off higliting 
nnoremap 8 :nohlsearch<CR> 
"nnoremap <S-F8> :nohlsearch<CR> 
" search in selected text 
vnoremap * y :execute ":let @/[email protected]\""<CR> :execute "set hlsearch"<CR> 

"-spellcheck configs------------------------------------- 
set spelllang=en_us 
nn <F7> :setlocal spell!<CR> 
let g:spellfile_URL = 'http://ftp.vim.org/vim/runtime/spell' 
"setlocal spell spelllang=en_us 
"nn <F7> :setlocal spell! spelllang=en_us<CR> 
"imap <F7> <C-o>:setlocal spell! spelllang=en_us<CR> 
"it should get the dictionary files 

"-move between windows----------------------------------- 
nmap <silent> <C-k> :wincmd k<CR> 
nmap <silent> <C-j> :wincmd j<CR> 
nmap <silent> <C-h> :wincmd h<CR> 
nmap <silent> <C-l> :wincmd l<CR> 
"move between windows 
nnoremap <Tab> <C-W>w 
"move between windows backwards 
nnoremap <S-Tab> <C-W>W 

"-encoding----------------------------------------------- 
"set encoding=utf-8 

"-show invisible chars----------------------------------- 
set listchars=tab:>-,eol:$ 
nnoremap <F8> :set list!<CR> 
":highlight NonText ctermfg=red 
"set listchars=tab:▸\ ,eol:¬ 
"set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:< 

"-Tag bar config----------------------------------------- 
nnoremap <F4> :TagbarToggle<CR> 

"-buffers------------------------------------------------ 
"nnoremap <F7> :TMiniBufExplorer<CR> 
nnoremap <F5> :ls<CR> 
nnoremap <C-n> :bnext<CR> 
nnoremap <C-b> :bprev<CR> 
nnoremap <C-c> :enew<CR> 
nnoremap <C-x> :bp<bar>sp<bar>bn<bar>bd<CR> 

"-grep--------------------------------------------------- 
nnoremap <silent> <F9> :Grep<CR> 

"-nerd tree---------------------------------------------- 
nnoremap <F3> :NERDTreeToggle<CR> 

"-clipboard---------------------------------------------- 
set clipboard=unnamedplus 

"-easymotion--------------------------------------------- 
map <F6> <Leader><Leader>W 

"-cscope--------------------------------------------- 

"-VIM plugins-------------------------------------------- 
filetype off 
set rtp+=~/.vim/bundle/vundle/ 
call vundle#rc() 
filetype plugin indent on 

" L9 - vim programming library 
Bundle 'L9' 
Bundle 'The-NERD-tree' 
Bundle 'EasyMotion' 
Bundle 'grep.vim' 
Bundle 'Tagbar' 
Bundle 'chazy/cscope_maps' 

"Bundle 'buftabs' 
"Bundle 'autoload_cscope.vim' 
"Bundle 'chazy/cscope_maps' 
"Bundle 'FuzzyFinder' 
"Bundle 'tpope/vim-fugitive' 

回答