Permalink
Browse files

Flush buffer on scrolling.

  • Loading branch information...
1 parent 1dfe26a commit 0326b7c14a8acb7e4185df1f6033d87bab9ff152 @Raimondi committed Jul 20, 2012
Showing with 15 additions and 1 deletion.
  1. +5 −1 autoload/delimitMate.vim
  2. +10 −0 plugin/delimitMate.vim
View
@@ -531,7 +531,11 @@ function! delimitMate#TestMappings() "{{{
\ b:_l_delimitMate_apostrophes_list +
\ ['<BS>', '<S-BS>', '<Del>', '<S-Tab>', '<Esc>'] +
\ ['<Up>', '<Down>', '<Left>', '<Right>', '<LeftMouse>', '<RightMouse>'] +
- \ ['<Home>', '<End>', '<PageUp>', '<PageDown>', '<S-Down>', '<S-Up>', '<C-G>g']
+ \ ['<Home>', '<End>', '<PageUp>', '<PageDown>', '<S-Down>', '<S-Up>', '<C-G>g'] +
+ \ ['<ScrollWheelUp>', '<S-ScrollWheelUp>', '<C-ScrollWheelUp>'] +
+ \ ['<ScrollWheelDown>', '<S-ScrollWheelDown>', '<C-ScrollWheelDown>'] +
+ \ ['<ScrollWheelLeft>', '<S-ScrollWheelLeft>', '<C-ScrollWheelLeft>'] +
+ \ ['<ScrollWheelRight>', '<S-ScrollWheelRight>', '<C-ScrollWheelRight>']
let imaps = imaps + ( b:_l_delimitMate_expand_cr ? ['<CR>'] : [] )
let imaps = imaps + ( b:_l_delimitMate_expand_space ? ['<Space>'] : [] )
View
@@ -367,6 +367,16 @@ function! s:ExtraMappings() "{{{
exec 'silent! imap <unique> <buffer> <'.map.'> <Plug>delimitMate'.map
endif
endfor
+ " Flush the char buffer on scrolling:
+ for map in ['ScrollWheelUp', 'S-ScrollWheelUp', 'C-ScrollWheelUp',
+ \ 'ScrollWheelDown', 'S-ScrollWheelDown', 'C-ScrollWheelDown',
+ \ 'ScrollWheelLeft', 'S-ScrollWheelLeft', 'C-ScrollWheelLeft',
+ \ 'ScrollWheelRight', 'S-ScrollWheelRight', 'C-ScrollWheelRight']
+ exec 'inoremap <silent> <Plug>delimitMate'.map.' <C-R>=<SID>Finish()<CR><'.map.'>'
+ if !hasmapto('<Plug>delimitMate'.map, 'i') && maparg('<'.map.'>', 'i') == ''
+ exec 'silent! imap <unique> <buffer> <'.map.'> <Plug>delimitMate'.map
+ endif
+ endfor
" Also for default MacVim movements:
if has('gui_macvim')
for [key, map] in [['D-Left','Home'], ['D-Right','End'], ['M-Left','C-Left'], ['M-Right','C-Right']]

0 comments on commit 0326b7c

Please sign in to comment.