mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-08 11:34:46 +08:00
moveNextPrev
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
"=============================================================================
|
"=============================================================================
|
||||||
" zencoding.vim
|
" zencoding.vim
|
||||||
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
||||||
" Last Change: 30-May-2012.
|
" Last Change: 31-May-2012.
|
||||||
|
|
||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
@@ -407,16 +407,14 @@ function! zencoding#expandAbbr(mode) range
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! zencoding#moveNextPrev(flag)
|
function! zencoding#moveNextPrev(flag)
|
||||||
if search('><\/\|\(""\)\|^\s*$', a:flag ? 'Wpb' : 'Wp') == 3
|
let type = zencoding#getFileType()
|
||||||
startinsert!
|
let rtype = len(globpath(&rtp, 'autoload/zencoding/lang/'.type.'.vim')) ? type : 'html'
|
||||||
else
|
return zencoding#lang#{rtype}#moveNextPrev(a:flag)
|
||||||
silent! normal! l
|
|
||||||
startinsert
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! zencoding#imageSize()
|
function! zencoding#imageSize()
|
||||||
let rtype = len(globpath(&rtp, 'autoload/zencoding/lang/'.&ft.'.vim')) ? &ft : 'html'
|
let type = zencoding#getFileType()
|
||||||
|
let rtype = len(globpath(&rtp, 'autoload/zencoding/lang/'.type.'.vim')) ? type : 'html'
|
||||||
return zencoding#lang#{rtype}#imageSize()
|
return zencoding#lang#{rtype}#imageSize()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -426,6 +424,12 @@ function! zencoding#toggleComment()
|
|||||||
return zencoding#lang#{rtype}#toggleComment()
|
return zencoding#lang#{rtype}#toggleComment()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! zencoding#balanceTag(flag) range
|
||||||
|
let type = zencoding#getFileType()
|
||||||
|
let rtype = len(globpath(&rtp, 'autoload/zencoding/lang/'.type.'.vim')) ? type : 'html'
|
||||||
|
return zencoding#lang#{rtype}#balanceTag(a:flag)
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! zencoding#splitJoinTag()
|
function! zencoding#splitJoinTag()
|
||||||
let curpos = getpos('.')
|
let curpos = getpos('.')
|
||||||
while 1
|
while 1
|
||||||
@@ -511,11 +515,6 @@ function! zencoding#removeTag()
|
|||||||
endwhile
|
endwhile
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! zencoding#balanceTag(flag) range
|
|
||||||
let rtype = len(globpath(&rtp, 'autoload/zencoding/lang/'.&ft.'.vim')) ? &ft : 'html'
|
|
||||||
return zencoding#lang#{rtype}#balanceTag(a:flag)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! zencoding#anchorizeURL(flag)
|
function! zencoding#anchorizeURL(flag)
|
||||||
let mx = 'https\=:\/\/[-!#$%&*+,./:;=?@0-9a-zA-Z_~]\+'
|
let mx = 'https\=:\/\/[-!#$%&*+,./:;=?@0-9a-zA-Z_~]\+'
|
||||||
let pos1 = searchpos(mx, 'bcnW')
|
let pos1 = searchpos(mx, 'bcnW')
|
||||||
|
|||||||
@@ -131,3 +131,13 @@ function! zencoding#lang#css#balanceTag(flag) range
|
|||||||
call setpos('.', curpos)
|
call setpos('.', curpos)
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! zencoding#lang#css#moveNextPrev(flag)
|
||||||
|
let pos = search('""\|()\|\(:\s*\zs$\)', a:flag ? 'Wbp' : 'Wp')
|
||||||
|
if pos == 2
|
||||||
|
startinsert!
|
||||||
|
else
|
||||||
|
silent! normal! l
|
||||||
|
startinsert
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|||||||
@@ -125,4 +125,40 @@ function! zencoding#lang#haml#toggleComment()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! zencoding#lang#haml#balanceTag(flag) range
|
function! zencoding#lang#haml#balanceTag(flag) range
|
||||||
|
if a:flag == -2 || a:flag == 2
|
||||||
|
let curpos = [0, line("'<"), col("'<"), 0]
|
||||||
|
else
|
||||||
|
let curpos = getpos('.')
|
||||||
|
endif
|
||||||
|
let n = curpos[1]
|
||||||
|
let ml = len(matchstr(getline(n), '^\s*'))
|
||||||
|
|
||||||
|
while n > 0
|
||||||
|
let l = len(matchstr(getline(n), '^\s*\ze%[a-z]'))
|
||||||
|
if l > 0 && l < ml
|
||||||
|
let ml = l
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
let n -= 1
|
||||||
|
endwhile
|
||||||
|
let sn = n
|
||||||
|
while n < line('$')
|
||||||
|
let l = len(matchstr(getline(n), '^\s*%[a-z]'))
|
||||||
|
if l > 0 && l <= ml
|
||||||
|
let n -= 1
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
let n += 1
|
||||||
|
endwhile
|
||||||
|
call setpos('.', [0, sn, 1, 0])
|
||||||
|
normal! V
|
||||||
|
call setpos('.', [0, n, 1, 0])
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! zencoding#lang#haml#moveNextPrev(flag)
|
||||||
|
let pos = search('""', a:flag ? 'Wb' : 'W')
|
||||||
|
if pos != 0
|
||||||
|
silent! normal! l
|
||||||
|
startinsert
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -573,3 +573,13 @@ function! zencoding#lang#html#balanceTag(flag) range
|
|||||||
call setpos('.', curpos)
|
call setpos('.', curpos)
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! zencoding#lang#html#moveNextPrev(flag)
|
||||||
|
let pos = search('><\/\|\(""\)\|^\s*$', a:flag ? 'Wpb' : 'Wp')
|
||||||
|
if pos == 3
|
||||||
|
startinsert!
|
||||||
|
elseif pos != 0
|
||||||
|
silent! normal! l
|
||||||
|
startinsert
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ function! zencoding#lang#slim#toString(settings, current, type, inline, filters,
|
|||||||
let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
|
let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
|
||||||
endwhile
|
endwhile
|
||||||
let attr = substitute(attr, '\$$', itemno+1, '')
|
let attr = substitute(attr, '\$$', itemno+1, '')
|
||||||
if val =~ '\s'
|
let sval = substitute(val, '\${cursor}', '', '')
|
||||||
|
if sval =~ '\s' || sval == ''
|
||||||
let str .= ' ' . attr . '="' . val . '"'
|
let str .= ' ' . attr . '="' . val . '"'
|
||||||
else
|
else
|
||||||
let str .= ' ' . attr . '=' . val
|
let str .= ' ' . attr . '=' . val
|
||||||
@@ -116,3 +117,13 @@ endfunction
|
|||||||
|
|
||||||
function! zencoding#lang#slim#balanceTag(flag) range
|
function! zencoding#lang#slim#balanceTag(flag) range
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! zencoding#lang#slim#moveNextPrev(flag)
|
||||||
|
let pos = search('""\|\(^\s*|\s*\zs\)', a:flag ? 'Wpb' : 'Wp')
|
||||||
|
if pos == 2
|
||||||
|
startinsert!
|
||||||
|
elseif pos != 0
|
||||||
|
silent! normal! l
|
||||||
|
startinsert
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|||||||
Reference in New Issue
Block a user