sunaku / vim-unbundle

🎁 Fast, filetype-lazy loader of Vim scripts & plugins
http://www.vim.org/scripts/script.php?script_id=4744
96 stars 6 forks source link

put bang after function call #3

Closed punassuming closed 12 years ago

punassuming commented 12 years ago

Put a ! after the function calls (Unbundle and Unftbundle) to prevent warning when sourcing your vimrc file.

sunaku commented 12 years ago

What about the autocmd on line 41? Is there a way to overwrite just that instance without wiping out other FileType autocmds?

punassuming commented 12 years ago

Your fix makes it so Unbundle is never called on re-source. So if a file is added, it never gets unbundled. One option is to have the user always put the: "call Unbundle()" command in their vimrc file.

Also, to prevent overwriting the autocommand, I would do this:

augroup unbundle
    au!
    autocmd FileType * :call Unftbundle(expand('<amatch>'))
augroup END
sunaku commented 12 years ago

To activate one-off bundles that you installed while Vim is still running, I suggest either:

  1. Run :call Unbundle() or :call Unftbundle() manually in command mode.
  2. Restart Vim.

Thanks for the augroup tip. I'm still worried about the rest of the Unftbundle setup logic: when you re-source ftdetect scripts (which typically define autocommands) you are defining a duplicate set of the same autocommands that were defined the first time your vimrc (and thereby unbundle.vim) was sourced. This redundancy will only grow each time you re-source your vimrc file and eventually cause Vim to be sluggish. :(

sunaku commented 12 years ago

Alright @ralesi, I added the bangs to function declarations as you initially requested, so re-sourcing will now work as you expect. Just be aware that re-sourcing causes redundant autocommands to pile up in your Vim session. :cop: