1

I recently updated my MacBook to OSX Catalina and now I am getting some unwanted behavior in vim (though it seems to be working overall?).

On opening vim I see the following stream of errors (NERDTree is open by default, I have a manually created vim system that is on the plug-in heavy side):

MacBook-Pro:project josh$ vi
Error detected while processing /Users/josh/.vim/bundle/nerdtree/plugin/nerdtree/path.vim:
line    3:
E121: Undefined variable: g:NERDTreeSortOrder
E116: Invalid arguments for function index(g:NERDTreeSortOrder, '*')
Error detected while processing /Users/josh/.vim/bundle/nerdtree/plugin/nerdtree/tree_dir_node.vim:
line    6:
E121: Undefined variable: g:NERDTreeFileNode
E116: Invalid arguments for function copy(g:NERDTreeFileNode)
line    7:
E121: Undefined variable: s:TreeDirNode
line   11:
E121: Undefined variable: s:TreeDirNode
line   12:
E121: Undefined variable: b:NERDTreeRoot
line   13:
E121: Undefined variable: currentNode
line   16:
E133: :return not inside a function
line   17:
E193: :endfunction not inside a function
line   20:
E121: Undefined variable: s:TreeDirNode
line   21:
E121: Undefined variable: s:TreeDirNode
line   22:
E121: Undefined variable: a:0
line   23:
E121: Undefined variable: self
Error detected while processing function nerdtree#renderView[12]..nerdtree#dumpHelp:
line    2:
E121: Undefined variable: b:treeShowHelp
Error detected while processing function nerdtree#renderView:
line   15:
E121: Undefined variable: g:NERDTreeMinimalUI
line   20:
E121: Undefined variable: b:NERDTreeShowBookmarks
line   25:
E121: Undefined variable: g:NERDTreeMinimalUI
line   31:
E121: Undefined variable: b:NERDTreeRoot
line   32:
E121: Undefined variable: header
E116: Invalid arguments for function setline
line   37:
E121: Undefined variable: b:NERDTreeRoot
line   38:
E353: Nothing in register o
Error detected while processing /Users/josh/.vim/bundle/nerdtree/plugin/nerdtree/tree_dir_node.vim:
line   25:
E121: Undefined variable: self
line   26:
E193: :endfunction not inside a function
line   34:
E121: Undefined variable: s:TreeDirNode
line   35:
E121: Undefined variable: self
E116: Invalid arguments for function add
line   36:
E121: Undefined variable: self
line   38:
E121: Undefined variable: a:inOrder
line   41:
E193: :endfunction not inside a function
line   45:
E121: Undefined variable: s:TreeDirNode
line   46:
E121: Undefined variable: self
line   47:
E193: :endfunction not inside a function
line   51:
E121: Undefined variable: s:TreeDirNode
line   52:
E121: Undefined variable: self
line   58:
E193: :endfunction not inside a function
line   70:
E121: Undefined variable: s:TreeDirNode
line   71:
E121: Undefined variable: g:NERDTreeFileNode
line   72:
E121: Undefined variable: self
line   73:
E133: :return not inside a function
line   74:
E193: :endfunction not inside a function
line   81:
E121: Undefined variable: s:TreeDirNode
line   82:
E121: Undefined variable: s:TreeDirNode
line   83:
E121: Undefined variable: a:path
line   84:
E133: :return not inside a function
line   86:
E121: Undefined variable: a:path
E116: Invalid arguments for function stridx(a:path.str(), self.path.str(), 0) ==# -1
line   87:
E133: :return not inside a function
line   90:
E121: Undefined variable: self
line   94:
E133: :return not inside a function
line   98:
E133: :return not inside a function
line   99:
E193: :endfunction not inside a function
line  103:
E121: Undefined variable: s:TreeDirNode
line  104:
E133: :return not inside a function
line  105:
E193: :endfunction not inside a function
line  115:
E121: Undefined variable: s:TreeDirNode
line  116:
E121: Undefined variable: a:path
E116: Invalid arguments for function stridx(a:path.str(), self.path.str(), 0) ==# -1
line  117:
E133: :return not inside a function
line  120:
E121: Undefined variable: self
line  121:
E121: Undefined variable: index
line  122:
E133: :return not inside a function
line  124:
E133: :return not inside a function
line  127:
E193: :endfunction not inside a function
line  135:
E121: Undefined variable: s:TreeDirNode
line  136:
E121: Undefined variable: a:visible
line  137:
E121: Undefined variable: a:indx
line  140:
E133: :return not inside a function
line  141:
E193: :endfunction not inside a function
line  151:
E121: Undefined variable: s:TreeDirNode
line  152:
E121: Undefined variable: a:path
E116: Invalid arguments for function stridx(a:path.str(), self.path.str(), 0) ==# -1
line  153:
E133: :return not inside a function
line  158:
E121: Undefined variable: self
line  159:
E121: Undefined variable: z
line  168:
E133: :return not inside a function
line  171:
E133: :return not inside a function
line  172:
E193: :endfunction not inside a function
line  177:
E121: Undefined variable: s:TreeDirNode
line  178:
E121: Undefined variable: s:TreeDirNode
line  179:
E121: Undefined variable: g:NERDTreeFileNode
line  180:
E121: Undefined variable: currentDir
line  185:
E133: :return not inside a function
line  186:
E193: :endfunction not inside a function
line  190:
E121: Undefined variable: s:TreeDirNode
line  191:
E133: :return not inside a function
line  192:
E193: :endfunction not inside a function
line  199:
E121: Undefined variable: s:TreeDirNode
line  201:
E121: Undefined variable: self
line  206:
E133: :return not inside a function
line  207:
E193: :endfunction not inside a function
line  211:
E121: Undefined variable: s:TreeDirNode
line  212:
E133: :return not inside a function
line  213:
E193: :endfunction not inside a function
line  223:
E121: Undefined variable: s:TreeDirNode
line  225:
E121: Undefined variable: self
line  228:
E121: Undefined variable: self
line  229:
E121: Undefined variable: dir
line  232:
E121: Undefined variable: globDir
E116: Invalid arguments for function globpath(globDir, '*', 1) . "\n" . globpath(globDir, '.*', 1)
line  237:
E121: Undefined variable: filesStr
E116: Invalid arguments for function split(filesStr, "\n")
line  239:
E121: Undefined variable: a:silent
line  244:
E121: Undefined variable: files
line  261:
E121: Undefined variable: self
line  263:
E121: Undefined variable: a:silent
line  270:
E133: :return not inside a function
line  271:
E193: :endfunction not inside a function
line  278:
E121: Undefined variable: s:TreeDirNode
line  279:
E121: Undefined variable: s:TreeDirNode
line  280:
E121: Undefined variable: a:path
line  284:
E121: Undefined variable: self
E116: Invalid arguments for function copy(self)
line  285:
E121: Undefined variable: a:path
line  287:
E121: Undefined variable: newTreeNode
line  288:
E121: Undefined variable: newTreeNode
line  290:
E121: Undefined variable: newTreeNode
line  292:
E133: :return not inside a function
line  293:
E193: :endfunction not inside a function
line  299:
E121: Undefined variable: s:TreeDirNode
line  300:
E121: Undefined variable: s:TreeDirNode
line  301:
E121: Undefined variable: a:0
line  303:
E121: Undefined variable: opts
E116: Invalid arguments for function has_key(opts, 'where') && !empty(opts['where'])
line  309:
E133: :return not inside a function
line  311:
E133: :return not inside a function
line  314:
E193: :endfunction not inside a function
line  320:
E121: Undefined variable: s:TreeDirNode
line  321:
E121: Undefined variable: a:0
line  324:
E121: Undefined variable: self
line  325:
E121: Undefined variable: node
line  334:
E133: :return not inside a function
line  335:
E193: :endfunction not inside a function
line  340:
E121: Undefined variable: s:TreeDirNode
line  341:
E121: Undefined variable: self
line  342:
E193: :endfunction not inside a function
line  345:
E121: Undefined variable: s:TreeDirNode
line  346:
E121: Undefined variable: s:TreeDirNode
TreeDirNode.openInNewTab is deprecated, use open() instead
line  348:
E121: Undefined variable: self
line  349:
E193: :endfunction not inside a function
line  352:
E121: Undefined variable: s:TreeDirNode
line  354:
E121: Undefined variable: self
E116: Invalid arguments for function 29
line  355:
E193: :endfunction not inside a function
line  363:
E121: Undefined variable: s:TreeDirNode
line  364:
E121: Undefined variable: self
line  365:
E193: :endfunction not inside a function
line  374:
E121: Undefined variable: s:TreeDirNode
line  375:
E121: Undefined variable: self
line  387:
E193: :endfunction not inside a function
line  390:
E121: Undefined variable: s:TreeDirNode
line  391:
E121: Undefined variable: s:TreeDirNode
line  392:
E121: Undefined variable: self
line  395:
E121: Undefined variable: self
line  439:
E193: :endfunction not inside a function
line  444:
E121: Undefined variable: s:TreeDirNode
line  445:
E121: Undefined variable: a:path
line  449:
E121: Undefined variable: self
line  451:
E121: Undefined variable: self
line  455:
E133: :return not inside a function
line  458:
E121: Undefined variable: a:path
line  459:
E121: Undefined variable: p
line  463:
E121: Undefined variable: self
line  464:
E121: Undefined variable: n
line  465:
E193: :endfunction not inside a function
line  475:
E121: Undefined variable: s:TreeDirNode
line  476:
E121: Undefined variable: self
E116: Invalid arguments for function range(0, self.getChildCount()-1)
line  479:
E133: :return not inside a function
line  483:
E605: Exception not caught: NERDTree.ChildNotFoundError: child node was not found
Press ENTER or type command to continue

