Tuesday, August 23, 2011

Re: :e handles one file

On 08/22/2011 10:51 PM, ZyX wrote:
> Reply to message «Re: :e handles one file»,
> sent 01:15:56 23 August 2011, Tuesday
> by Tim Chase:
>
>> 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.
> Try :E %, it does not work. You should use expand(...) instead of glob(...)
> because expand(...) expands % and some other specials and also globs. You also
> definitely forgot fnameescape() and use `len(...)' where you can write either
> `!empty(...)' or just `a:0'.

All three are nice modifications. I'm partial to the simplicity
of a:0 and just didn't have the time/inclination to investigate
whether that was JUST the number of varargs, or whether it was
the number of args in total, when len() worked when I reached for
it. I think !empty() reads the most cleanly for future maint.
purposes.

> // Not very important, but you can't :E filename with newlines.

Yeah, I noticed that, since POSIX filenames seem to allow for
that head-scratcher. However since glob() returned things with
newlines separators instead of as a List, there wasn't much to do
about that except shrug and accept it as an "if you choose to do
something stupid like put newlines in your filenames, then this
breaks and it's part of the price you pay for doing that. Do it
manually"

-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: