On Thu, Aug 10, 2006 at 11:38:25PM +0300, Yakov Lerner wrote:
> " XX \\         works, 2 args ('\\')

     Is that correct?

> " XX a b        works, 2 args ('a','b')
> " XX a\ b       works, 1 arg ('a b')
> " XX a\\b              1 arg ('a\\b')       Shall it be 1 arg('a\b') ?

     So I guess " XX a\b" gives 1 arg ('a\b') ?

> " XX a\\ b      bug:   1 arg('a\ b')         Expected 2 args('a\','b')
> " XX a\\  b     bug:   2 args ('a\ ','b').   Expected 2 args('a\','b')

     I agree with Matthew on this.  If '\\' will be used for '\' in some
situations, it is easier to remember if it always means that.  So if you
want 'a\b', use 'a\\b' and if you want 'a\\b', then use 'a\\\\b'.

$0.02                                   --Benji Fisher

P.S.  I cannot resist tweaking a vim function:

> command! -nargs=* XX :call Test(<f-args>)
> fun! Test(...)
>  echo "XX: ".a:0." args("

   echo "XX:" a:0 "args("

Both :echo and :execute (!) accept multiple arguments.

>  let i=1
>  let argc=a:0

Warning:  variable argc is defined but never referenced.

>  while i <= a:0
>      echon "'".a:{i}."'"
>      if i != a:0 | echon "," | endif

Instead of the above two lines, I prefer

       echon "'" . a:{i} . "'" . (i != a:0 ? "," : "")

>      let i = i + 1
>  endwhile
>  echon ")"
> endfun

Reply via email to