From 873e79ec37432bdb1c2cfc302d3a5d906cab01d5 Mon Sep 17 00:00:00 2001 From: Israel Chauca Fuentes Date: Wed, 8 Dec 2010 03:34:45 -0600 Subject: [PATCH] Allow jumping over contiguous delimiters. Closes #44. --- autoload/delimitMate.vim | 28 +++++++++++++++++++++++++++- plugin/delimitMate.vim | 6 +++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/autoload/delimitMate.vim b/autoload/delimitMate.vim index bc5af92..745c4a3 100644 --- a/autoload/delimitMate.vim +++ b/autoload/delimitMate.vim @@ -346,6 +346,32 @@ function! delimitMate#JumpAny(key) " {{{ endif endfunction " delimitMate#JumpAny() }}} +function! delimitMate#JumpMany() " {{{ + let line = getline('.')[col('.') - 1 : ] + let len = len(line) + let rights = "" + let found = 0 + let i = 0 + while i < len + let char = line[i] + if index(b:_l_delimitMate_quotes_list, char) >= 0 || + \ index(b:_l_delimitMate_right_delims, char) >= 0 + let rights .= "\" + let found = 1 + elseif found == 0 + let rights .= "\" + else + break + endif + let i += 1 + endwhile + if found == 1 + return rights + else + return '' + endif +endfunction " delimitMate#JumpMany() }}} + function! delimitMate#MapMsg(msg) "{{{ redraw echomsg a:msg @@ -461,7 +487,7 @@ function! delimitMate#TestMappings() "{{{ \ b:_l_delimitMate_apostrophes_list + \ ['', '', '', '', ''] + \ ['', '', '', '', '', ''] + - \ ['', '', '', '', '', ''] + \ ['', '', '', '', '', '', 'g'] let imaps = imaps + ( b:_l_delimitMate_expand_cr ? [''] : [] ) let imaps = imaps + ( b:_l_delimitMate_expand_space ? [''] : [] ) diff --git a/plugin/delimitMate.vim b/plugin/delimitMate.vim index 96b7bbb..9e47405 100644 --- a/plugin/delimitMate.vim +++ b/plugin/delimitMate.vim @@ -171,7 +171,7 @@ function! s:Unmap() " {{{ \ b:_l_delimitMate_apostrophes_list + \ ['', '', '', '', '', '', ''] + \ ['', '', '', '', '', ''] + - \ ['', '', '', '', '', ''] + \ ['', '', '', '', '', '', 'g'] for map in imaps if maparg(map, "i") =~? 'delimitMate' @@ -353,6 +353,10 @@ function! s:ExtraMappings() "{{{ endif endfor + " Jump over next delimiters + inoremap delimitMateJumpMany =len(b:_l_delimitMate_buffer) ? delimitMate#Finish(0) : delimitMate#JumpMany() + imap g delimitMateJumpMany + " Map away! if !hasmapto('delimitMateDel', 'i') silent! imap delimitMateDel