NERDTree vim plugin, trying to add file without success - vim

To my understanding, you can add files directly from MacVim with the NERDTree plugin. I navigate to NERDtree and hit 'm' to bring up the NERDTree filesystem menu as described in this post: vim and NERD Tree extension - adding a file
The problem is, I get this output after invoking 'm':
NERDTree Menu. Use j/k/enter and the shortcuts indicated
==========================================================
Error detected while processing function <SNR>14_showMenu..30..31:
line 4:
E716: Key not present in Dictionary: menuItems)-1)
E116: Invalid arguments for function len(self.menuItems)-1)
E116: Invalid arguments for function range(0, len(self.menuItems)-1)
E15: Invalid expression: range(0, len(self.menuItems)-1)
Press ENTER or type command to continue

I use NERD_tree with MacVim all of the time and I have no problems adding new files. Check what version of NERD_tree you are using. If you look in the file:
~/.vim/plugins/NERD_tree.vim
You should see this line near the top if you are using the latest version:
let s:NERD_tree_version = '4.1.0'
Also make sure that fs_menu.vim is present (this plugin is required for the file system commands)
~/.vim/nerdtree_plugin/fs_menu.vim

If you clone the git repository, make sure you run "rake install" from inside the repo...I didn't do this, and chose to just copy things around myself, and I missed the fs_menu.vim file that GWW mentioned above and that's what was giving me the error mentioned above. I just cloned the repository anew and ran "rake install" and everything works perfectly now.

This is a bug in the NERDTree plugin, you should send an email to the author, Marty Grenfell

Related

vim Error detected while processing function <SNR>66_MRU_Select_File_Cmd

I use vim8. When I use vim, whether I open or save a file, there will be errors. To save a file, I must use: w!, Open the file must be q to close the error.
Error detected while processing function <SNR>66_MRU_Select_File_Cmd[21]..<SNR>66_MRU_Window_Edit_File[67]..BufRead Autocommands for "*"..function <SNR>25_Detect[17]..<SNR>25_BufInit[1]..<SNR>25_autoload[2]..script /root/.vim/bundle/vim-rails/autoload/rails.vim[169]..function <SNR>87_add_methods[2]..<SNR>87_function:
I tried to reinstall vim, but it didn't work
sudo apt remove vim
sudo apt install vim
Also try to modify the .vimrc file and copy the .vimrc file of vim that is normally used on other servers, but it doesn't work
I also tried to add the content shown in the answer here to the top of the file, but it still failed https://github.com/powerline/powerline/issues/1925
if has('python3')
silent! python3 1
endif
and i tried the solution here, but it still failed Error detected while processing function vundle#installer#new
set shell=/bin/bash
Then I tried the solution here, but it still didn't work https://github.com/vim/vim/issues/3117
mv ~/.vimrc ~/.vimrc_back
mv ~/.vim ~/.vim_back
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
cp ~/.vim/bundle/Vundle.vim/test/minirc.vim ~/.vimrc
What should I do so that vim can be used normally and no error will be reported
When a script is sourced by Vim it is given a number, which can be used to make sense of a stack trace like yours (edited for legibility):
Error detected while processing function <SNR>66_MRU_Select_File_Cmd[21]
..<SNR>66_MRU_Window_Edit_File[67]
..BufRead Autocommands for "*"
..function <SNR>25_Detect[17]
..<SNR>25_BufInit[1]
..<SNR>25_autoload[2]
..script /root/.vim/bundle/vim-rails/autoload/rails.vim[169]
..function <SNR>87_add_methods[2]
..<SNR>87_function:
Before reinstalling Vim, a more constructive approach would be to figure out whether the problem occurs in Vim's own runtime files or in yours. You can use :help :scriptnames to put a filename to those numbers, so to speak.
Without even seeing the output of that command, it doesn't take much effort to find out that at least some of your problems come from your runtime files:
" one plugin
<SNR>66_MRU_Select_File_Cmd[21]
<SNR>66_MRU_Window_Edit_File[67]
" another plugin
..script /root/.vim/bundle/vim-rails/autoload/rails.vim[169]
..function <SNR>87_add_methods[2]
..<SNR>87_function:
Which means that you should look for the actual cause, not throw the towel and reinstall Vim or try random answers to random unrelated questions.
One good starting point would be line 21 of function MRU_Select_File_Cmd() in script number 66, which should be a call to MRU_Window_Edit_File() in your outdated version. The stack trace then points to line 67 of that function, and so on.
Hypotheses:
badly installed plugins,
incompatible Vim version,
incompatible plugins,
options incompatible with your plugins,
etc.
Good luck.

nvim finds the function but vim does not

