diff --git a/zencoding.vim b/zencoding.vim index 212c87c..a744218 100644 --- a/zencoding.vim +++ b/zencoding.vim @@ -77,14 +77,18 @@ endif inoremap ZenCodingExpandAbbr u:call zen_expand(0)a inoremap ZenCodingExpandWord u:call zen_expand(1)a vnoremap ZenCodingExpandVisual :call zen_expand(2) +inoremap ZenCodingNext :call zen_nextprev(0) +inoremap ZenCodingPrev :call zen_nextprev(1) let s:target = expand(':h') =~ '[\\/]plugin$' ? '' : '' + if !exists('g:user_zen_expandword_key') let g:user_zen_expandword_key = '.' endif if !hasmapto(g:user_zen_expandword_key, 'i') exe "imap " . s:target . " " . g:user_zen_expandword_key . " ZenCodingExpandWord" endif + if !exists('g:user_zen_expandabbr_key') let g:user_zen_expandabbr_key = ',' endif @@ -95,6 +99,19 @@ if !hasmapto(g:user_zen_expandabbr_key, 'v') exe "vmap " . s:target . " " . g:user_zen_expandabbr_key . " ZenCodingExpandVisual" endif +if !exists('g:user_zen_next_key') + let g:user_zen_next_key = 'n' +endif +if !hasmapto(g:user_zen_next_key, 'i') + exe "imap " . s:target . " " . g:user_zen_next_key . " ZenCodingNext" +endif +if !exists('g:user_zen_prev_key') + let g:user_zen_prev_key = 'N' +endif +if !hasmapto(g:user_zen_prev_key, 'i') + exe "imap " . s:target . " " . g:user_zen_prev_key . " ZenCodingPrev" +endif + if exists('s:zen_settings') && g:zencoding_debug == 0 finish endif @@ -1171,6 +1188,15 @@ function! s:zen_expand(mode) range endif endfunction +function! s:zen_nextprev(flag) + if search('><\/\|\(""\)\|^\s*$', a:flag ? 'Wpb' : 'Wp') == 3 + startinsert! + else + silent! normal! l + startinsert + endif +endfunction + function! ZenExpand(abbr, type, orig) let items = s:zen_parseIntoTree(a:abbr, a:type).child let expand = ''