Bram, the matchparen plugin uses the :windo command for the :DoMatchParen and :NoMatchParen commands
However, after running those commands, it does not restore the cursor into the original window, which might cause troubles later on for plugins not expacting that the windo might change. For example the LargeFile plugin uses this command to switch off matchparen plugin. This has just caused this issue for me with vim-fugitive: https://github.com/tpope/vim-fugitive/pull/946 Here is a patch to fix this issue: The patch also adds a `:noa` command modifier when running through the windows, because I believe it is not necessary to trigger autocommands when entering each window, since we will be moving away anyhow. Second, it uses `:sil` command modifier for the :DoMatchParen command, so that no message `no matching autocommand` is shown. diff --git a/runtime/plugin/matchparen.vim b/runtime/plugin/matchparen.vim index 29e33e996..b8cbde09d 100644 --- a/runtime/plugin/matchparen.vim +++ b/runtime/plugin/matchparen.vim @@ -196,9 +196,10 @@ function! s:Highlight_Matching_Pair() endfunction " Define commands that will disable and enable the plugin. -command! NoMatchParen windo silent! call matchdelete(3) | unlet! g:loaded_matchparen | - \ au! matchparen -command! DoMatchParen runtime plugin/matchparen.vim | windo doau CursorMoved +command! NoMatchParen let w=winnr() | exe "noa windo silent! call matchdelete(3)" | + \ unlet! g:loaded_matchparen | exe "noa ". w. "wincmd w" | au! matchparen +command! DoMatchParen runtime plugin/matchparen.vim | let w=winnr() | + \ exe "noa sil windo doau CursorMoved" | exe "noa ". w. "wincmd w" let &cpo = s:cpo_save unlet s:cpo_save Christian -- Die besten Köpfe gibt es nicht in der Regierung. Die Wirtschaft holt sie weg. -- Ronald Reagan -- -- 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/d/optout.
