On 07-Nov-2011 04:05, P.L. Francisco Javier wrote:
> Input()/Inputdialog() show repetive information at startup, the following
> reproduce the behavior if it's added to $HOME/.vimrc:
>
> ------------
> if !isdirectory(expand(expand("~/.vim/bundle/vundle/.git/")))
> call inputsave()
> if input("Setting up vundle, this may take a while, wanna continue? (y/n):
> ") == "y"
> !git clone https://github.com/gmarik/vundle ~/.vim/bundle/vundle
> endif
> call inputrestore()
> endif
> -----------
>
> It repeats the string 'Setting up vundle, this may take a while, wanna
> continue?
> (y/n): y' till someone press <CR>
>
> If executed inside a autocmd VimEnter block it works but may be too late for
> specific cases
>
> ------------
> autocmd VimEnter * call InitVundle()
>
> function! InitVundle()
> if !isdirectory(expand(expand("~/.vim/bundle/vundle/.git/")))
> " call inputsave()
> if inputdialog("Setting up vundle, this may take a while, wanna continue?
> (y/n): ") == "y"
> !git clone https://github.com/gmarik/vundle ~/.vim/bundle/vundle
> endif
> "call inputsave()
> endif
> endfunction
> ------------
>
> The following seems to be the only workaround (thx to frogonwheels in #vim for
> the tip)
>
> -----------
> if !isdirectory(expand(expand("~/.vim/bundle/vundle/.git/")))
> call inputsave()
> echon "Setting up vundle, this may take a while, wanna continue? (y/n): "
> if nr2char(getchar()) ==? 'y'
> !git clone https://github.com/gmarik/vundle ~/.vim/bundle/vundle
> endif
> call inputrestore()
> endif
> -----------
I think this is by design; interaction with the user should only happen after
the VimEnter event fires. :help input() reads:
NOTE: This function must not be used in a startup file, for
the versions that only run in GUI mode (e.g., the Win32 GUI).
Seems logical: How can you interact with the user when the user interface is
still in the process of initializing itself?
Instead of your workaround, I would recommend to be open for alternative flows.
I'm lacking a bit of context, but how about just detecting that Vundle hasn't
been set up, and :echoing "Vundle hasn't been setup yet; execute :VundleSetup to
do so, and close and restart Vim to apply the settings."
-- regards, ingo
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php