3

In my vimrc,

autocmd VimEnter * NERDTree
autocmd VimEnter * wincmd p

but when I start writting a file, it tips error:

  Error detected while processing VimEnter Auto commands for "*":
  E492: Not an editor command: NERDTree

Anyone can help me ?

znlyj
  • 1,109
  • 3
  • 14
  • 34

1 Answers1

1

I tried to install NERDTree using vim-plug, so when I started vim and run :PlugInstall, I can use :NERDTree command but after going out it was no available, reason is I didn't download plugin cause I used github, so according to documentation you have to use it on demand and wrap it up your instruction:

call plug#begin('~/.vim/plugged') " Specify folder
Plug 'scrooloose/nerdtree', { 'on':  'NERDTreeToggle' }
call plug#end() " Initializes plugins

So your plugins are available now, and you can use your instructions:

autocmd VimEnter * NERDTree
autocmd VimEnter * wincmd p
G. I. Joe
  • 1,585
  • 17
  • 21