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:
    /[@-\]]

Problem: the range is '@' to '\', and ']' ends the collection; the next ']'
matches itself.

(It's surprising that '\]' within '[]' not always means ']' literally!)

Ok, so the char directly after '-' ends the range?
    /[@-]]

No, the collection is '[@-]' followed by ']' which matches itself.  The
help says it:
| For '-' you can also make it the first or last character: "[-xyz]",
| "[^-xyz]" or "[xyz-]".

Ok, this works:
    /[@-\\]]

but it matches the range '@-\' plus the char ']'.


A range where \] is the first character works:
    /[w\]-a]\C

matches  ] ^ _ ` a w


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

--
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