mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-07 03:04:27 +08:00
WIP: implement selection
This commit is contained in:
@@ -438,6 +438,8 @@ function! emmet#expandCursorExpr(expand, mode)
|
|||||||
endif
|
endif
|
||||||
let expand = substitute(expand, '\${cursor}', '$cursor$', '')
|
let expand = substitute(expand, '\${cursor}', '$cursor$', '')
|
||||||
let expand = substitute(expand, '\${cursor}', '', 'g')
|
let expand = substitute(expand, '\${cursor}', '', 'g')
|
||||||
|
let expand = substitute(expand, '\${\d\+:\([^}]\+\)}', '$select$\1$select$', '')
|
||||||
|
let expand = substitute(expand, '\${cursor}', '', 'g')
|
||||||
return expand
|
return expand
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -659,20 +661,29 @@ function! emmet#expandAbbr(mode, abbr) range
|
|||||||
if g:emmet_debug > 1
|
if g:emmet_debug > 1
|
||||||
call getchar()
|
call getchar()
|
||||||
endif
|
endif
|
||||||
if search('\ze\$cursor\$')
|
if search('\ze\$\(cursor\|select\)\$')
|
||||||
let oldselection = &selection
|
let oldselection = &selection
|
||||||
let &selection = 'inclusive'
|
let &selection = 'inclusive'
|
||||||
if foldclosed(line('.')) != -1
|
if foldclosed(line('.')) != -1
|
||||||
silent! foldopen
|
silent! foldopen
|
||||||
endif
|
endif
|
||||||
let pos = emmet#util#getcurpos()
|
let pos = emmet#util#getcurpos()
|
||||||
silent! s/\$cursor\$//
|
if getline('.')[col('.')-1:] =~ '^\$select'
|
||||||
|
let pos[2] += 1
|
||||||
|
silent! s/\$select\$//
|
||||||
|
let next = searchpos('.\ze\$select\$', 'nW')
|
||||||
|
silent! s/\$\(cursor\|select\)\$//g
|
||||||
|
call emmet#util#selectRegion([pos[1:2], next])
|
||||||
|
return "\<esc>gv"
|
||||||
|
else
|
||||||
|
silent! s/\$\(cursor\|select\)\$//g
|
||||||
silent! call setpos('.', pos)
|
silent! call setpos('.', pos)
|
||||||
let &selection = oldselection
|
|
||||||
if col('.') < col('$')
|
if col('.') < col('$')
|
||||||
return "\<right>"
|
return "\<right>"
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
let &selection = oldselection
|
||||||
|
endif
|
||||||
return ''
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -1150,7 +1161,7 @@ let s:emmet_settings = {
|
|||||||
\ 'bg+': 'background:#FFF url(|) 0 0 no-repeat;',
|
\ 'bg+': 'background:#FFF url(|) 0 0 no-repeat;',
|
||||||
\ 'bg:n': 'background:none;',
|
\ 'bg:n': 'background:none;',
|
||||||
\ 'bg:ie': 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=''|x.png'');',
|
\ 'bg:ie': 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=''|x.png'');',
|
||||||
\ 'bgc': 'background-color:#FFF;',
|
\ 'bgc': 'background-color:${1:#FFF};',
|
||||||
\ 'bgi': 'background-image:url(|);',
|
\ 'bgi': 'background-image:url(|);',
|
||||||
\ 'bgi:n': 'background-image:none;',
|
\ 'bgi:n': 'background-image:none;',
|
||||||
\ 'bgr': 'background-repeat:|;',
|
\ 'bgr': 'background-repeat:|;',
|
||||||
|
|||||||
Reference in New Issue
Block a user