diff options
Diffstat (limited to 'bundle')
-rw-r--r-- | bundle/diff-corrections/autoload/diff_corrections.vim | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/bundle/diff-corrections/autoload/diff_corrections.vim b/bundle/diff-corrections/autoload/diff_corrections.vim index 620c1b0..c3003e9 100644 --- a/bundle/diff-corrections/autoload/diff_corrections.vim +++ b/bundle/diff-corrections/autoload/diff_corrections.vim @@ -1,4 +1,6 @@ let s:old_cursorline = &cursorline +let s:restore_cx_mapping = '' + function! diff_corrections#Run() if &diff @@ -7,12 +9,18 @@ function! diff_corrections#Run() endif set nocursorline + + nnoremap cx :<C-u>tabclose<CR> else if exists('g:colors_name') && g:colors_name ==# 'twilight256' execute 'highlight ' . s:old_highlight_comment endif let &cursorline = s:old_cursorline + + if strlen(s:restore_cx_mapping) > 0 + execute s:restore_cx_mapping + endif endif endfunction @@ -32,4 +40,22 @@ function! s:SaveCommentColor() endfunction +function! s:SaveMapping() + let mapping = maparg('cx', 'n', 0, 1) + + if !empty(mapping) + let s:restore_cx_mapping .= (mapping.noremap ? 'nnoremap' : 'nmap') . + \ join( + \ map( + \ ['buffer', 'expr', 'nowait', 'silent'], + \ 'mapping[v:val] ? "<" . v:val . ">" : ""' + \ ) + \ ) . + \ mapping.lhs . ' ' . + \ substitute(mapping.rhs, '<SID>', '<SNR>' . mapping.sid . '_', 'g') + endif +endfunction + + let s:old_highlight_comment = s:SaveCommentColor() +call s:SaveMapping() |