On Mo, 22 Okt 2012, Andy Wokula wrote:

> Am 22.10.2012 09:55 und 09:59, schrieb Axel Bender:
> >Is there any possibility to make dib (or dab for that matter) ignore
> >escaped backslashes, e.g.
> >
> >Current behavior:
> >"( \(a[cursor_here]bc) )" -> dib -> "() )"
> >
> >Desired behavior:
> >"( \(a[cursor_here]bc) )" -> dib -> "( () )"
> 
> >Addendum: I'm not looking for a macro/function but for a setting.
> 
>     :h cpo-M
> ,----
> | M   When excluded, "%" matching will take backslashes into
> |     account.  Thus in "( \( )" and "\( ( \)" the outer
> |     parenthesis match.  When included "%" ignores
> |     backslashes, which is Vi compatible.
> `----
>     (excluded per default)
> 
>     :set cpo+=M
> 
> What happens:
> '( \(a[cursor_here]bc) )' -> dib -> '()'
> 
> So the `M'-flag also influences `ib' ... in some way.
> Looks buggy, because backslashes are still not ignored.

Andy, Axel, Is this what you expect?
:set cpo+=M

'( \(a[cursor_here]bc) )' -> dib -> '( \() )'

Here is a simple but ugly fix:

diff --git a/src/search.c b/src/search.c
--- a/src/search.c
+++ b/src/search.c
@@ -3637,7 +3637,10 @@
      * Ignore quotes here.
      */
     save_cpo = p_cpo;
-    p_cpo = (char_u *)"%";
+    if (vim_strchr(p_cpo, CPO_MATCHBSL) != NULL)
+       p_cpo = (char_u *)"%M";
+    else
+       p_cpo = (char_u *)"%";
     while (count-- > 0)
     {  
        if ((pos = findmatch(NULL, what)) == NULL)


It will however always consider parenthesis in quotes, since '%' is 
always included in 'cpo'

Be sure, to disable the matchit plugin, since it doesn't take the 'cpo' 
settings into account.

See :h cpo-%

regards,
Christian

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

Reply via email to