mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-06 18:54:27 +08:00
add new option 'g:use_zen_complete_tag' for complete abbr.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
" File: zencoding.vim
|
||||
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
||||
" Last Change: 23-Feb-2010.
|
||||
" Version: 0.19
|
||||
" Version: 0.20
|
||||
" WebPage: http://github.com/mattn/zencoding-vim
|
||||
" Description: vim plugins for HTML and CSS hi-speed coding.
|
||||
" SeeAlso: http://code.google.com/p/zen-coding/
|
||||
@@ -994,8 +994,6 @@ function! s:zen_expand(word)
|
||||
let rest = getline('.')[col('.'):]
|
||||
let items = s:zen_parseIntoTree(part, type)['child']
|
||||
let expand = ''
|
||||
let g:hoge = line
|
||||
let g:moge = part
|
||||
for item in items
|
||||
let expand .= s:zen_toString(item, type)
|
||||
endfor
|
||||
@@ -1035,21 +1033,6 @@ function! ZenExpand(abbr, type)
|
||||
return expand
|
||||
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)
|
||||
if type(a:lhs) == 3 && type(a:rhs) == 3
|
||||
call remove(a:lhs, 0, len(a:lhs)-1)
|
||||
@@ -1073,9 +1056,54 @@ function! s:zen_mergeConfig(lhs, rhs)
|
||||
endif
|
||||
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')
|
||||
call s:zen_mergeConfig(s:zen_settings, g:user_zen_settings)
|
||||
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
|
||||
"echo ZenExpand('html:xt>div#header>div#logo+ul#nav>li.item-$*5>a', '')
|
||||
"echo ZenExpand('ol>li*2', '')
|
||||
|
||||
@@ -2,7 +2,7 @@ script_name: ZenCoding.vim
|
||||
script_id: '2981'
|
||||
script_type: utility
|
||||
script_package: zencoding.vim
|
||||
script_version: '0.19'
|
||||
script_version: '0.20'
|
||||
required_vim_version: '7.0'
|
||||
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'].
|
||||
|
||||
install_details: |
|
||||
copy zencoding.vim to your plugin directory.
|
||||
|
||||
versions:
|
||||
- '0.20': |
|
||||
This is an upgrade for ZenCoding.vim: add option use_zen_complete_tag for complete abbr.
|
||||
- '0.19': |
|
||||
This is an upgrade for ZenCoding.vim: fixed problem that couldn't expand 'link:css' correctly.
|
||||
- '0.18': |
|
||||
|
||||
Reference in New Issue
Block a user