Ответ на сообщение «Re: use the variable», 
присланное в 20:12:30 13 августа 2010, Пятница,
отправитель Gary Johnson:

>     exe "source " . yyy . "\aaa.vim"
Here you must replace yyy with fnameescape(yyy), see :h fnameescape().

Текст сообщения:
> On 2010-08-13, eliweiq001 wrote:
> > suppose I have such sentences in vimrc:
> > 
> > source .\mydir\aaa.vim
> > set xxxdir=.\mydir
> > 
> > 
> > 
> > and if now I add a new a variable
> > 
> > let yyy = ".\mydir"
> > 
> > 
> > Now can I use the variable yyy instead of .\mydir in the sentences
> > above ? How ?
> 
> The command to help you do this is :execute, which can be
> abbreviated to :exe.  See
> 
>     :help :execute
> 
> For example, your two commands above could be written as
> 
>     exe "source " . yyy . "\aaa.vim"
>     exe "set xxxdir=" . yyy
> 
> Since the backslash (\) is also used to escape or quote the
> character following, you may have to use \\ instead of just \ or
> enclose the string containing \ in single-quotes (') instead of
> double-quotes (").  (I didn't test the first command to see.)  It is
> often safest to use forward slashes (/) instead of backslashes to
> separate directories in a path, even when using Vim on Windows.  Vim
> knows how to translate them to backslashes before giving the string
> to a Windows command and you avoid the quoting issues.
> 
> An alternative way to set Vim options is to use :let instead of
> 
> :set, as described here:
>     :help :let-&
> 
> Your second command could then be written as
> 
>     let &xxxdir = yyy
> 
> Regards,
> Gary

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to