On 2009-09-23, Jürgen Krämer wrote:
> Hi,
>
> Gary Johnson 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.
>
> as a first reaction I wanted to give this explanation, too, but then
> I checked it and $VARIABLE was interpolated into the path option.
> (The reason that made me stop writing this was that
>
> :e $HOME/.vimrc
>
> works. If I am not mistaken environment variables are expanded in
> ex-commands, but Vim's variables (pre-defined or user-defined) are
> not. Thus
>
> :let variable = $VARIABLE
> :set path+=variable
>
> does not work.)
You're right:
set path+=$VARIABLE
does work (assuming the contents of $VARIABLE are properly escaped).
I should have tested that before instead of relying on what I
thought I knew about vim's evaluation. Thanks for the correction.
Regards,
Gary
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---