I'm trying to get switch over to vim as my primary editor and I've installed the nerdTree plugin, but now when I try and use vimpager to replace less I get

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

I've narrowed it down to this line in my .vimrc, but I don't know much about configuring vim, I got this .vimrc off the internet.

autocmd VimEnter * NERDTree 

My best guess is that vimpager is trying to disable plugin, but the .vimrc is trying to load it, so they're getting an error.

Any advise on resolving this?


1 Answer 1


The correct fix is to move

autocmd VimEnter * NERDTree

out of your ~/.vimrc and into ~/.vim/after/plugin/NERD_tree.vim.

That way, the autocmd only gets run if NERD_tree has also been loaded.

And to be more correct, you should probably make it

if exists("loaded_nerd_tree")
    echo 'loaded_nerd_tree' . loaded_nerd_tree

that way if the plugin is uninstalled, your after script won't still try to use the plugin.

  • Thanks that worked. I put autocmd VimEnter * NERDTreeerd_tree autocmd VimEnter * wincmd p inside the if instead though. Otherwise when I start vim I need to press enter to continue Apr 23, 2011 at 17:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .