mihaifm / vimpanel

A modern side panel for Vim
106 stars 9 forks source link

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

Open wimstefan opened 11 years ago

wimstefan commented 11 years ago

: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 commented 11 years ago

Is it a solution to make that autocommand configurable?

mhinz commented 11 years ago

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?

mihaifm commented 11 years ago

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.

wimstefan commented 11 years ago

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?

MarcWeber commented 11 years ago

@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

mihaifm commented 11 years ago

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

wimstefan commented 11 years ago

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

wimstefan commented 11 years ago

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

mihaifm commented 11 years ago

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 commented 11 years ago

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

wimstefan commented 11 years ago

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 commented 11 years ago

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 ...