On Wed, Sep 23, 2009 at 11:00 PM, Gary Johnson <[email protected]> wrote:

>
> On 2009-09-23, Jürgen Krämer wrote:
>
> > Steven Woody wrote:
>
> >   :let &path = &path . ',' . substitute($VARIABLE, ' ', '\\ ', 'g')
> >
> > > This works!! Thanks.  But I've not quite understand :
> > > 1. why use let instead of 'set'? what's the difference?
> >
> > Because the spaces in $VARIABLE need to be escaped. This is not
> > automatically done with
> >
> >   set path+=$VARIABLE
>
> Not only that, but set won't accept an expression on the right.
> That's often the reason for using let instead of set.  You could use
> exe to evaluate the set command with the expression, like this,
>
>    exe 'set path+=' . $VARIABLE
>
> but that doesn't seem to me as clean as
>
>    let &path .= ',' . $VARIABLE
>
> even considering the need to explicitly append the comma.
>
> I just noticed another difference between set and let in the above
> example.  If 'path' already includes "somepath",
>
>    set path+=somepath
>
> will not add a second instance of "somepath" to 'path' whereas
>
>    let &path .= ",somepath"
>
> will.
>
> Regards,
> Gary
>
>
Many thanks for the explain!

-- 
Life is the only flaw in an otherwise perfect nonexistence
   -- Schopenhauer

narke
public key at http://subkeys.pgp.net:11371 ([email protected])

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to