You can do it manually like ingo's method.. copying the files and directories within the nerdtree zip into ~/.vim
though that isn't that neat.
Or, you can use a vim plugin manager like Plug (which is like a package manager but for vim plugins). https://github.com/junegunn/vim-plug/ . Sand's method didn't quite work for me.
To use plug, you need a directory for the plugins that plug will be managing. I called mine something like ~/.vim/plug_plugins/
And you need to install Plug - instructions here https://github.com/junegunn/vim-plug/blob/master/README.md i.e. you need to get the file plug.vim and put it in ~/.vim/autoload
This line they give here will create a directory ~/.vim/autoload if it doesn't exist already, and put plug.vim in there
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim`
Things in the autoload directory don't load automatically, but are called with a 'call' line in vimrc
.
As the readme mentions, you need a call begin line, then however many lines to install plugins, then a call end line. And the call line should be passed the directory where the packages will be stored.
call plug#begin('~/.vim/plug_plugins')
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
call plug#end()
save your vimrc,
run the command :PlugInstall, and it should install NERDTree,
That will automatically put a nerdtree directory in ~/.vim/plug_plugins with all the relevant files, what'd be there if you had extracted the zip there.
and you can test that it is installed with :NERDTree
which also starts it.
Also, you can run :PlugStatus to show what plugins are installed.
If you look in the readme for Plug, you'll see it lists NERDTree, even though as of writing, NERDTree's git page doesn't mention Plug in its readme. The plug readme is better for installing nerdtree in plug, than the nerdtree readme.
And this line helps as a shortcut to start it nnoremap <leader>ne :NERDTree <cr>