When I press enter to continue, everything is fine although in subtle ways it looks different than before the Catalina update so I am guessing there was a vim version change or something.

Here is the output of vi --version:

$ vi --version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Feb 29 2020 00:47:39)
macOS version
Included patches: 1-503, 505-680, 682-2292
Compiled by root@apple.com
Normal version without GUI.  Features included (+) or not (-):
+acl               -farsi             -mouse_sysmouse    -tag_any_white
-arabic            +file_in_path      -mouse_urxvt       -tcl
+autocmd           +find_in_path      +mouse_xterm       -termguicolors
+autochdir         +float             +multi_byte        +terminal
-autoservername    +folding           +multi_lang        +terminfo
-balloon_eval      -footer            -mzscheme          +termresponse
-balloon_eval_term +fork()            +netbeans_intg     +textobjects
-browse            -gettext           +num64             +textprop
+builtin_terms     -hangul_input      +packages          +timers
+byte_offset       +iconv             +path_extra        +title
+channel           +insert_expand     -perl              -toolbar
+cindent           +job               +persistent_undo   +user_commands
-clientserver      +jumplist          +postscript        -vartabs
+clipboard         -keymap            +printer           +vertsplit
+cmdline_compl     +lambda            -profile           +virtualedit
+cmdline_hist      -langmap           +python/dyn        +visual
+cmdline_info      +libcall           -python3           +visualextra
+comments          +linebreak         +quickfix          +viminfo
-conceal           +lispindent        +reltime           +vreplace
+cryptv            +listcmds          -rightleft         +wildignore
+cscope            +localmap          +ruby/dyn          +wildmenu
+cursorbind        -lua               +scrollbind        +windows
+cursorshape       +menu              +signs             +writebackup
+dialog_con        +mksession         +smartindent       -X11
+diff              +modify_fname      -sound             -xfontset
+digraphs          +mouse             +spell             -xim
-dnd               -mouseshape        +startuptime       -xpm
-ebcdic            -mouse_dec         +statusline        -xsmp
-emacs_tags        -mouse_gpm         -sun_workshop      -xterm_clipboard
+eval              -mouse_jsbterm     +syntax            -xterm_save
+ex_extra          -mouse_netterm     +tag_binary        
+extra_search      +mouse_sgr         -tag_old_static    
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1      
Linking: gcc   -L/usr/local/lib -o vim        -lm -lncurses  -liconv -framework Cocoa 

