> On 08/22/2011 01:47 PM, Tim Chase wrote:
>> Should the last file in the resulting filespec
>> override the others (as if ":e f[12].txt" did the same thing as ":e
>> f1.txt" followed by ":e f2.txt")?
>
> My guess is that if you asked 100 vim users, 90-95 would be fine with
> either leaving first or last file in current window and loading the
> rest in buffer list.
>
> But for this command, out of thousands, it can't be done!
Not too hard to throw together something that will end up editing
all of them:
function! Edit(really, ...)
if len(a:000)
for globspec in a:000
let l:files = split(glob(globspec), "\n")
for fname in l:files
exec 'e'.(a:really).' '.(fname)
endfor
endfor
else
exec 'e'.(a:really)
endif
endfunction
command! -nargs=* -complete=file -bang E call Edit("<bang>",
<f-args>)
which should give you an ":E" command that works like ":e" except
that if you give it one or more filespecs, it loads them all and
leaves you on the last one. E.g.
:E
:E!
:E *.txt
:E! *.txt
:E *.txt *.html
:E! *.txt *.html
So, while I wouldn't use, it's a pretty simple function to make
use of.
-tim
--
You received this message from the "vim_use" 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
No comments:
Post a Comment