mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-06 10:44:24 +08:00
Expand paren when type is css
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
function! emmet#lang#css#findTokens(str)
|
||||
return substitute(a:str, '^.*[;{]\s*', '', '')
|
||||
return substitute(substitute(a:str, '^.*[;{]\s*', '', ''), '}\s*$', '', '')
|
||||
endfunction
|
||||
|
||||
function! emmet#lang#css#parseIntoTree(abbr, type)
|
||||
@@ -19,7 +19,7 @@ function! emmet#lang#css#parseIntoTree(abbr, type)
|
||||
" emmet
|
||||
let tokens = split(abbr, '+\ze[^+)!]')
|
||||
let block = emmet#util#searchRegion("{", "}")
|
||||
if block[0] == [0,0] && block[1] == [0,0]
|
||||
if type == 'css' && block[0] == [0,0] && block[1] == [0,0]
|
||||
let current = emmet#newNode()
|
||||
let current.snippet = abbr . " {\n\t${cursor}\n}"
|
||||
let current.name = ''
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
function! emmet#lang#sass#findTokens(str)
|
||||
return emmet#lang#html#findTokens(a:str)
|
||||
"let g:hoge = substitute(a:str, '^.*[;{@]\s*', '', '')
|
||||
"return substitute(a:str, '^.*[;{@]\s*', '', '')
|
||||
return a:str
|
||||
endfunction
|
||||
|
||||
function! emmet#lang#sass#parseIntoTree(abbr, type)
|
||||
|
||||
@@ -109,7 +109,7 @@ endfunction
|
||||
function! emmet#util#searchRegion(start, end)
|
||||
let b = searchpairpos(a:start, '', a:end, 'bcnW')
|
||||
if b == [0, 0]
|
||||
return [searchpairpos(a:start, '', a:end, 'bnW'), searchpairpos(a:start, '\%#', a:end, 'ncW')]
|
||||
return [searchpairpos(a:start, '', a:end, 'bnW'), searchpairpos(a:start, '\%#', a:end, 'nW')]
|
||||
else
|
||||
return [b, searchpairpos(a:start, '', a:end. '', 'nW')]
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user