I've had the same .vimrc and .vim directory for several (5ish?) years so it's likely updates to plugins might be part of the solution and hence why I thought this is question is not redundant to this one: `:help` returns an “E432: Tags file not sorted” error

Would you recommend updating vim, updating NERDTree? Everything is working but the explosion or error messages seems worth fixing on its own.

Edit, with my .vimrc. Commenting out all NERDTree related lines did not work, moving the NERDTree directory out of .vim/bundle did remove the errors (but also removed the NERDTree functionality that I am hoping to preserve):

set nocompatible

" Pathogen
call pathogen#infect()
call pathogen#helptags()

set statusline=%<\ %n:%f\ %m%r%y%=%-35.(line:\ %l\ of\ %L,\ col:\ %c%V\ (%P)%)
filetype plugin indent on

syntax on
set number
set hlsearch
set showmatch
set incsearch
set ignorecase
set nowrap
set autoindent
set history=1000
set cursorline
set expandtab
set shiftwidth=4
set tabstop=4
set softtabstop=4

" Nerdtree
autocmd vimenter * NERDTree
let NERDTreeShowBookmarks=1
let NERDTreeChDirMode=0
let NERDTreeQuitOnOpen=1
let NERDTreeMouseMode=2
let NERDTreeShowHidden=1
let NERDTreeIgnore=['\.pyc','\~$','\.swo$','\.swp$','\.git','\.hg','\.svn','\.bzr']
let NERDTreeKeepTreeInNewTab=1
let g:nerdtree_tabs_open_on_gui_startup=0


