Am 03.01.2013 09:51, schrieb martinwguy:
On Tuesday, 28 June 2011 13:57:37 UTC+2, Andy Wokula  wrote:
Strange: one can't write a collection with range [X-Y] where Y is the
character ']'.

I thought the following should work, but it doesn't:
      /[@-\]]

Is it a bug that '\' after '-' in a collection is taken literally?

No, that's normal vi behaviour.

The context is Vim, not Vi:
    :set nocp cpo&vim

\ is not special in a character range (it stands for itself) and to
include ] you need to specify it as the first character in the range.

Even with set 'cp', `\]' is still special.  See:
    :h cpo-\

Do you actually use Vi?

In the example you give
    /[]@-\]
(knowing that \ is the character previous to ])
(my pattern `[@-\\]]' also made use of it)

So far, it looks like if Vim just forgot to implement a certain case.
There is no apparent reason why `\]' is allowed for X but not for Y in
a [X-Y] collection.

--
Andy

--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui