E492: Not an editor command: NERDTree

2019-08-26 22:21发布

When I run vim . to open up a folder I get the following error:

Error detected while processing VimEnter Auto commands for "*":
E492: Not an editor command: NERDTree .
Press ENTER or type command to continue

I don't understand where this is coming from since everything was working fine. I then tried adding other plugins and then the error was thrown. However I have NERDTree in my ~/.vimrc file. Here is what the file looks like.

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:plug_shallow = 0 " disable shallow cloning

call plug#begin()

Plug 'airblade/vim-gitgutter'                 " shows a git diff in the gutter
Plug 'altercation/vim-colors-solarized'       " precision colorscheme
Plug 'godlygeek/tabular'                      " text filtering and alignment
Plug 'janko-m/vim-test'                       " test runner
Plug 'phallstrom/vim-sailfish'
Plug 'scrooloose/nerdtree'                    " tree explorer
Plug 'sjl/gundo.vim'                          " graph your vim undo tree
Plug 'tpope/vim-commentary'                   " comment stuff out
Plug 'tpope/vim-endwise'                      " wisely add 'end' in ruby, endfunction/endif/more in vim script, etc
Plug 'tpope/vim-fugitive'                     " git wrapper
Plug 'tpope/vim-rails', { 'for': ['ruby'] }   " ruby on rails power tools
Plug 'vim-ruby/vim-ruby', { 'for': ['ruby'] } " vim/ruby configuration
Plug 'tpope/vim-projectionist'                " project configuration (file jumping)
Plug 'kana/vim-textobj-user'                  " create your own text objects
Plug 'nelstrom/vim-textobj-rubyblock'         " custom text object for selecting ruby blocks
Plug 'tpope/vim-surround'                     " quoting/parenthesizing made simple
Plug 'chriskempson/base16-vim'                " color schemes, https://chriskempson.github.io/base16/
Plug 'w0rp/ale'                               " asynchronous lint engine
Plug 'editorconfig/editorconfig-vim'          " editorConfig plugin
Plug 'vim-airline/vim-airline'                " status/tabline
Plug 'vim-airline/vim-airline-themes'         " status/tabline themes
Plug 'pangloss/vim-javascript'                " Javascript syntax
Plug 'mxw/vim-jsx'                            " react jsx syntax
Plug 'posva/vim-vue', { 'for': ['vue'] }      " Vue.js syntax
Plug '/usr/local/opt/fzf' | Plug 'junegunn/fzf.vim' " A command-line fuzzy finder written in Go
Plug 'kien/rainbow_parentheses.vim', { 'for': ['clojure'] } " Better Rainbow Parentheses
Plug 'guns/vim-clojure-static', { 'for': ['clojure'] } " Meikel Brandmeyer's excellent Clojure runtime files
Plug 'tpope/vim-unimpaired'                   " pairs of handy bracket mappings
Plug 'tpope/vim-abolish'                      " easily search for, substitute, and abbreviate multiple variants of a word
Plug 'mechatroner/rainbow_csv'                " highlighting columns in csv/tsv files
Plug 'slim-template/vim-slim' " slim syntax highlighting for vim

call plug#end()
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

set t_Co=256

set nocompatible      " We're running Vim, not Vi!
set synmaxcol=500     " don't try to highlight long lines
compiler ruby         " Enable compiler support for ruby

filetype plugin on

set background=dark
colorscheme default

set backspace=2
set expandtab
set tabstop=2 shiftwidth=2 softtabstop=2
set autoindent
set nowrap
set nrformats=

set backupdir=$HOME/.vimbackup,.
set directory=$HOME/.vimswap,.

au FocusLost * :wa

set ignorecase
set smartcase
set scrolloff=2
set ttyfast
set hidden
set wildmenu
set wildmode=list:longest
nnoremap <leader>nt :NERDTreeToggle<enter>

source $VIMRUNTIME/macros/matchit.vim

" fzf
nnoremap <silent> <C-p> :Files<CR>
nnoremap <silent> <Leader>b :Buffers<CR>

" https://github.com/tpope/vim-commentary/commit/4dcfc318e0b02fdbb0c2d9ff77cf3562b46eea25
xmap \\  <Plug>Commentary
nmap \\  <Plug>Commentary

set updatetime=250

nmap <silent> <leader>s :TestNearest<CR>
nmap <silent> <leader>t :TestFile<CR>
nmap <silent> <leader>T :TestSuite<CR>

set mouse=a
vnoremap <Leader>c "*y
noremap <Leader>v "*p

set nofixeol

set formatoptions+=j " Delete comment character when joining commented lines

au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") |
    \ exe "normal g'\"" | endif

let g:omni_sql_no_default_maps = 1 " disable SQL autocompletion entirely

" To ensure that EditorConfig plugin works well with Tim Pope's fugitive
let g:EditorConfig_exclude_patterns = ['fugitive://.*']

" ALE - Asynchronous Lint Engine
let g:ale_lint_on_enter = 0        " no checks on open
let g:ale_lint_on_save = 1         " check on save
let g:ale_lint_on_text_changed = 1 " check on text change
let g:ale_lint_delay = 300         " millisecond delay before checking

" Airline
let g:airline_theme = 'base16'                  " theme
set laststatus=2                                " always show airline
set noshowmode                                  " hide default mode indicator
let g:airline_powerline_fonts = 1               " use powerline font
let g:airline#extensions#wordcount#enabled = 0  " disable word counting
let g:airline#extensions#whitespace#enabled = 0 " disable detection of whitespace errors

" Rubocop
let g:vimrubocop_config = '/path/to/rubocop.yml'

if filereadable($HOME."/.vimrc_local")
  source $HOME/.vimrc_local
endif

let g:jsx_ext_required = 0 " JSX syntax in .js files

" open file splits in vsplit by default
:nnoremap <C-W>f :vertical wincmd f<CR>

" https://github.com/posva/vim-vue#how-can-i-use-existing-configurationplugins-in-vue-files
" autocmd BufRead,BufNewFile *.vue setlocal filetype=vue.html.javascript.css

au FileType clojure exe "RainbowParenthesesLoadRound" | RainbowParenthesesActivate

" open NERDTree automatically when vim starts up on opening a directory
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif

" https://github.com/slim-template/vim-slim/issues/38#issuecomment-23760100
autocmd BufNewFile,BufRead *.slim setlocal filetype=slim

I re-installed NERDTree but however I still that error.

标签: vim nerdtree
0条回答
登录 后发表回答