如何使用Vundle安装NERDTree?


26

我开始使用Vim,我选择了Vundle而不是Pathogen。

我想知道是否可以使用Vundle安装NERDTree。

我正在启动Vim并搜索NERDTree,如下所示:

:BundleSearch NERDTree

但是它没有找到插件,只是:

"Keymap: i - Install plugin; c - Cleanup; s - Se|
arch; R - Reload list                           |~                                               
"Search results for: NERDTree                   |~                                               
Plugin 'nerdtree-ack'                           |~                                               
Plugin 'FindInNERDTree'  

1
作为新用户,您不应安装任何插件。首先适应香草Vim,然后在遇到问题时寻找解决方案。其中一些解决方案将是插件,而其他解决方案则不会。恰当的例子:Vim已经附带了一个文件浏览器,因此您不需要安装其他文件浏览器……并且您也不需要插件管理器。
romainl

Answers:


31

下面是空的Vundle配置。

set nocompatible 
filetype off

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

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

" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required

现在,如果您想添加一个新的插件示例 nerdtree

您只需添加行

Plugin 'scrooloose/nerdtree'

现在,vimrc将如下所示

set nocompatible 
filetype off

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" added nerdtree
Plugin 'scrooloose/nerdtree'
" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required

现在,只需保存vimrc并重新启动vim,以便它可以获取新的vimrc,然后发出:PluginInstall命令:

:PluginInstall

有关使用的更多信息,请参见此处


与其重启,不如考虑运行命令source ~/.vimrc
cirrusio

我也按照上述步骤操作,现在可以正常工作。
saitgulmez
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.