mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-06 18:54:27 +08:00
fix {} regexp pattern. close issue #58
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"=============================================================================
|
||||
" zencoding.vim
|
||||
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
||||
" Last Change: 31-Jan-2012.
|
||||
" Last Change: 14-Feb-2012.
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
@@ -69,9 +69,9 @@ function! s:zen_parseIntoTree(abbr, type)
|
||||
let rabbr = substitute(abbr, '\([a-zA-Z][a-zA-Z0-9+]*\)+\([()]\|$\)', '\="(".s:zen_getExpandos(type, submatch(1)).")".submatch(2)', 'i')
|
||||
endif
|
||||
let abbr = rabbr
|
||||
let mx = '\([+>]\|<\+\)\{-}\s*\((*\)\{-}\s*\([@#.]\{-}[a-zA-Z\!][a-zA-Z0-9:_\!\-$]*\|{[^}]\+}\)\(\%(\%(#{[{}a-zA-Z0-9_\-\$]\+\|#[a-zA-Z0-9_\-\$]\+\)\|\%(\[[^\]]\+\]\)\|\%(\.{[{}a-zA-Z0-9_\-\$]\+\|\.[a-zA-Z0-9_\-\$]\+\)\)*\)\%(\({[^}]\+}\)\)\{0,1}\%(\s*\*\s*\([0-9]\+\)\s*\)\{0,1}\(\%(\s*)\%(\s*\*\s*[0-9]\+\s*\)\{0,1}\)*\)'
|
||||
let mx = '\([+>]\|<\+\)\{-}\s*\((*\)\{-}\s*\([@#.]\{-}[a-zA-Z\!][a-zA-Z0-9:_\!\-$]*\|{.\+}\)\(\%(\%(#{[{}a-zA-Z0-9_\-\$]\+\|#[a-zA-Z0-9_\-\$]\+\)\|\%(\[[^\]]\+\]\)\|\%(\.{[{}a-zA-Z0-9_\-\$]\+\|\.[a-zA-Z0-9_\-\$]\+\)\)*\)\%(\({[^}]\+}\)\)\{0,1}\%(\s*\*\s*\([0-9]\+\)\s*\)\{0,1}\(\%(\s*)\%(\s*\*\s*[0-9]\+\s*\)\{0,1}\)*\)'
|
||||
else
|
||||
let mx = '\([+>]\|<\+\)\{-}\s*\((*\)\{-}\s*\([@#.]\{-}[a-zA-Z\!][a-zA-Z0-9:_\!\+\-]*\|{[^}]\+}\)\(\%(\%(#{[{}a-zA-Z0-9_\-\$]\+\|#[a-zA-Z0-9_\-\$]\+\)\|\%(\[[^\]]\+\]\)\|\%(\.{[{}a-zA-Z0-9_\-\$]\+\|\.[a-zA-Z0-9_\-\$]\+\)\)*\)\%(\({[^}]\+}\)\)\{0,1}\%(\s*\*\s*\([0-9]\+\)\s*\)\{0,1}\(\%(\s*)\%(\s*\*\s*[0-9]\+\s*\)\{0,1}\)*\)'
|
||||
let mx = '\([+>]\|<\+\)\{-}\s*\((*\)\{-}\s*\([@#.]\{-}[a-zA-Z\!][a-zA-Z0-9:_\!\+\-]*\|{.\+}\)\(\%(\%(#{[{}a-zA-Z0-9_\-\$]\+\|#[a-zA-Z0-9_\-\$]\+\)\|\%(\[[^\]]\+\]\)\|\%(\.{[{}a-zA-Z0-9_\-\$]\+\|\.[a-zA-Z0-9_\-\$]\+\)\)*\)\%(\({[^}]\+}\)\)\{0,1}\%(\s*\*\s*\([0-9]\+\)\s*\)\{0,1}\(\%(\s*)\%(\s*\*\s*[0-9]\+\s*\)\{0,1}\)*\)'
|
||||
endif
|
||||
let root = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'pos': 0, 'important': 0 }
|
||||
let parent = root
|
||||
@@ -745,7 +745,7 @@ function! zencoding#expandAbbr(mode) range
|
||||
let line = matchstr(line, '^\(.*\%'.col('.').'c.\)')
|
||||
endif
|
||||
if a:mode == 1
|
||||
let part = matchstr(line, '\([a-zA-Z0-9_\@:|]\+\)$')
|
||||
let part = matchstr(line, '\([a-zA-Z0-9:_\-\@|]\+\)$')
|
||||
else
|
||||
let part = matchstr(line, '\(\S.*\)$')
|
||||
if s:zen_isExtends(type, "html")
|
||||
@@ -972,10 +972,10 @@ endfunction
|
||||
function! zencoding#splitJoinTag()
|
||||
let curpos = getpos('.')
|
||||
while 1
|
||||
let mx = '<\(/\{0,1}[a-zA-Z][a-zA-Z0-9:]*\)[^>]*>'
|
||||
let mx = '<\(/\{0,1}[a-zA-Z][a-zA-Z0-9:_\-]*\)[^>]*>'
|
||||
let pos1 = searchpos(mx, 'bcnW')
|
||||
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 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:] == '/>' && s:cursor_in_region(block)
|
||||
let content = content[:-3] . "></" . tag_name . '>'
|
||||
@@ -1019,10 +1019,10 @@ endfunction
|
||||
function! zencoding#removeTag()
|
||||
let curpos = getpos('.')
|
||||
while 1
|
||||
let mx = '<\(/\{0,1}[a-zA-Z][a-zA-Z0-9]*\)[^>]*>'
|
||||
let mx = '<\(/\{0,1}[a-zA-Z][a-zA-Z0-9:_\-]*\)[^>]*>'
|
||||
let pos1 = searchpos(mx, 'bcnW')
|
||||
let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
|
||||
let tag_name = substitute(content, '^<\(/\{0,1}[a-zA-Z0-9]*\).*$', '\1', '')
|
||||
let tag_name = substitute(content, '^<\(/\{0,1}[a-zA-Z0-9:_\-]*\).*$', '\1', '')
|
||||
let block = [pos1, [pos1[0], pos1[1] + len(content) - 1]]
|
||||
if content[-2:] == '/>' && s:cursor_in_region(block)
|
||||
call s:change_content(block, '')
|
||||
@@ -1062,10 +1062,10 @@ function! zencoding#balanceTag(flag) range
|
||||
let curpos = getpos('.')
|
||||
endif
|
||||
while 1
|
||||
let mx = '<\(/\{0,1}[a-zA-Z][a-zA-Z0-9]*\)[^>]*>'
|
||||
let mx = '<\(/\{0,1}[a-zA-Z][a-zA-Z0-9:_\-]*\)[^>]*>'
|
||||
let pos1 = searchpos(mx, (a:flag == -2 ? 'nW' : 'bcnW'))
|
||||
let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
|
||||
let tag_name = substitute(content, '^<\(/\{0,1}[a-zA-Z0-9]*\).*$', '\1', '')
|
||||
let tag_name = substitute(content, '^<\(/\{0,1}[a-zA-Z0-9:_\-]*\).*$', '\1', '')
|
||||
let block = [pos1, [pos1[0], pos1[1] + len(content) - 1]]
|
||||
if !s:region_is_valid(block)
|
||||
break
|
||||
@@ -1411,7 +1411,7 @@ function! zencoding#CompleteTag(findstart, base)
|
||||
if a:findstart
|
||||
let line = getline('.')
|
||||
let start = col('.') - 1
|
||||
while start > 0 && line[start - 1] =~ '[a-zA-Z0-9:\@]'
|
||||
while start > 0 && line[start - 1] =~ '[a-zA-Z0-9:_\@\-]'
|
||||
let start -= 1
|
||||
endwhile
|
||||
return start
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"=============================================================================
|
||||
" File: zencoding.vim
|
||||
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
||||
" Last Change: 31-Jan-2012.
|
||||
" Last Change: 02-Feb-2012.
|
||||
" Version: 0.59
|
||||
" WebPage: http://github.com/mattn/zencoding-vim
|
||||
" Description: vim plugins for HTML and CSS hi-speed coding.
|
||||
|
||||
Reference in New Issue
Block a user