On 02-May-2013 09:11 +0200, Christian Brabandt wrote:
> Hi Ingo!
>
> On Do, 02 Mai 2013, Ingo Karkat wrote:
>
>> #v+
>> autocmd CursorMovedI *
>> \ if exists('b:matchparen_no_insertmode') |
>> \ if b:matchparen_no_insertmode |
>> \ return |
>> \ endif
>> \ elseif exists('g:matchparen_no_insertmode') &&
>> g:matchparen_no_insertmode |
>> \ return |
>> \ endif |
>> \ ...
>> #v-
>
> Excuse me for chiming in, but I find this construct rather ugly and
> unreadable. How about this instead:
>
> #v+
> autocmd CursorMovedI *
> \ if get(b:, 'matchparen_no_insertmode', 0) ||
> \ get(g:, 'matchparen_no_insertmode', 0)
> \ return |
> \ endif |
> \ ...
> #v-
Hello Christian,
I appreciate your critique. I would move the conditionals into the
s:Highlight_Matching_Pair() function, too; I just wanted to show the
algorithm with the minimal amount of additional context.
Your rewrite doesn't correctly capture the fact that the buffer-local
value takes precedence over the global one; when b:... is 0 and g:... is
1, insert-mode matching should be ON, whereas your code would :return
early. Though it may not make that much sense here, I think the
precedence should be the same as with the built-in global-local options.
-- regards, ingo
--
--
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.