forked from VimPlug/emmet-vim
add new option 'g:use_zen_complete_tag' for complete abbr.
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
" File: zencoding.vim
|
" File: zencoding.vim
|
||||||
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
||||||
" Last Change: 23-Feb-2010.
|
" Last Change: 23-Feb-2010.
|
||||||
" Version: 0.19
|
" Version: 0.20
|
||||||
" WebPage: http://github.com/mattn/zencoding-vim
|
" WebPage: http://github.com/mattn/zencoding-vim
|
||||||
" Description: vim plugins for HTML and CSS hi-speed coding.
|
" Description: vim plugins for HTML and CSS hi-speed coding.
|
||||||
" SeeAlso: http://code.google.com/p/zen-coding/
|
" SeeAlso: http://code.google.com/p/zen-coding/
|
||||||
@@ -994,8 +994,6 @@ function! s:zen_expand(word)
|
|||||||
let rest = getline('.')[col('.'):]
|
let rest = getline('.')[col('.'):]
|
||||||
let items = s:zen_parseIntoTree(part, type)['child']
|
let items = s:zen_parseIntoTree(part, type)['child']
|
||||||
let expand = ''
|
let expand = ''
|
||||||
let g:hoge = line
|
|
||||||
let g:moge = part
|
|
||||||
for item in items
|
for item in items
|
||||||
let expand .= s:zen_toString(item, type)
|
let expand .= s:zen_toString(item, type)
|
||||||
endfor
|
endfor
|
||||||
@@ -1035,21 +1033,6 @@ function! ZenExpand(abbr, type)
|
|||||||
return expand
|
return expand
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
inoremap <plug>ZenCodingExpandWord <c-g>u<esc>:call <sid>zen_expand(1)<cr>a
|
|
||||||
inoremap <plug>ZenCodingExpandAbbr <c-g>u<esc>:call <sid>zen_expand(0)<cr>a
|
|
||||||
if !exists('g:user_zen_expandword_key')
|
|
||||||
let g:user_zen_expandword_key = '<c-z>.'
|
|
||||||
endif
|
|
||||||
if !hasmapto(g:user_zen_expandword_key, 'i')
|
|
||||||
exe "imap " . g:user_zen_expandword_key . " <plug>ZenCodingExpandWord"
|
|
||||||
endif
|
|
||||||
if !exists('g:user_zen_expandabbr_key')
|
|
||||||
let g:user_zen_expandabbr_key = '<c-z>,'
|
|
||||||
endif
|
|
||||||
if !hasmapto(g:user_zen_expandabbr_key, 'i')
|
|
||||||
exe "imap " . g:user_zen_expandabbr_key . " <plug>ZenCodingExpandAbbr"
|
|
||||||
endif
|
|
||||||
|
|
||||||
function! s:zen_mergeConfig(lhs, rhs)
|
function! s:zen_mergeConfig(lhs, rhs)
|
||||||
if type(a:lhs) == 3 && type(a:rhs) == 3
|
if type(a:lhs) == 3 && type(a:rhs) == 3
|
||||||
call remove(a:lhs, 0, len(a:lhs)-1)
|
call remove(a:lhs, 0, len(a:lhs)-1)
|
||||||
@@ -1073,9 +1056,54 @@ function! s:zen_mergeConfig(lhs, rhs)
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! ZenCompleteTag(findstart, base)
|
||||||
|
if a:findstart
|
||||||
|
let line = getline('.')
|
||||||
|
let start = col('.') - 1
|
||||||
|
while start > 0 && line[start - 1] =~ '[a-zA-Z0-9:\@]'
|
||||||
|
let start -= 1
|
||||||
|
endwhile
|
||||||
|
return start
|
||||||
|
else
|
||||||
|
let type = &ft
|
||||||
|
let res = []
|
||||||
|
if !has_key(s:zen_settings, type)
|
||||||
|
return res
|
||||||
|
endif
|
||||||
|
if len(type) == 0 | let type = 'html' | endif
|
||||||
|
for item in keys(s:zen_settings[type]['snippets'])
|
||||||
|
if stridx(item, a:base) != -1
|
||||||
|
call add(res, item)
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
return res
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
if exists('g:user_zen_settings')
|
if exists('g:user_zen_settings')
|
||||||
call s:zen_mergeConfig(s:zen_settings, g:user_zen_settings)
|
call s:zen_mergeConfig(s:zen_settings, g:user_zen_settings)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if exists('g:use_zen_complete_tag') && g:use_zen_complete_tag
|
||||||
|
setlocal completefunc=ZenCompleteTag
|
||||||
|
endif
|
||||||
|
|
||||||
|
inoremap <plug>ZenCodingExpandWord <c-g>u<esc>:call <sid>zen_expand(1)<cr>a
|
||||||
|
inoremap <plug>ZenCodingExpandAbbr <c-g>u<esc>:call <sid>zen_expand(0)<cr>a
|
||||||
|
|
||||||
|
if !exists('g:user_zen_expandword_key')
|
||||||
|
let g:user_zen_expandword_key = '<c-z>.'
|
||||||
|
endif
|
||||||
|
if !hasmapto(g:user_zen_expandword_key, 'i')
|
||||||
|
exe "imap " . g:user_zen_expandword_key . " <plug>ZenCodingExpandWord"
|
||||||
|
endif
|
||||||
|
if !exists('g:user_zen_expandabbr_key')
|
||||||
|
let g:user_zen_expandabbr_key = '<c-z>,'
|
||||||
|
endif
|
||||||
|
if !hasmapto(g:user_zen_expandabbr_key, 'i')
|
||||||
|
exe "imap " . g:user_zen_expandabbr_key . " <plug>ZenCodingExpandAbbr"
|
||||||
|
endif
|
||||||
|
|
||||||
" test
|
" test
|
||||||
"echo ZenExpand('html:xt>div#header>div#logo+ul#nav>li.item-$*5>a', '')
|
"echo ZenExpand('html:xt>div#header>div#logo+ul#nav>li.item-$*5>a', '')
|
||||||
"echo ZenExpand('ol>li*2', '')
|
"echo ZenExpand('ol>li*2', '')
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ script_name: ZenCoding.vim
|
|||||||
script_id: '2981'
|
script_id: '2981'
|
||||||
script_type: utility
|
script_type: utility
|
||||||
script_package: zencoding.vim
|
script_package: zencoding.vim
|
||||||
script_version: '0.19'
|
script_version: '0.20'
|
||||||
required_vim_version: '7.0'
|
required_vim_version: '7.0'
|
||||||
summary: vim plugins for HTML and CSS hi-speed coding.
|
summary: vim plugins for HTML and CSS hi-speed coding.
|
||||||
|
|
||||||
@@ -61,12 +61,18 @@ detailed_description: |
|
|||||||
\ }
|
\ }
|
||||||
\}
|
\}
|
||||||
|
|
||||||
|
let g:user_zen_expandabbr_key = '<c-e>'
|
||||||
|
|
||||||
|
let g:use_zen_complete_tag = 1
|
||||||
|
|
||||||
You can set language attribute in html using zen_settings['lang'].
|
You can set language attribute in html using zen_settings['lang'].
|
||||||
|
|
||||||
install_details: |
|
install_details: |
|
||||||
copy zencoding.vim to your plugin directory.
|
copy zencoding.vim to your plugin directory.
|
||||||
|
|
||||||
versions:
|
versions:
|
||||||
|
- '0.20': |
|
||||||
|
This is an upgrade for ZenCoding.vim: add option use_zen_complete_tag for complete abbr.
|
||||||
- '0.19': |
|
- '0.19': |
|
||||||
This is an upgrade for ZenCoding.vim: fixed problem that couldn't expand 'link:css' correctly.
|
This is an upgrade for ZenCoding.vim: fixed problem that couldn't expand 'link:css' correctly.
|
||||||
- '0.18': |
|
- '0.18': |
|
||||||
|
|||||||
Reference in New Issue
Block a user