vimpanel icon indicating copy to clipboard operation
vimpanel copied to clipboard

Race condition with NERDtree when opening vim with a directory argument or without an argument

Open wimstefan opened this issue 11 years ago • 12 comments

:autocmd VimEnter --- Auto-Commands --- VIM_PLUGIN_MANAGER VimEnter * call vam#SourceMissingPlugins() NERDTreeHijackNetrw VimEnter * silent! autocmd! FileExplorer call nerdtree#checkForBrowse(expand("")) PluginEasyTags VimEnter * call xolox#easytags#register(1) Vimpanel VimEnter * silent! autocmd! FileExplorer fugitive VimEnter * if expand('')==''|call fugitive#detect(getcwd())|endif SmartusLine VimEnter * call SmartusLineWin('Enter') Press ENTER or type command to continue

wimstefan avatar Jun 27 '13 12:06 wimstefan

Is it a solution to make that autocommand configurable?

wimstefan avatar Jun 27 '13 12:06 wimstefan

To clarify it a bit: both plugins (NERDTree and vimpanel) seem to do the same on VimEnter. But when doing vim <directory> he wants NERDTree to be opened instead of vimpanel.

Is there something you can do to make that configurable?

mhinz avatar Jun 27 '13 12:06 mhinz

hi that's strange... Do you get any additional errors, or is it just this behaviour? In my config it's opening NERDTree. Vimpanel shouldn't do anything when you start vim with a directory argument....unless perhaps you have it setup in your .vimrc to load when vim starts.

mihaifm avatar Jun 27 '13 12:06 mihaifm

No I don't get any errors ... I was just wondering about this behaviour since I didn't expect it. Could it be caused by the way vim-addon-manager is loading the scripts at start?

wimstefan avatar Jun 27 '13 14:06 wimstefan

@wimstefan: VAM is complex, you can configure it in many ways. Eg you can force loading plugin files "earlier" then after .vimrc has been processed. How to find out whether its a VAM bug:

  1. Create a simple .vimrc, only loading that one plugin by VAM. Problem still exists?
  2. load plugin without vam (eg by copying to .vim or by set rtp+=~/.vim/vim-addons/the-plugin) Problem gone? Its a VAM bug. File a bug report at vim-addon-manager then.

VAM does some magic (such as emitting VimEnter if you load plugins after Vim has started up). If its causing trouble we have to drop that feature or make it optional and offload this problem to plugin authors. I know that The_NERD_Tree is using such. I don't know about vimpanel

MarcWeber avatar Jun 27 '13 14:06 MarcWeber

@wimstefan it would help if you linked to your .vimrc

mihaifm avatar Jun 27 '13 14:06 mihaifm

@mihaifm: here we go then B-) -> https://gist.github.com/wimstefan/15373010fb970d06e52e

wimstefan avatar Jun 27 '13 14:06 wimstefan

OK guys ... I ran through the procedure as suggested by MarcWeber above and the result is that the problem persists even when VAM is not used at all (running vim with this vimrc -> https://gist.github.com/wimstefan/bc45f5e6dc80a06d0bf9) ... If doing so I still don't get a Fileexplorer and just see a buffer called "vimpanel-".

":autocmd VimEnter" shows this: --- Auto-Commands --- Vimpanel VimEnter * silent! autocmd! FileExplorer

wimstefan avatar Jun 27 '13 16:06 wimstefan

that's good to know....it means that vimpanel is capturing that event (here), instead of NERDTree. Still not replicating on my sytem, but I'll try it with your config, perhaps check it on Linux as well.

mihaifm avatar Jun 27 '13 17:06 mihaifm

i've put in a fix, can you try it out?

mihaifm avatar Jun 27 '13 19:06 mihaifm

Thanks for trying to fix it! I updated to the latest version but still no fileexplorer :-/

Invoking vim with "vim ~/.vim/bundle/Vimpanel" shows a message "~/.vim/bundle/Vimpanel is a directory" and that's it.

":autocmd VimEnter" still gives the same as in the very first report ...

wimstefan avatar Jun 27 '13 22:06 wimstefan

Here is the output of "vim --version" -> https://gist.github.com/anonymous/5881042 I notice the "-browse" flag but I have to admit I'm not sure what it means ...

wimstefan avatar Jun 27 '13 22:06 wimstefan