TagList vim 外掛無法運作

TagList vim 外掛無法運作

我在使用時遇到問題taglist。例如如果我TlistOpen,它顯示一個錯誤E117: Unknown function: taglist#Tlist_Window_Toggle

我使用的是 Ubuntu18.04 , vimrc 如下圖所示;

test@test-VirtualBox:~/.vim/taglist/plugin$ cat ~/.vimrc
set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
set rtp+=~/.vim/taglist/plugin/
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
" Plugin 'L9'
" Git plugin not hosted on GitHub
Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Install L9 and avoid a Naming conflict if you've already installed a
" different version somewhere else.
" Plugin 'ascenator/L9', {'name': 'newL9'}

Plugin 'taglist.vim'
" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
set tags=/home/test/code/tags

我已將我的標籤列表克隆到.vim/taglist/plugin.我的Exuberant Ctags安裝在 中/usr/bin/ctags並且路徑在 中可用PATH。我已經安裝了 vim 外掛程式管理器vundle。我為目錄設定了 cscope 和 ctags code。但是當我TlistOpen進入時vim,它會拋出錯誤訊息E117: Unknown function: taglist#Tlist_Window_Toggle

答案1

讓我們先消除您的所有評論噪音vimrc

set nocompatible              " be iMproved, required
filetype off                  " required
set rtp+=~/.vim/bundle/Vundle.vim
set rtp+=~/.vim/taglist/plugin/
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'git://git.wincent.com/command-t.git'
Plugin 'file:///home/gmarik/path/to/plugin'
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
Plugin 'taglist.vim'
call vundle#end()            " required
filetype plugin indent on    " required
set tags=/home/test/code/tags

以及 VundleREADME.md告訴您刪除的範例:

set nocompatible              " be iMproved, required
filetype off                  " required
set rtp+=~/.vim/bundle/Vundle.vim
set rtp+=~/.vim/taglist/plugin/
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'taglist.vim'
call vundle#end()            " required
filetype plugin indent on    " required
set tags=/home/test/code/tags

以及不相關的樣板:

set rtp+=~/.vim/bundle/Vundle.vim
set rtp+=~/.vim/taglist/plugin/
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'taglist.vim'
call vundle#end()            " required
set tags=/home/test/code/tags

首先引起注意的是您正在嘗試手動管理該插件:

set rtp+=~/.vim/taglist/plugin/

和你的外掛程式管理器:

Plugin 'taglist.vim'

這沒有任何意義。

第二件引人注目的事情是您添加了~/.vim/taglist/plugin/to:help 'runtimepath'而不是~/.vim/taglist/,這阻止了 Vim 查找~/.vim/taglist/autoload/並因此無法調用taglist#Tlist_Window_Toggle()

改變:

set rtp+=~/.vim/taglist/plugin/

到:

set rtp+=~/.vim/taglist/

應該可以暫時讓你擺脫困境,但你還是會陷入困境。

我建議你放棄手動方法並讓你的插件管理器處理一切:

  1. ~/.vim/taglist/從您的機器中刪除。
  2. set rtp+=~/.vim/taglist/您的vimrc.
  3. 替換Plugin 'taglist.vim'Plugin 'yegappan/taglist'您的vimrc.
  4. 閱讀插件管理器的文件以熟悉它。

相關內容