I want Vim defaults to be
- sane
- follow the principle of least surprise.
(I'd like nocompatible to be set by default, but that's another story)
Christian: :set cpo+=l still makes my test cases fail:
[1] echo len(matchstr("\n",'\zs[^\n]\ze'))
[2] echo len(matchstr("\n","\\zs[^\n]\\ze")
You explained it by \n not being chr(10), so what is it?
Let's try by understanding \n's behaviour:
==========================================
case 1) vim buf
To my undestanding $ matches end of line (in a vim buffer) without eating
that
end of line whereas \n does both: it matches and eats the end of line.
Eg try /..\n.. and :set hlsearch
Thus \n is the same as $\n when applying regex to vim buffers. dos 1310
usually
is encoded in a ff setting, so \n does what you want if you want it.
case 2) matchstr, matchall, substitute =~ and whatnot (?)
So if \n is not chr(10), what is it then in this case?
echo len(matchstr("\n",'\zs[^\n]\ze'))
clearly indicates it matches \n and and I agree on Erik which called it
this way
Sorry, [^\n] can never match \n ; not even in pink. That is broken
behaviour.
So from this point of view I'd say \n behavior is broken when regex get applied
to strings only (which your patch is supposed to fix - I'll test it
later)
Is there more to fix?
=====================
issue 1)
docs state:
[] (with 'nomagic': \[]) */[]* */\[]* */\_[]* */collection*
\_[]
Well - try /[] - it will not be treated as collection, it'll match [], because
its empty!! So there should be a comment that collections must contain at
least
one char to be seen as one.
issue 2)
With "\_" prepended the collection also includes the end-of-line - why does
it exist, because
[\n] is accepted and works as expected?
So can \_[] syntax be deprecated?
Marc Weber
--
--
You received this message from the "vim_use" 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_use" 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.