>>>>> I'm regularly doing :split filename1 followed by :split filename2 >>>>> followed by :split filename3 and was trying to do :split filename* but >>>>> this didn't work. The goal would be to split the window in as many >>>>> pieces as the number of files that match filename* and have each of >>>>> the matching files in it's own split window. >>>>> >>>>> Basically I'm trying to automate :split filename1 :split filename2 >>>>> :split filename3 etc etc. >>>>> >>>>> Is there a way to do this? >>>> >>>> You can do >>>> >>>> :args filename* >>>> >>>> to set the argument list to that set of files, then >>>> >>>> :all >>>> >>>> to open each file in the argument list in a new window. >>> >>> Wow, this is great, thanks! If I would have known this in the last 10 >>> years..... :) >> >> This in itself is pretty cool, but now I'd like to make something even >> cooler by hooking up a custom function to do this. This is where I'm >> currently failing. What I'd like to see is when I type >> >> :msplit filename* >> >> then this should be equivalent to >> >> :args filename* >> :all >> >> where of course msplit stands for multiple split. I don't really know >> how vim functions work, so far I was always copy-pasting already >> working stuff and only modified them for myself. So based on this >> limited experience what I tried was >> >> function! Msplit( expr ) >> args a:expr >> all >> endfunction >> >> but this (maybe trivially) doesn't work. What would be the way to do this? > > Try this (untested): > > function! Msplit(...) > if a:0 > 0 > exec args join(a:000, ' ') > endif > all > endfunction > > command! -args=* -complete=file Msplit :call Msplit(<f-args>)
This, in its current form, gives an error, E181: Invalid attribute: args=* But since you have the magical -complete=file expression in your command, it made me think maybe this has something to do with Tab-completion? Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
