我正在使用ctags
生成标签并将set tags+=~/.vim/tags/cpp
(仅关注此 wiki 页面)放入.vimrc
。在我的vimrc
文件中还有如下设置,因此我可以自动同步当前文件的 nerdtree 查看器(请参阅此):
" returns true iff is NERDTree open/active
function! rc:isNTOpen()
return exists("t:NERDTreeBufName") && (bufwinnr(t:NERDTreeBufName) != -1)
endfunction
" returns true iff focused window is NERDTree window
function! rc:isNTFocused()
return -1 != match(expand('%'), 'NERD_Tree')
endfunction
" calls NERDTreeFind iff NERDTree is active, current window contains a modifiable file, and we're not in vimdiff
function! rc:syncTree()
if &modifiable && rc:isNTOpen() && !rc:isNTFocused() && strlen(expand('%')) > 0 && !&diff
NERDTreeFind
wincmd p
endif
endfunction
autocmd BufEnter * call rc:syncTree()
问题在于它~/.vim
实际上是指向另一个文件夹的符号链接(所以我可以使用 git 或其他 VCS 轻松管理我的所有点文件)。当我使用Ctrl+]查找定义(其标签信息在~/.vim/tags/cpp中)时,总会出现错误:
detected while processing function rc:syncTree..<SNR>15_findAndRevealPath..102:
line 2:
E605: Exception not caught: NERDTree.InvalidArgumentsError: /home/hongxuchen/.vim/tags/cpp_src/stl_iterator.h should be under /home/hongxuchen/data_backup/dotfiles/_vim/tags/cpp_src
这是否意味着我必须使用set tags+=/real/path/to/cpp
in 代替vimrc
?