forked from VimPlug/emmet-vim
text comment block.
This commit is contained in:
@@ -1276,6 +1276,21 @@ endfunction
|
|||||||
|
|
||||||
function! s:zen_toggleComment()
|
function! s:zen_toggleComment()
|
||||||
let pos = getpos('.')
|
let pos = getpos('.')
|
||||||
|
let sp1 = searchpos('<', 'bnW')
|
||||||
|
let sp2 = searchpos('>', 'bnW')
|
||||||
|
if sp1[0]<sp2[0] || (sp1[0] == sp2[0] && sp1[1]<sp2[1])
|
||||||
|
if searchpair('<!-- ', '', ' -->', 'bcW')
|
||||||
|
exe "normal! d5l"
|
||||||
|
call search(' -->', 'ceW')
|
||||||
|
exe "normal! d4h"
|
||||||
|
let pos[2] -= 5
|
||||||
|
elseif searchpair('[^\s]', '', '[^\s]', 'bcW')
|
||||||
|
exe "normal! Bi<!--"
|
||||||
|
call search('\(\s\|$\)', 'eW')
|
||||||
|
exe "normal! a--\<c-v>>"
|
||||||
|
let pos[2] += 4
|
||||||
|
endif
|
||||||
|
else
|
||||||
call search('<', 'bW')
|
call search('<', 'bW')
|
||||||
if searchpair('<!-- <[a-z]', '', ' -->', 'bcW')
|
if searchpair('<!-- <[a-z]', '', ' -->', 'bcW')
|
||||||
exe "normal! d5l"
|
exe "normal! d5l"
|
||||||
@@ -1284,10 +1299,11 @@ function! s:zen_toggleComment()
|
|||||||
let pos[2] -= 5
|
let pos[2] -= 5
|
||||||
elseif searchpair('<[a-z]', '', '\(</[^>]\+>\|<[^/>]\+/>\)', 'bcW')
|
elseif searchpair('<[a-z]', '', '\(</[^>]\+>\|<[^/>]\+/>\)', 'bcW')
|
||||||
exe "normal! i<!-- "
|
exe "normal! i<!-- "
|
||||||
let rpos = search('\(<\/[^>]\+>\|[^\/>]*\/>\)', 'ceW')
|
call search('\(<\/[^>]\+>\|[^\/>]*\/>\)', 'ceW')
|
||||||
exe "normal! a --\<c-v>>"
|
exe "normal! a --\<c-v>>"
|
||||||
let pos[2] += 5
|
let pos[2] += 5
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
call setpos('.', pos)
|
call setpos('.', pos)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user