On Thu, Aug 30, 2012 at 08:18:22AM -0700, Ben Fritz wrote:
> Something is wrong here. When I try :set directory+=$VAR, I see the following 
> behavior:
> 
> 1. When $VAR exists, its value is inserted at the end after a new comma.
> 2. When $VAR doesn't exist, a literal ",$VAR" is inserted at the end.

This is expected (and documented at :help :set_env), but I've always
found this counter-intuitive.  That's not how shells work, which is
where people have the most exposure to using enivronment variables.

IMO, If the var doesn't exist, then it should either expand to nothing
or error.  The $ should be escaped if the intention is to use the
literal string.

> 3. When $VAR exists but is empty, same as (2).

Although this isn't described in the help, that's an explicit choice
made in the code and again is counter-intuitive.

Cheers,
-- 
James
GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <[email protected]>

Attachment: signature.asc
Description: Digital signature

Raspunde prin e-mail lui