forked from VimPlug/emmet-vim
Fixes against errors/warnings in vint
This commit is contained in:
@@ -12,7 +12,7 @@ let s:mx = '\([+>]\|[<^]\+\)\{-}\s*'
|
||||
\ .'\%(\(@-\{0,1}[0-9]*\)\{0,1}\*\([0-9]\+\)\)\{0,1}'
|
||||
\ .'\(\%()\%(\(@-\{0,1}[0-9]*\)\{0,1}\*[0-9]\+\)\{0,1}\)*\)'
|
||||
|
||||
function! emmet#lang#html#findTokens(str)
|
||||
function! emmet#lang#html#findTokens(str) abort
|
||||
let str = a:str
|
||||
let [pos, last_pos] = [0, 0]
|
||||
while 1
|
||||
@@ -25,23 +25,23 @@ function! emmet#lang#html#findTokens(str)
|
||||
let last_pos = pos
|
||||
while len(str) > 0
|
||||
let token = matchstr(str, s:mx, pos)
|
||||
if token == ''
|
||||
if token ==# ''
|
||||
break
|
||||
endif
|
||||
if token =~ '^\s'
|
||||
if token =~# '^\s'
|
||||
let token = matchstr(token, '^\s*\zs.*')
|
||||
let last_pos = stridx(str, token, pos)
|
||||
endif
|
||||
let pos = stridx(str, token, pos) + len(token)
|
||||
endwhile
|
||||
let str = a:str[last_pos :-1]
|
||||
if str =~ '^\w\+="[^"]*$'
|
||||
if str =~# '^\w\+="[^"]*$'
|
||||
return ''
|
||||
endif
|
||||
return str
|
||||
endfunction
|
||||
|
||||
function! emmet#lang#html#parseIntoTree(abbr, type)
|
||||
function! emmet#lang#html#parseIntoTree(abbr, type) abort
|
||||
let abbr = a:abbr
|
||||
let type = a:type
|
||||
|
||||
@@ -82,23 +82,23 @@ function! emmet#lang#html#parseIntoTree(abbr, type)
|
||||
if len(str) == 0
|
||||
break
|
||||
endif
|
||||
if tag_name =~ '^#'
|
||||
if tag_name =~# '^#'
|
||||
let attributes = tag_name . attributes
|
||||
let tag_name = 'div'
|
||||
endif
|
||||
if tag_name =~ '[^!]!$'
|
||||
if tag_name =~# '[^!]!$'
|
||||
let tag_name = tag_name[:-2]
|
||||
let important = 1
|
||||
endif
|
||||
if tag_name =~ '^\.'
|
||||
if tag_name =~# '^\.'
|
||||
let attributes = tag_name . attributes
|
||||
let tag_name = 'div'
|
||||
endif
|
||||
if tag_name =~ '^\[.*\]$'
|
||||
if tag_name =~# '^\[.*\]$'
|
||||
let attributes = tag_name . attributes
|
||||
let tag_name = 'div'
|
||||
endif
|
||||
let basedirect = basevalue[1] == '-' ? -1 : 1
|
||||
let basedirect = basevalue[1] ==# '-' ? -1 : 1
|
||||
let basevalue = 0 + abs(basevalue[1:])
|
||||
if multiplier <= 0 | let multiplier = 1 | endif
|
||||
|
||||
@@ -140,7 +140,7 @@ function! emmet#lang#html#parseIntoTree(abbr, type)
|
||||
let custom_expands = settings['custom_expands']
|
||||
endif
|
||||
for k in keys(custom_expands)
|
||||
if tag_name =~ k
|
||||
if tag_name =~# k
|
||||
let current.snippet = '${' . tag_name . '}'
|
||||
let current.name = ''
|
||||
break
|
||||
@@ -192,20 +192,20 @@ function! emmet#lang#html#parseIntoTree(abbr, type)
|
||||
while len(attr)
|
||||
let item = matchstr(attr, '\(\%(\%(#[{}a-zA-Z0-9_\-\$]\+\)\|\%(\[\%("[^"]*"\|[^"\]]*\)\+\]\)\|\%(\.[{}a-zA-Z0-9_\-\$]\+\)*\)\)')
|
||||
if g:emmet_debug > 1
|
||||
echomsg "attr=" . item
|
||||
echomsg 'attr=' . item
|
||||
endif
|
||||
if len(item) == 0
|
||||
break
|
||||
endif
|
||||
if item[0] == '#'
|
||||
if item[0] ==# '#'
|
||||
let current.attr.id = item[1:]
|
||||
endif
|
||||
if item[0] == '.'
|
||||
if item[0] ==# '.'
|
||||
let current.attr.class = substitute(item[1:], '\.', ' ', 'g')
|
||||
endif
|
||||
if item[0] == '['
|
||||
if item[0] ==# '['
|
||||
let atts = item[1:-2]
|
||||
if matchstr(atts, '^\s*\zs[0-9a-zA-Z-:]\+\(="[^"]*"\|=''[^'']*''\|=[^ ''"]\+\)') == ''
|
||||
if matchstr(atts, '^\s*\zs[0-9a-zA-Z-:]\+\(="[^"]*"\|=''[^'']*''\|=[^ ''"]\+\)') ==# ''
|
||||
let ks = []
|
||||
if has_key(default_attributes, current.name)
|
||||
let dfa = default_attributes[current.name]
|
||||
@@ -217,7 +217,7 @@ function! emmet#lang#html#parseIntoTree(abbr, type)
|
||||
if len(ks) > 0
|
||||
let current.attr[ks[0]] = atts
|
||||
else
|
||||
let current.attr[atts] = ""
|
||||
let current.attr[atts] = ''
|
||||
endif
|
||||
else
|
||||
while len(atts)
|
||||
@@ -227,11 +227,11 @@ function! emmet#lang#html#parseIntoTree(abbr, type)
|
||||
endif
|
||||
let key = split(amat, '=')[0]
|
||||
let Val = amat[len(key)+1:]
|
||||
if key =~ '\.$' && Val == ''
|
||||
if key =~# '\.$' && Val ==# ''
|
||||
let key = key[:-2]
|
||||
unlet Val
|
||||
let Val = function('emmet#types#true')
|
||||
elseif Val =~ '^["'']'
|
||||
elseif Val =~# '^["'']'
|
||||
let Val = Val[1:-2]
|
||||
endif
|
||||
let current.attr[key] = Val
|
||||
@@ -248,7 +248,7 @@ function! emmet#lang#html#parseIntoTree(abbr, type)
|
||||
endif
|
||||
|
||||
" parse text
|
||||
if tag_name =~ '^{.*}$'
|
||||
if tag_name =~# '^{.*}$'
|
||||
let current.name = ''
|
||||
let current.value = tag_name
|
||||
else
|
||||
@@ -260,7 +260,7 @@ function! emmet#lang#html#parseIntoTree(abbr, type)
|
||||
|
||||
" parse step inside/outside
|
||||
if !empty(last)
|
||||
if operator =~ '>'
|
||||
if operator =~# '>'
|
||||
unlet! parent
|
||||
let parent = last
|
||||
let current.parent = last
|
||||
@@ -273,7 +273,7 @@ function! emmet#lang#html#parseIntoTree(abbr, type)
|
||||
let current.parent = parent
|
||||
let current.pos = 1
|
||||
endif
|
||||
if operator =~ '[<^]'
|
||||
if operator =~# '[<^]'
|
||||
for c in range(len(operator))
|
||||
let tmp = parent.parent
|
||||
if empty(tmp)
|
||||
@@ -288,17 +288,17 @@ function! emmet#lang#html#parseIntoTree(abbr, type)
|
||||
let last = current
|
||||
|
||||
" parse block
|
||||
if block_start =~ '('
|
||||
if operator =~ '>'
|
||||
if block_start =~# '('
|
||||
if operator =~# '>'
|
||||
let last.pos += 1
|
||||
endif
|
||||
for n in range(len(block_start))
|
||||
let pos += [last.pos]
|
||||
endfor
|
||||
endif
|
||||
if block_end =~ ')'
|
||||
if block_end =~# ')'
|
||||
for n in split(substitute(substitute(block_end, ' ', '', 'g'), ')', ',),', 'g'), ',')
|
||||
if n == ')'
|
||||
if n ==# ')'
|
||||
if len(pos) > 0 && last.pos >= pos[-1]
|
||||
for c in range(last.pos - pos[-1])
|
||||
let tmp = parent.parent
|
||||
@@ -333,24 +333,24 @@ function! emmet#lang#html#parseIntoTree(abbr, type)
|
||||
let abbr = abbr[stridx(abbr, match) + len(match):]
|
||||
|
||||
if g:emmet_debug > 1
|
||||
echomsg "str=".str
|
||||
echomsg "block_start=".block_start
|
||||
echomsg "tag_name=".tag_name
|
||||
echomsg "operator=".operator
|
||||
echomsg "attributes=".attributes
|
||||
echomsg "value=".value
|
||||
echomsg "basevalue=".basevalue
|
||||
echomsg "multiplier=".multiplier
|
||||
echomsg "block_end=".block_end
|
||||
echomsg "abbr=".abbr
|
||||
echomsg "pos=".string(pos)
|
||||
echomsg "---"
|
||||
echomsg 'str='.str
|
||||
echomsg 'block_start='.block_start
|
||||
echomsg 'tag_name='.tag_name
|
||||
echomsg 'operator='.operator
|
||||
echomsg 'attributes='.attributes
|
||||
echomsg 'value='.value
|
||||
echomsg 'basevalue='.basevalue
|
||||
echomsg 'multiplier='.multiplier
|
||||
echomsg 'block_end='.block_end
|
||||
echomsg 'abbr='.abbr
|
||||
echomsg 'pos='.string(pos)
|
||||
echomsg '---'
|
||||
endif
|
||||
endwhile
|
||||
return root
|
||||
endfunction
|
||||
|
||||
function! s:dollar_add(base,no)
|
||||
function! s:dollar_add(base,no) abort
|
||||
if a:base > 0
|
||||
return a:base + a:no - 1
|
||||
elseif a:base < 0
|
||||
@@ -360,7 +360,7 @@ function! s:dollar_add(base,no)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! emmet#lang#html#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
function! emmet#lang#html#toString(settings, current, type, inline, filters, itemno, indent) abort
|
||||
let settings = a:settings
|
||||
let current = a:current
|
||||
let type = a:type
|
||||
@@ -418,12 +418,12 @@ function! emmet#lang#html#toString(settings, current, type, inline, filters, ite
|
||||
let str .= ' ' . attr . '=' . q . attr . q
|
||||
endif
|
||||
if emmet#useFilter(filters, 'c')
|
||||
if attr == 'id' | let comment .= '#' . Val | endif
|
||||
if attr == 'class' | let comment .= '.' . Val | endif
|
||||
if attr ==# 'id' | let comment .= '#' . Val | endif
|
||||
if attr ==# 'class' | let comment .= '.' . Val | endif
|
||||
endif
|
||||
else
|
||||
if dollar_expr
|
||||
while Val =~ '\$\([^#{]\|$\)'
|
||||
while Val =~# '\$\([^#{]\|$\)'
|
||||
" TODO: regexp engine specified
|
||||
if exists('®expengine')
|
||||
let Val = substitute(Val, '\%#=1\(\$\+\)\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
|
||||
@@ -433,7 +433,7 @@ function! emmet#lang#html#toString(settings, current, type, inline, filters, ite
|
||||
endwhile
|
||||
let attr = substitute(attr, '\$$', itemno+1, '')
|
||||
endif
|
||||
if attr == 'class' && emmet#useFilter(filters, 'bem')
|
||||
if attr ==# 'class' && emmet#useFilter(filters, 'bem')
|
||||
let vals = split(Val, '\s\+')
|
||||
let Val = ''
|
||||
let lead = ''
|
||||
@@ -441,10 +441,10 @@ function! emmet#lang#html#toString(settings, current, type, inline, filters, ite
|
||||
if len(Val) > 0
|
||||
let Val .= ' '
|
||||
endif
|
||||
if _val =~ '^\a_'
|
||||
if _val =~# '^\a_'
|
||||
let lead = _val[0]
|
||||
let Val .= lead . ' ' . _val
|
||||
elseif _val =~ '^_'
|
||||
elseif _val =~# '^_'
|
||||
if len(lead) == 0
|
||||
let pattr = current.parent.attr
|
||||
if has_key(pattr, 'class')
|
||||
@@ -459,19 +459,19 @@ function! emmet#lang#html#toString(settings, current, type, inline, filters, ite
|
||||
endif
|
||||
let str .= ' ' . attr . '=' . q . Val . q
|
||||
if emmet#useFilter(filters, 'c')
|
||||
if attr == 'id' | let comment .= '#' . Val | endif
|
||||
if attr == 'class' | let comment .= '.' . Val | endif
|
||||
if attr ==# 'id' | let comment .= '#' . Val | endif
|
||||
if attr ==# 'class' | let comment .= '.' . Val | endif
|
||||
endif
|
||||
endif
|
||||
unlet Val
|
||||
endfor
|
||||
if len(comment) > 0 && ct == 'both'
|
||||
let str = "<!-- " . comment . " -->\n" . str
|
||||
if len(comment) > 0 && ct ==# 'both'
|
||||
let str = '<!-- ' . comment . " -->\n" . str
|
||||
endif
|
||||
if stridx(','.settings.html.empty_elements.',', ','.current_name.',') != -1
|
||||
let str .= settings.html.empty_element_suffix
|
||||
else
|
||||
let str .= ">"
|
||||
let str .= '>'
|
||||
let text = current.value[1:-2]
|
||||
if dollar_expr
|
||||
" TODO: regexp engine specified
|
||||
@@ -504,7 +504,7 @@ function! emmet#lang#html#toString(settings, current, type, inline, filters, ite
|
||||
endif
|
||||
endif
|
||||
let inner = emmet#toString(child, type, 0, filters, itemno, indent)
|
||||
let inner = substitute(inner, "^\n", "", 'g')
|
||||
let inner = substitute(inner, "^\n", '', 'g')
|
||||
let inner = substitute(inner, "\n", "\n" . escape(indent, '\'), 'g')
|
||||
let inner = substitute(inner, "\n" . escape(indent, '\') . '$', '', 'g')
|
||||
let str .= inner
|
||||
@@ -515,13 +515,13 @@ function! emmet#lang#html#toString(settings, current, type, inline, filters, ite
|
||||
if dr
|
||||
let str .= "\n"
|
||||
endif
|
||||
let str .= "</" . current_name . ">"
|
||||
let str .= '</' . current_name . '>'
|
||||
endif
|
||||
if len(comment) > 0
|
||||
if ct == "lastonly"
|
||||
let str .= "<!-- " . comment . " -->"
|
||||
if ct ==# 'lastonly'
|
||||
let str .= '<!-- ' . comment . ' -->'
|
||||
else
|
||||
let str .= "\n<!-- /" . comment . " -->"
|
||||
let str .= "\n<!-- /" . comment . ' -->'
|
||||
endif
|
||||
endif
|
||||
if len(current_name) > 0 && current.multiplier > 0 || stridx(','.settings.html.block_elements.',', ','.current_name.',') != -1
|
||||
@@ -530,13 +530,13 @@ function! emmet#lang#html#toString(settings, current, type, inline, filters, ite
|
||||
return str
|
||||
endfunction
|
||||
|
||||
function! emmet#lang#html#imageSize()
|
||||
function! emmet#lang#html#imageSize() abort
|
||||
let img_region = emmet#util#searchRegion('<img\s', '>')
|
||||
if !emmet#util#regionIsValid(img_region) || !emmet#util#cursorInRegion(img_region)
|
||||
return
|
||||
endif
|
||||
let content = emmet#util#getContent(img_region)
|
||||
if content !~ '^<img[^><]\+>$'
|
||||
if content !~# '^<img[^><]\+>$'
|
||||
return
|
||||
endif
|
||||
let current = emmet#lang#html#parseTag(content)
|
||||
@@ -544,9 +544,9 @@ function! emmet#lang#html#imageSize()
|
||||
return
|
||||
endif
|
||||
let fn = current.attr.src
|
||||
if fn =~ '^\s*$'
|
||||
if fn =~# '^\s*$'
|
||||
return
|
||||
elseif fn !~ '^\(/\|http\)'
|
||||
elseif fn !~# '^\(/\|http\)'
|
||||
let fn = simplify(expand('%:h') . '/' . fn)
|
||||
endif
|
||||
|
||||
@@ -562,13 +562,13 @@ function! emmet#lang#html#imageSize()
|
||||
call emmet#util#setContent(img_region, html)
|
||||
endfunction
|
||||
|
||||
function! emmet#lang#html#encodeImage()
|
||||
function! emmet#lang#html#encodeImage() abort
|
||||
let img_region = emmet#util#searchRegion('<img\s', '>')
|
||||
if !emmet#util#regionIsValid(img_region) || !emmet#util#cursorInRegion(img_region)
|
||||
return
|
||||
endif
|
||||
let content = emmet#util#getContent(img_region)
|
||||
if content !~ '^<img[^><]\+>$'
|
||||
if content !~# '^<img[^><]\+>$'
|
||||
return
|
||||
endif
|
||||
let current = emmet#lang#html#parseTag(content)
|
||||
@@ -576,7 +576,7 @@ function! emmet#lang#html#encodeImage()
|
||||
return
|
||||
endif
|
||||
let fn = current.attr.src
|
||||
if fn !~ '^\(/\|http\)'
|
||||
if fn !~# '^\(/\|http\)'
|
||||
let fn = simplify(expand('%:h') . '/' . fn)
|
||||
endif
|
||||
|
||||
@@ -590,7 +590,7 @@ function! emmet#lang#html#encodeImage()
|
||||
call emmet#util#setContent(img_region, html)
|
||||
endfunction
|
||||
|
||||
function! emmet#lang#html#parseTag(tag)
|
||||
function! emmet#lang#html#parseTag(tag) abort
|
||||
let current = emmet#newNode()
|
||||
let mx = '<\([a-zA-Z][a-zA-Z0-9]*\)\(\%(\s[a-zA-Z][a-zA-Z0-9]\+=\%([^"'' \t]\+\|"[^"]\{-}"\|''[^'']\{-}''\)\s*\)*\)\(/\{0,1}\)>'
|
||||
let match = matchstr(a:tag, mx)
|
||||
@@ -612,7 +612,7 @@ function! emmet#lang#html#parseTag(tag)
|
||||
return current
|
||||
endfunction
|
||||
|
||||
function! emmet#lang#html#toggleComment()
|
||||
function! emmet#lang#html#toggleComment() abort
|
||||
let orgpos = emmet#util#getcurpos()
|
||||
let curpos = emmet#util#getcurpos()
|
||||
let mx = '<\%#[^>]*>'
|
||||
@@ -639,12 +639,12 @@ function! emmet#lang#html#toggleComment()
|
||||
let pos2 = block[1]
|
||||
let content = emmet#util#getContent(block)
|
||||
let tag_name = matchstr(content, '^<\zs/\{0,1}[^ \r\n>]\+')
|
||||
if tag_name[0] == '/'
|
||||
if tag_name[0] ==# '/'
|
||||
call setpos('.', [0, pos1[0], pos1[1], 0])
|
||||
let pos2 = searchpairpos('<'. tag_name[1:] . '\>[^>]*>', '', '</' . tag_name[1:] . '>', 'bnW')
|
||||
let pos1 = searchpos('>', 'cneW')
|
||||
let block = [pos2, pos1]
|
||||
elseif tag_name =~ '/$'
|
||||
elseif tag_name =~# '/$'
|
||||
if !emmet#util#pointInRegion(orgpos[1:2], block)
|
||||
" it's broken tree
|
||||
call setpos('.', orgpos)
|
||||
@@ -678,7 +678,7 @@ function! emmet#lang#html#toggleComment()
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
function! emmet#lang#html#balanceTag(flag) range
|
||||
function! emmet#lang#html#balanceTag(flag) range abort
|
||||
let vblock = emmet#util#getVisualBlock()
|
||||
if a:flag == -2 || a:flag == 2
|
||||
let curpos = [0, line("'<"), col("'<"), 0]
|
||||
@@ -743,13 +743,13 @@ function! emmet#lang#html#balanceTag(flag) range
|
||||
endwhile
|
||||
endif
|
||||
if a:flag == -2 || a:flag == 2
|
||||
silent! exe "normal! gv"
|
||||
silent! exe 'normal! gv'
|
||||
else
|
||||
call setpos('.', curpos)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! emmet#lang#html#moveNextPrevItem(flag)
|
||||
function! emmet#lang#html#moveNextPrevItem(flag) abort
|
||||
silent! exe "normal \<esc>"
|
||||
let mx = '\%([0-9a-zA-Z-:]\+\%(="[^"]*"\|=''[^'']*''\|[^ ''">\]]*\)\{0,1}\)'
|
||||
let pos = searchpos('\s'.mx.'\zs', '')
|
||||
@@ -758,7 +758,7 @@ function! emmet#lang#html#moveNextPrevItem(flag)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! emmet#lang#html#moveNextPrev(flag)
|
||||
function! emmet#lang#html#moveNextPrev(flag) abort
|
||||
let pos = search('\%(</\w\+\)\@<!\zs><\/\|\(""\)\|^\(\s*\)$', a:flag ? 'Wpb' : 'Wp')
|
||||
if pos == 3
|
||||
startinsert!
|
||||
@@ -768,7 +768,7 @@ function! emmet#lang#html#moveNextPrev(flag)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! emmet#lang#html#splitJoinTag()
|
||||
function! emmet#lang#html#splitJoinTag() abort
|
||||
let curpos = emmet#util#getcurpos()
|
||||
while 1
|
||||
let mx = '<\(/\{0,1}[a-zA-Z][a-zA-Z0-9:_\-]*\)[^>]*>'
|
||||
@@ -776,13 +776,13 @@ function! emmet#lang#html#splitJoinTag()
|
||||
let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
|
||||
let tag_name = substitute(content, '^<\(/\{0,1}[a-zA-Z][a-zA-Z0-9:_\-]*\).*$', '\1', '')
|
||||
let block = [pos1, [pos1[0], pos1[1] + len(content) - 1]]
|
||||
if content[-2:] == '/>' && emmet#util#cursorInRegion(block)
|
||||
let content = content[:-3] . "></" . tag_name . '>'
|
||||
if content[-2:] ==# '/>' && emmet#util#cursorInRegion(block)
|
||||
let content = content[:-3] . '></' . tag_name . '>'
|
||||
call emmet#util#setContent(block, content)
|
||||
call setpos('.', [0, block[0][0], block[0][1], 0])
|
||||
return
|
||||
else
|
||||
if tag_name[0] == '/'
|
||||
if tag_name[0] ==# '/'
|
||||
let pos1 = searchpos('<' . tag_name[1:] . '[^a-zA-Z0-9]', 'bcnW')
|
||||
call setpos('.', [0, pos1[0], pos1[1], 0])
|
||||
let pos2 = searchpos('</' . tag_name[1:] . '>', 'cneW')
|
||||
@@ -791,7 +791,7 @@ function! emmet#lang#html#splitJoinTag()
|
||||
endif
|
||||
let block = [pos1, pos2]
|
||||
let content = emmet#util#getContent(block)
|
||||
if emmet#util#pointInRegion(curpos[1:2], block) && content[1:] !~ '<' . tag_name . '[^a-zA-Z0-9]*[^>]*>'
|
||||
if emmet#util#pointInRegion(curpos[1:2], block) && content[1:] !~# '<' . tag_name . '[^a-zA-Z0-9]*[^>]*>'
|
||||
let content = matchstr(content, mx)[:-2] . '/>'
|
||||
call emmet#util#setContent(block, content)
|
||||
call setpos('.', [0, block[0][0], block[0][1], 0])
|
||||
@@ -808,7 +808,7 @@ function! emmet#lang#html#splitJoinTag()
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
function! emmet#lang#html#removeTag()
|
||||
function! emmet#lang#html#removeTag() abort
|
||||
let curpos = emmet#util#getcurpos()
|
||||
while 1
|
||||
let mx = '<\(/\{0,1}[a-zA-Z][a-zA-Z0-9:_\-]*\)[^>]*'
|
||||
@@ -816,12 +816,12 @@ function! emmet#lang#html#removeTag()
|
||||
let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
|
||||
let tag_name = matchstr(content, '^<\zs/\{0,1}[a-zA-Z0-9:_\-]*')
|
||||
let block = [pos1, [pos1[0], pos1[1] + len(content) - 1]]
|
||||
if content[-2:] == '/>' && emmet#util#cursorInRegion(block)
|
||||
if content[-2:] ==# '/>' && emmet#util#cursorInRegion(block)
|
||||
call emmet#util#setContent(block, '')
|
||||
call setpos('.', [0, block[0][0], block[0][1], 0])
|
||||
return
|
||||
else
|
||||
if tag_name[0] == '/'
|
||||
if tag_name[0] ==# '/'
|
||||
let pos1 = searchpos('<' . tag_name[1:] . '[^a-zA-Z0-9]', 'bcnW')
|
||||
call setpos('.', [0, pos1[0], pos1[1], 0])
|
||||
let pos2 = searchpos('</' . tag_name[1:] . '>', 'cneW')
|
||||
@@ -830,7 +830,7 @@ function! emmet#lang#html#removeTag()
|
||||
endif
|
||||
let block = [pos1, pos2]
|
||||
let content = emmet#util#getContent(block)
|
||||
if emmet#util#pointInRegion(curpos[1:2], block) && content[1:] !~ '^<' . tag_name . '[^a-zA-Z0-9]'
|
||||
if emmet#util#pointInRegion(curpos[1:2], block) && content[1:] !~# '^<' . tag_name . '[^a-zA-Z0-9]'
|
||||
call emmet#util#setContent(block, '')
|
||||
call setpos('.', [0, block[0][0], block[0][1], 0])
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user