I am relatively new to the linux world and have started recently exploring the options it provides and I am fascinated by the power of vim editor.I have recently installed vim74 (the latest version of vim editor for linux)on my mintlinux machine. And tried tutorials that ship along with it and i am pretty comfortable with them.
Now, I want to add a new plugin called NERDTree for vim. I have gone through a lot of examples on google to search for a proper tutorial on the same but I see that they point to a relatively different file structure (Probably those tutorials were made for a different version of vim, if I understand it correctly) and that confuses me.
As I understand there is a plug-in manager called pathogen for vim which has to be placed in autoload directory under vim. But I don’t see any such directory called "autoload".
If you want to use NERDTree, you can open NERDTree (type :NERDTree ), navigate to your file, and then press t with cursor on the file name. This will open specific file in new tab.
step1: First install pathogen
Pathogen
step2: run it in the terminal
git clone https://github.com/scrooloose/nerdtree.git ~/.vim/bundle/nerdtree
source
step3: if you what to open a NERDTree automatically when vim starts up add:
autocmd vimenter * NERDTree
to your .vimrc file in (~/.vimrc). from same source as step 2
You don't need a plugin manager; it just makes management and updates easier [when you have several plugins]. The simplest (and still perfectly valid) way is to just unzip the plugin(s) into a ~/.vim
directory.
~/.vim
:$ mkdir ~/.vim
$ unzip path/to/nerdtree-master.zip -d /tmp
$ mv /tmp/nerdtree-master/* ~/.vim/
$ rmdir /tmp/nerdtree-master
Ensure that the directory structure (autoload
, plugin
etc.) is directly inside ~/.vim
!
A plugin manager will allow you to keep the plugins in separate directories. Pathogen is one of the simplest and earliest. You can use git
to directly clone and update from GitHub; Pathogen extends Vim's 'runtimepath'
so that these additional directories (called bundles) are considered.
Other plugin managers include capabilities for automatically locating and downloading plugins (from sources like GitHub, vim.org, etc.) They are more comfortable (especially if you don't know Git well), but also add complexity.
I install my vim plugins using Plug. First install Plug using the command: curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
(refer to their installation page if required).
Next in your ~/.vimrc
add these lines: call plug#begin()
Plug 'scrooloose/nerdtree'
call plug#end()
autocmd VimEnter * NERDTree
Now from your vim execute the command :PlugInstall nerdtree
(or just :PlugInstall
which will install all plugins listed). This should do the trick. In the .vimrc file 'scrooloose/nerdtree' comes from their github url.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With