I am using a vim/nvim plugin asyncrun that enables an API call that works fine in nvim if I implement it in ~/.config/nvim/init.vim using a line:
call asyncrun#run("", "cwd", "firefox")
Now this same line does not work for vim if I try to use it inside ~/.vimrc. I always get a warning:
Unknown finction: asyncrun#run
What needs to be changed in order for this to also work for vim?
Following the #doopNudles comment I also clarify that vim plugin is manually installed in the folder ~/.vim/pack/my-plugins/start/vim-asyncrun/asyncrun.vim/plugin/asyncrun.vim. I install all my vim plugins the same way (using the vim v8 native ability to detect plugins).
The problem was that ~/.vim/pack/my-plugins/start/vim-asyncrun/asyncrun.vim/plugin/asyncrun.vim has one extra folder!
It works if I delete the extra folder asyncrun.vim like this ~/.vim/pack/my-plugins/start/vim-asyncrun/plugin/asyncrun.vim

Get ocamlmerlin autocomplete in vim

I'm trying to get autocompletion for OCaml. I like using Vim and I found this plugin:
https://github.com/the-lambda-church/merlin
I installed it using OPAM and added the required lines to load it to my .vimrc
I made sure that OPAM bin folder (which contains ocamlmerlin) is in my .profile file and
checked that I can access it from the terminal and for vim I printed the PATH variable using "Ctrl-r =$PATH" and it shows that it contains OPAM bin folder.
It still doesn't work, I have no clue what else to do to make it work. I get syntax highlighting but that exists without merlin anyway. I want autocompletion to work.
If I press Ctrl-N to show completion suggestion I get "normal" vim completion which is basically just a list of words that are mentioned in the document.
Checking the startup log file, I can see that Vim did indeed load merlin:
chdir(/home/incraved/.opam/system/share/ocamlmerlin/vim/plugin)
fchdir() to previous dir
sourcing "/home/incraved/.opam/system/share/ocamlmerlin/vim/plugin/merlin.vim"
finished sourcing /home/incraved/.opam/system/share/ocamlmerlin/vim/plugin/merlin.vim
Searching for "/home/incraved/.opam/system/share/ocamlmerlin/vimbufsync/plugin/**/*.vim"
Any ideas?
Ctrl-N is the default completion; its sources are configured by the 'complete' option, but cannot include custom sources.
The Merlin plugin uses Omni completion, which is triggered with Ctrl-X Ctrl-O; see :help compl-omni.

Vim script not loaded?

When I work with some Python files, and run :set filetype? in Vim, I get filetype=python, so the file is recognized correctly as Python code.
I've downloaded this plugin: http://www.vim.org/scripts/script.php?script_id=1494
and put it in ftplugin folder, but its f/F keys bindings are not working, and running its :call ReFold() gives E117: Unknown Function indicating that the plugin hasn't been loaded.
Any troubleshooting tips on how to load the plugin?
Try removing this part at the top of the script:
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
And possibly moving the script to after/ftplugin directory (:help after-directory).
I think you have another python specific plugin that comes first at 'runtimepath' and defines b:did_ftplugin, which is OK, but this python script (python_editing.vim) shouldn't check for and define b:did_ftplugin since it doesn't implement the functionality of original plugin, it just extends it.
So the script is loaded, but does nothing. By running :script command without arguments one can check if some script is loaded at all.

fuzzyfinder not working in gvim

I found out about fuzzyfinder yesterday and tried installing it. Then found out I needed L9 since that is a prerequisite for fuzzyfinder.
I am getting the following errors when running gvim:
Error detected while processing /usr/share/vim/vim72/plugin/fuf.vim:
line 13:
***** L9 library must be installed! *****
Error detected while processing /usr/share/vim/vim72/plugin/l9.vim:
line 8:
E117: Unknown function: l9#guardScriptLoading
E15: Invalid expression: !l9#guardScriptLoading(expand('<sfile>:p'), 702, 0, [])
line 16:
E117: Unknown function: l9#defineVariableDefault
I've put fuf.vim and l9.vim into my plugin folder. I tried putting them in autoload folder as well but that fetches even more errors.
My version is: VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Apr 16 2010 12:40:58)
Googling did not work since question from one mailing list is spread of so many other links and the answer is nowhere to be found.
Both fuzzyfinder and l9 plugins contain more then one file. They must not work if you have thrown away most of them (and you did if you put just fuf.vim and l9.vim). You are supposed to unpack plugin archives into ~/.vim.
By the way, you may try to use vim-addon-manager. Copy the following into your shell and you should get FuzzyFinder successfully installed with an advantage of having each plugin in a separate directory and easier installation of plugins with dependencies in future:
mkdir -p ~/.vam
git clone git://github.com/MarcWeber/vim-addon-manager ~/.vam/vim-addon-manager
echo 'set rtp+=~/.vam/vim-addon-manager' >> ~/.vimrc
echo 'call vam#ActivateAddons(["FuzzyFinder"])' >> ~/.vimrc
vim # Now answer yes on all queries
While this is correct the VAM team proposes reading the official documentation about how to install VAM which can be found at github.com/MarcWeber/vim-addon-manager then cd into the doc directory.
We want to be fair and say that VAM is only one solution. Vundle, Pathogen, ... and some more exist (See related work section in docs of VAM)

Resources