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

Pass filetype array to Unftbundle #5

Closed eligundry closed 12 years ago

eligundry commented 12 years ago

Hi there, I'm really loving the speed improvements Unbundle is doing for my Vim install. I have but one issue, and that's passing multiple filetypes to Unftbundle. For example, when I'm working with PHP files, I want to have my HTML, CSS, and Javascript bundles loaded. I do this with an augroup block, like so:

augroup ft_php
    au!
    call Unftbundle('html')
    call Unftbundle('css')
    call Unftbundle('javascript')
augroup END

I think we can all agree that this could be a much nicer process if Unftbundle accepted an array, which would make my example:

augroup ft_php
    au!
    call Unftbundle(['html', 'css', 'javascript'])
augroup END

Here are my suggestions:

  1. Simply allow Unftbundle to accept an array of filetypes
  2. Provide a seperate function in Unbundle that allows for an associative array that calls these autocmd's automatically (example below)
let g:unftbundle_map = { 'php': ['html', 'css', 'javascript'],
                       \ 'eruby': ['ruby', 'haml', 'scss', 'html', 'css'],
                       \ 'html': ['css', 'javascript'] }
sunaku commented 12 years ago

Good point. I prefer your second approach. But what do you think about the existing convention of adding a new ftplugin/php.vim into Unbundle itself?

eligundry commented 12 years ago

That's certainly a fair point. I guess that's a way to skin this horse, but I'd just as soon define it in a single liner in my .vimrc than create a new file. Also, since I use Git submodules, it would be tricky to sync across all my machines without making a fork.

sunaku commented 12 years ago

I just noticed that the argument passed to Unftbundle() is inserted into a glob, so you can load multiple filetypes like this:

call Unftbundle('{html,css,javascript}')

Will that suffice?

eligundry commented 12 years ago

@sunaku Oh my, yes, that will totally work. Thank you so much!

sunaku commented 12 years ago

Good. Closing.