set background=dark
colorscheme wombat

inoremap jj <Esc>

nnoremap ; :
nnoremap : ;

" Strip trailing whitespace on Python, PHP, JS, SCSS, and CSS files
autocmd BufWritePre *.py :%s/\s\+$//e
autocmd BufWritePre *.php :%s/\s\+$//e
autocmd BufWritePre *.js :%s/\s\+$//e
autocmd BufWritePre *.sass :%s/\s\+$//e
autocmd BufWritePre *.css :%s/\s\+$//e

nnoremap \e :NERDTreeToggle<CR>

inoremap <C-l> <Esc>$a
nnoremap \l :setlocal number!<CR>
nnoremap \o :set paste!<CR>

" fix possible charset issue without changing charset
" let g:NERDTreeDirArrows=0

inoremap scc <Esc>m`A;<Esc>``i
nnoremap sc <Esc>m`A;<Esc>``

" More spaces for php
autocmd Filetype php setlocal ts=4 sw=4 sts=0 expandtab

" Strip Trailing Whitespace Function
" Usage :call TrimWhiteSpace()
fun! TrimWhitespace()
    let l:save_cursor = getpos('.')
    %s/\s\+$//e
    call setpos('.', l:save_cursor)
endfun
  • Can you share a copy of you vimrc? It looks like all errors seem to be related to the NERDTree plug-in. Can you try to disable it and see if they all go away? I looked at a recent git for NERDTree and didn't see the files in the location you reported here, so not sure if your NERDTree is too old or from somewhere else... ? – filbranden May 17 at 20:39
  • I added the .vimrc. I tried removing the nerdtree folder from .vim/bundle and it did stop the error messages (but also removed the plugin that I am hoping to use). – Josh Rumbut May 17 at 20:54
  • I tried checking out the most up-to-date version of NERDTree into the .vim/bundle directory and it appears to be working. It must have needed updating ¯_(ツ)_/¯? – Josh Rumbut May 17 at 20:59
1

It appears that the solution was to upgrade NERDTree by running the following command:

git clone https://github.com/preservim/nerdtree.git ~/.vim/bundle/nerdtree

I also discovered why my helptags weren't working (a long term issue not asked about in the question), I had to run this:

:helptags ~/.vim/bundle/nerdtree/doc/

Thank you to @filbranden for pointing me in the right direction!

| improve this answer | |
  • I also posted an answer. I'm suggesting vim-plug as an alternative to Pathogen which should help you keep plug-ins up to date. Hopefully you'll like the suggestion! 😁 – filbranden May 17 at 21:10
  • 1
    Looks like I have a lot of updating to do, so I'll give it a shot, thanks! – Josh Rumbut May 17 at 21:50
1

It looks like your version of NERDTree was corrupted. It really looks to me that for some reason the *.vim scripts that were under lib/nerdtree inside the NERDTree plug-in directory ended up being moved to a plugin/nerdtree directory. Not sure if you can explain why this might have happened?

I see you're using Pathogen, which is OK, but it puts the burden on managing and updating plug-ins yourself.

I'll go ahead an recommend that you take a look at vim-plug instead.

The vim-plug manager is very similar to Pathogen in that it uses the same mechanism to manage plug-ins than Pathogen (updating 'runtimepath' to list the base directories of plug-ins), but the advantage of vim-plug is that it can also install (:PlugInstall) and update (:PlugUpdate) your plug-ins for you. Which should help you keep them up to date. Or even reinstall them all from scratch if you need to.

Oh and vim-plug also takes care of indexing the documentation for the plug-ins it installs, so you don't need to deal with running :helptags manually for them.

Take a look at the README with installation instructions, also the FAQ of vim-plug. Hopefully you'll find it to be a suitable replacement for Pathogen and you'll also appreciate the features it brings to help you install and update plug-ins which are not available from Pathogen...

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.