Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Flush buffer on scrolling.

  • Loading branch information...
commit 0326b7c14a8acb7e4185df1f6033d87bab9ff152 1 parent 1dfe26a
Israel Chauca Fuentes authored July 20, 2012
6  autoload/delimitMate.vim
@@ -531,7 +531,11 @@ function! delimitMate#TestMappings() "{{{
531 531
 				\ b:_l_delimitMate_apostrophes_list +
532 532
 				\ ['<BS>', '<S-BS>', '<Del>', '<S-Tab>', '<Esc>'] +
533 533
 				\ ['<Up>', '<Down>', '<Left>', '<Right>', '<LeftMouse>', '<RightMouse>'] +
534  
-				\ ['<Home>', '<End>', '<PageUp>', '<PageDown>', '<S-Down>', '<S-Up>', '<C-G>g']
  534
+				\ ['<Home>', '<End>', '<PageUp>', '<PageDown>', '<S-Down>', '<S-Up>', '<C-G>g'] +
  535
+				\ ['<ScrollWheelUp>', '<S-ScrollWheelUp>', '<C-ScrollWheelUp>'] +
  536
+				\ ['<ScrollWheelDown>', '<S-ScrollWheelDown>', '<C-ScrollWheelDown>'] +
  537
+				\ ['<ScrollWheelLeft>', '<S-ScrollWheelLeft>', '<C-ScrollWheelLeft>'] +
  538
+				\ ['<ScrollWheelRight>', '<S-ScrollWheelRight>', '<C-ScrollWheelRight>']
535 539
 	let imaps = imaps + ( b:_l_delimitMate_expand_cr ?  ['<CR>'] : [] )
536 540
 	let imaps = imaps + ( b:_l_delimitMate_expand_space ?  ['<Space>'] : [] )
537 541
 
10  plugin/delimitMate.vim
@@ -367,6 +367,16 @@ function! s:ExtraMappings() "{{{
367 367
 			exec 'silent! imap <unique> <buffer> <'.map.'> <Plug>delimitMate'.map
368 368
 		endif
369 369
 	endfor
  370
+	" Flush the char buffer on scrolling:
  371
+	for map in ['ScrollWheelUp', 'S-ScrollWheelUp', 'C-ScrollWheelUp',
  372
+				\ 'ScrollWheelDown', 'S-ScrollWheelDown', 'C-ScrollWheelDown',
  373
+				\ 'ScrollWheelLeft', 'S-ScrollWheelLeft', 'C-ScrollWheelLeft',
  374
+				\ 'ScrollWheelRight', 'S-ScrollWheelRight', 'C-ScrollWheelRight']
  375
+		exec 'inoremap <silent> <Plug>delimitMate'.map.' <C-R>=<SID>Finish()<CR><'.map.'>'
  376
+		if !hasmapto('<Plug>delimitMate'.map, 'i') && maparg('<'.map.'>', 'i') == ''
  377
+			exec 'silent! imap <unique> <buffer> <'.map.'> <Plug>delimitMate'.map
  378
+		endif
  379
+	endfor
370 380
 	" Also for default MacVim movements:
371 381
 	if has('gui_macvim')
372 382
 		for [key, map] in [['D-Left','Home'], ['D-Right','End'], ['M-Left','C-Left'], ['M-Right','C-Right']]

0 notes on commit 0326b7c

Please sign in to comment.
Something went wrong with that request. Please try again.