On 8/3/06, Bob Hiestand <[EMAIL PROTECTED]> wrote:
On 8/3/06, Yakov Lerner <[EMAIL PROTECTED]> wrote:
> On 8/3/06, Bob Hiestand <[EMAIL PROTECTED]> wrote:
> > As is too often the case, I didn't read enough documentation. I think
> > this is not a well-known feature.
> >
> > On 7/31/06, Bob Hiestand <[EMAIL PROTECTED]> wrote:
> >
> > > Question two:
> > >
> > > Is there a way to set the buffer name without the name being subject
> > > to shell metacharacter expansion? As far as I know, only :edit,
> > > :split, :new, :write, and :file allow setting the buffer name, and
> > > those all apply shell expansion. I know that characters can be
> > > escaped, but that involved knowledge of which characters are
> > > significant on each platform and again leads to unportable code (or
> > > highly complex code that attempts to be portable by taking each system
> > > into account). I would like a function to set the buffer name
> > > (potentially for a buffer specified by number) or for the '%' register
> > > to be writable.
> >
> > Yes, by using backtick notation along with the '=' expression prefix,
> > non-expansion is possible.
> >
> > For example,
> >
> > :e `=unescapedFileName`
>
> Does this really work fo you ? First, many characters
> are interpreted specially inside `=...`, Those are (,),+,- and all vim
> operators (see val.txt). Second, if I try your examlpe, I get:
>
> :e `=unescapedFileName`
> E121: Undefined variable: unescapedFIleName
> "`=unescapedFileName`" [New File]
> And then filename is set to
> `=unescapedFileName`
>
> Note how filename includes backticks and equal sign.
>
> Or did you possibly mean :e `='unescapedFileName'` ?
>
> Yakov
>
Sorry, to be clear, unescapedFileName is a variable.
Another way to do this appears to be using the 'bufnr' function with
the 'create' optional parameter set. I have not extensively tested
it, but it seems to be a useful alternative.