Bram,
I noticed, that searching in Vim for [] will match '[]' literally. This seems
to be a little bit unexpected, because I would either expect to match
everything because the collation [] contains nothing, or an error message,
since we are missing a closing ']' as grep or awk does (also nvi):
~$ grep '[]' ~/.vimrc
grep: Unmatched [ or [^
At the very least, this special behaviour needs to be documented, but I tend to
consider this behaviour as a bug.
BTW: POSIX says this about it:
,----
| The right-bracket ( ']' ) shall lose its special meaning and represent itself
| in a bracket expression if it occurs first in the list (after an initial
| circumflex ( '^' ), if any)
`----
This patch makes Vim report an error message:
diff --git a/src/regexp.c b/src/regexp.c
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -2283,6 +2283,9 @@
{
char_u *lp;
+ if (*regparse == ']')
+ EMSG_M_RET_NULL(_("E769: Missing ] after %s["),
+ reg_magic > MAGIC_OFF);
/*
* If there is no matching ']', we assume the '[' is a normal
* character. This makes 'incsearch' and ":help [" work.
regards,
Christian
--
Schnell einen Blitzableiter. Ich habe einen Gedankenblitz.
--
--
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
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.