# HG changeset patch # User zegervdv # Date 1421171867 -3600 # Node ID 30eb5cded5213a7d77db8e493dc73636c6884cb9 # Parent ed108055146c5c21370877c85d672226732475ab Add parenthesis matching function diff -r ed108055146c -r 30eb5cded521 vimrc --- a/vimrc Tue Jan 13 18:49:19 2015 +0100 +++ b/vimrc Tue Jan 13 18:57:47 2015 +0100 @@ -296,8 +296,20 @@ redraw endfunction -" Highlight matching parenthesis in different color so I don't mess up -hi MatchParen cterm=underline ctermbg=none ctermfg=white gui=underline guibg=black guifg=white +" This is adapted from +" http://vim.wikia.com/wiki/Windo_and_restore_current_window +function! KeepWin(command) + let currwin=winnr() + execute a:command + execute currwin . 'wincmd w' +endfunction + +augroup insertMatch + au! + au VimEnter * NoMatchParen + au InsertEnter * call KeepWin("DoMatchParen") + au InsertLeave * call KeepWin("NoMatchParen") +augroup END " Highlight VCS conflict markers match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$'