mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-07 03:04:27 +08:00
Rename to Emmet.vim!
This commit is contained in:
12
Makefile
12
Makefile
@@ -1,11 +1,11 @@
|
||||
all : zencoding-vim.zip
|
||||
all : emmet-vim.zip
|
||||
|
||||
remove-zip:
|
||||
-rm doc/tags
|
||||
-rm zencoding-vim.zip
|
||||
-rm emmet-vim.zip
|
||||
|
||||
zencoding-vim.zip: remove-zip
|
||||
zip -r zencoding-vim.zip autoload plugin doc
|
||||
emmet-vim.zip: remove-zip
|
||||
zip -r emmet-vim.zip autoload plugin doc
|
||||
|
||||
release: zencoding-vim.zip
|
||||
vimup update-script zencoding.vim
|
||||
release: emmet-vim.zip
|
||||
vimup update-script emmet.vim
|
||||
|
||||
42
README.mkd
42
README.mkd
@@ -1,33 +1,33 @@
|
||||
# ZenCoding-vim
|
||||
# Emmet-vim
|
||||
|
||||
[zencoding-vim](http://mattn.github.com/zencoding-vim) is a vim plug-in
|
||||
[emmet-vim](http://mattn.github.com/emmet-vim) is a vim plug-in
|
||||
which provides support for expanding abbreviations similar to
|
||||
[zen-coding](http://code.google.com/p/zen-coding/).
|
||||
[emmet](http://emmet.io/).
|
||||
|
||||
## Installation
|
||||
|
||||
[Download zip file](http://www.vim.org/scripts/script.php?script_id=2981):
|
||||
|
||||
cd ~/.vim
|
||||
unzip zencoding-vim.zip
|
||||
unzip emmet-vim.zip
|
||||
|
||||
To install using pathogen.vim:
|
||||
|
||||
cd ~/.vim/bundle
|
||||
unzip /path/to/zencoding-vim.zip
|
||||
unzip /path/to/emmet-vim.zip
|
||||
|
||||
To checkout the source from repository:
|
||||
|
||||
cd ~/.vim/bundle
|
||||
git clone http://github.com/mattn/zencoding-vim.git
|
||||
git clone http://github.com/mattn/emmet-vim.git
|
||||
|
||||
or:
|
||||
|
||||
git clone http://github.com/mattn/zencoding-vim.git
|
||||
cd zencoding-vim
|
||||
cp plugin/zencoding.vim ~/.vim/plugin/
|
||||
cp autoload/zencoding.vim ~/.vim/autoload/
|
||||
cp -a autoload/zencoding ~/.vim/autoload/
|
||||
git clone http://github.com/mattn/emmet-vim.git
|
||||
cd emmet-vim
|
||||
cp plugin/emmet.vim ~/.vim/plugin/
|
||||
cp autoload/emmet.vim ~/.vim/autoload/
|
||||
cp -a autoload/emmet ~/.vim/autoload/
|
||||
|
||||
|
||||
## Quick Tutorial
|
||||
@@ -53,17 +53,17 @@ Then type "\<c-y\>," (Ctrl + y + ','), you should see:
|
||||
</body>
|
||||
</html>
|
||||
|
||||
[More Tutorials](https://raw.github.com/mattn/zencoding-vim/master/TUTORIAL)
|
||||
[More Tutorials](https://raw.github.com/mattn/emmet-vim/master/TUTORIAL)
|
||||
|
||||
|
||||
## Enable in different mode
|
||||
|
||||
If you don't want to enable zencoding in all modes,
|
||||
If you don't want to enable emmet in all modes,
|
||||
you can use set these options in `vimrc`:
|
||||
|
||||
let g:user_zen_mode='n' "only enable normal mode functions.
|
||||
let g:user_zen_mode='inv' "enable all functions, which is equal to
|
||||
let g:user_zen_mode='a' "enable all function in all mode.
|
||||
let g:user_emmet_mode='n' "only enable normal mode functions.
|
||||
let g:user_emmet_mode='inv' "enable all functions, which is equal to
|
||||
let g:user_emmet_mode='a' "enable all function in all mode.
|
||||
|
||||
## Project Authors
|
||||
|
||||
@@ -71,17 +71,21 @@ you can use set these options in `vimrc`:
|
||||
|
||||
## Links
|
||||
|
||||
### Emmet official site:
|
||||
|
||||
* <http://emmet.io/>
|
||||
|
||||
### zen-coding official site:
|
||||
|
||||
* <http://code.google.com/p/zen-coding/>
|
||||
|
||||
### zencoding.vim:
|
||||
### emmet.vim:
|
||||
|
||||
* <http://mattn.github.com/zencoding-vim>
|
||||
* <http://mattn.github.com/emmet-vim>
|
||||
|
||||
### development repository:
|
||||
|
||||
* <https://github.com/mattn/zencoding-vim>
|
||||
* <https://github.com/mattn/emmet-vim>
|
||||
|
||||
### my blog posts about zencoding-vim:
|
||||
|
||||
|
||||
14
TUTORIAL
14
TUTORIAL
@@ -1,4 +1,4 @@
|
||||
Tutorial for zencoding.vim
|
||||
Tutorial for Emmet.vim
|
||||
|
||||
mattn <mattn.jp@gmail.com>
|
||||
|
||||
@@ -176,28 +176,28 @@ Tutorial for zencoding.vim
|
||||
</blockquote>
|
||||
---------------------
|
||||
|
||||
14. Installing zencoding.vim for the language you are using:
|
||||
14. Installing emmet.vim for the language you are using:
|
||||
|
||||
# cd ~/.vim
|
||||
# unzip zencoding-vim.zip
|
||||
# unzip emmet-vim.zip
|
||||
|
||||
Or if you are using pathogen.vim:
|
||||
|
||||
# cd ~/.vim/bundle # or make directory
|
||||
# unzip /path/to/zencoding-vim.zip
|
||||
# unzip /path/to/emmet-vim.zip
|
||||
|
||||
Or if you get the sources from the repository:
|
||||
|
||||
# cd ~/.vim/bundle # or make directory
|
||||
# git clone http://github.com/mattn/zencoding-vim.git
|
||||
# git clone http://github.com/mattn/emmet-vim.git
|
||||
|
||||
15. Enable zencoding.vim for the language you using.
|
||||
15. Enable emmet.vim for the language you using.
|
||||
|
||||
You can customize the behavior of the languages you are using.
|
||||
|
||||
---------------------
|
||||
# cat >> ~/.vimrc
|
||||
let g:user_zen_settings = {
|
||||
let g:user_emmet_settings = {
|
||||
\ 'php' : {
|
||||
\ 'extends' : 'html',
|
||||
\ 'filters' : 'c',
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
"=============================================================================
|
||||
" zencoding.vim
|
||||
" emmet.vim
|
||||
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
||||
" Last Change: 10-Jun-2013.
|
||||
" Last Change: 06-Aug-2013.
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! zencoding#getExpandos(type, key)
|
||||
let expandos = zencoding#getResource(a:type, 'expandos', {})
|
||||
function! emmet#getExpandos(type, key)
|
||||
let expandos = emmet#getResource(a:type, 'expandos', {})
|
||||
if has_key(expandos, a:key)
|
||||
return expandos[a:key]
|
||||
endif
|
||||
return a:key
|
||||
endfunction
|
||||
|
||||
function! zencoding#splitFilterArg(filters)
|
||||
function! emmet#splitFilterArg(filters)
|
||||
for f in a:filters
|
||||
if f =~ '^/'
|
||||
return f[1:]
|
||||
@@ -23,7 +23,7 @@ function! zencoding#splitFilterArg(filters)
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! zencoding#useFilter(filters, filter)
|
||||
function! emmet#useFilter(filters, filter)
|
||||
for f in a:filters
|
||||
if a:filter == '/' && f =~ '^/'
|
||||
return 1
|
||||
@@ -34,30 +34,30 @@ function! zencoding#useFilter(filters, filter)
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
function! zencoding#getIndentation(...)
|
||||
function! emmet#getIndentation(...)
|
||||
if a:0 > 0
|
||||
let type = a:1
|
||||
else
|
||||
let type = zencoding#getFileType()
|
||||
let type = emmet#getFileType()
|
||||
endif
|
||||
if has_key(s:zen_settings, type) && has_key(s:zen_settings[type], 'indentation')
|
||||
let indent = s:zen_settings[type].indentation
|
||||
elseif has_key(s:zen_settings, 'indentation')
|
||||
let indent = s:zen_settings.indentation
|
||||
if has_key(s:emmet_settings, type) && has_key(s:emmet_settings[type], 'indentation')
|
||||
let indent = s:emmet_settings[type].indentation
|
||||
elseif has_key(s:emmet_settings, 'indentation')
|
||||
let indent = s:emmet_settings.indentation
|
||||
else
|
||||
let indent = (&l:expandtab || &l:tabstop != &l:shiftwidth) ? repeat(' ', &l:shiftwidth) : "\t"
|
||||
endif
|
||||
return indent
|
||||
endfunction
|
||||
|
||||
function! zencoding#getBaseType(type)
|
||||
if !has_key(s:zen_settings, a:type)
|
||||
function! emmet#getBaseType(type)
|
||||
if !has_key(s:emmet_settings, a:type)
|
||||
return ''
|
||||
endif
|
||||
if !has_key(s:zen_settings[a:type], 'extends')
|
||||
if !has_key(s:emmet_settings[a:type], 'extends')
|
||||
return a:type
|
||||
endif
|
||||
let extends = s:zen_settings[a:type].extends
|
||||
let extends = s:emmet_settings[a:type].extends
|
||||
if type(extends) == 1
|
||||
let tmp = split(extends, '\s*,\s*')
|
||||
let ext = tmp[0]
|
||||
@@ -65,22 +65,22 @@ function! zencoding#getBaseType(type)
|
||||
let ext = extends[0]
|
||||
endif
|
||||
if a:type != ext
|
||||
return zencoding#getBaseType(ext)
|
||||
return emmet#getBaseType(ext)
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! zencoding#isExtends(type, extend)
|
||||
function! emmet#isExtends(type, extend)
|
||||
if a:type == a:extend
|
||||
return 1
|
||||
endif
|
||||
if !has_key(s:zen_settings, a:type)
|
||||
if !has_key(s:emmet_settings, a:type)
|
||||
return 0
|
||||
endif
|
||||
if !has_key(s:zen_settings[a:type], 'extends')
|
||||
if !has_key(s:emmet_settings[a:type], 'extends')
|
||||
return 0
|
||||
endif
|
||||
let extends = s:zen_settings[a:type].extends
|
||||
let extends = s:emmet_settings[a:type].extends
|
||||
if type(extends) == 1
|
||||
let tmp = split(extends, '\s*,\s*')
|
||||
unlet! extends
|
||||
@@ -94,14 +94,14 @@ function! zencoding#isExtends(type, extend)
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
function! zencoding#parseIntoTree(abbr, type)
|
||||
function! emmet#parseIntoTree(abbr, type)
|
||||
let abbr = a:abbr
|
||||
let type = a:type
|
||||
let rtype = zencoding#lang#exists(type) ? type : 'html'
|
||||
return zencoding#lang#{rtype}#parseIntoTree(abbr, type)
|
||||
let rtype = emmet#lang#exists(type) ? type : 'html'
|
||||
return emmet#lang#{rtype}#parseIntoTree(abbr, type)
|
||||
endfunction
|
||||
|
||||
function! zencoding#mergeConfig(lhs, rhs)
|
||||
function! emmet#mergeConfig(lhs, rhs)
|
||||
if type(a:lhs) == 3 && type(a:rhs) == 3
|
||||
let a:lhs += a:rhs
|
||||
if len(a:lhs)
|
||||
@@ -119,7 +119,7 @@ function! zencoding#mergeConfig(lhs, rhs)
|
||||
let a:lhs[key] += a:rhs[key]
|
||||
elseif type(a:rhs[key]) == 4
|
||||
if has_key(a:lhs, key)
|
||||
call zencoding#mergeConfig(a:lhs[key], a:rhs[key])
|
||||
call emmet#mergeConfig(a:lhs[key], a:rhs[key])
|
||||
else
|
||||
let a:lhs[key] = a:rhs[key]
|
||||
endif
|
||||
@@ -130,7 +130,7 @@ function! zencoding#mergeConfig(lhs, rhs)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! zencoding#toString(...)
|
||||
function! emmet#toString(...)
|
||||
let current = a:1
|
||||
if a:0 > 1
|
||||
let type = a:2
|
||||
@@ -163,16 +163,16 @@ function! zencoding#toString(...)
|
||||
let indent = ''
|
||||
endif
|
||||
|
||||
let dollar_expr = zencoding#getResource(type, 'dollar_expr', 1)
|
||||
let dollar_expr = emmet#getResource(type, 'dollar_expr', 1)
|
||||
let itemno = 0
|
||||
let str = ''
|
||||
let rtype = zencoding#lang#exists(type) ? type : 'html'
|
||||
let rtype = emmet#lang#exists(type) ? type : 'html'
|
||||
while itemno < current.multiplier
|
||||
if len(current.name)
|
||||
if group_itemno != 0
|
||||
let inner = zencoding#lang#{rtype}#toString(s:zen_settings, current, type, inline, filters, group_itemno, indent)
|
||||
let inner = emmet#lang#{rtype}#toString(s:emmet_settings, current, type, inline, filters, group_itemno, indent)
|
||||
else
|
||||
let inner = zencoding#lang#{rtype}#toString(s:zen_settings, current, type, inline, filters, itemno, indent)
|
||||
let inner = emmet#lang#{rtype}#toString(s:emmet_settings, current, type, inline, filters, itemno, indent)
|
||||
endif
|
||||
if current.multiplier > 1
|
||||
let inner = substitute(inner, '\$#', '$line'.(itemno+1).'$', 'g')
|
||||
@@ -181,16 +181,16 @@ function! zencoding#toString(...)
|
||||
else
|
||||
let snippet = current.snippet
|
||||
if len(current.snippet) == 0
|
||||
let snippets = zencoding#getResource(type, 'snippets', {})
|
||||
if !empty(snippets) && has_key(snippets, 'zensnippet')
|
||||
let snippet = snippets['zensnippet']
|
||||
let snippets = emmet#getResource(type, 'snippets', {})
|
||||
if !empty(snippets) && has_key(snippets, 'emmet_snippet')
|
||||
let snippet = snippets['emmet_snippet']
|
||||
endif
|
||||
endif
|
||||
if len(snippet) > 0
|
||||
let tmp = snippet
|
||||
let tmp = substitute(tmp, '\${zenname}', current.name, 'g')
|
||||
let tmp = substitute(tmp, '\${emmet_name}', current.name, 'g')
|
||||
let snippet_node = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 0, 'parent': {}, 'value': '{'.tmp.'}', 'pos': 0, 'important': current.important }
|
||||
let str = zencoding#lang#{rtype}#toString(s:zen_settings, snippet_node, type, inline, filters, group_itemno, indent)
|
||||
let str = emmet#lang#{rtype}#toString(s:emmet_settings, snippet_node, type, inline, filters, group_itemno, indent)
|
||||
else
|
||||
if len(current.name)
|
||||
let str .= current.name
|
||||
@@ -198,7 +198,8 @@ function! zencoding#toString(...)
|
||||
if len(current.value)
|
||||
let text = current.value[1:-2]
|
||||
if dollar_expr
|
||||
let text = substitute(text, '\%(\\\)\@\<!\(\$\+\)\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d", max([itemno, group_itemno])+1).submatch(2)', 'g')
|
||||
" TODO: regexp engine specified
|
||||
let text = substitute(text, '\%#=1\%(\\\)\@\<!\(\$\+\)\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d", max([itemno, group_itemno])+1).submatch(2)', 'g')
|
||||
let text = substitute(text, '\${nr}', "\n", 'g')
|
||||
let text = substitute(text, '\\\$', '$', 'g')
|
||||
endif
|
||||
@@ -207,9 +208,9 @@ function! zencoding#toString(...)
|
||||
endif
|
||||
let inner = ''
|
||||
if len(current.child)
|
||||
let render_type = zencoding#getFileType(1)
|
||||
let render_type = emmet#getFileType(1)
|
||||
for n in current.child
|
||||
let inner .= zencoding#toString(n, type, inline, filters, group_itemno, indent)
|
||||
let inner .= emmet#toString(n, type, inline, filters, group_itemno, indent)
|
||||
endfor
|
||||
endif
|
||||
let spaces = matchstr(str, '\s*\ze\${child}')
|
||||
@@ -221,49 +222,49 @@ function! zencoding#toString(...)
|
||||
return str
|
||||
endfunction
|
||||
|
||||
function! zencoding#getSettings()
|
||||
return s:zen_settings
|
||||
function! emmet#getSettings()
|
||||
return s:emmet_settings
|
||||
endfunction
|
||||
|
||||
function! zencoding#getResource(type, name, default)
|
||||
if !has_key(s:zen_settings, a:type)
|
||||
function! emmet#getResource(type, name, default)
|
||||
if !has_key(s:emmet_settings, a:type)
|
||||
return a:default
|
||||
endif
|
||||
let ret = a:default
|
||||
|
||||
if has_key(s:zen_settings[a:type], 'extends')
|
||||
let extends = s:zen_settings[a:type].extends
|
||||
if has_key(s:emmet_settings[a:type], 'extends')
|
||||
let extends = s:emmet_settings[a:type].extends
|
||||
if type(extends) == 1
|
||||
let tmp = split(extends, '\s*,\s*')
|
||||
unlet! extends
|
||||
let extends = tmp
|
||||
endif
|
||||
for ext in extends
|
||||
if has_key(s:zen_settings, ext) && has_key(s:zen_settings[ext], a:name)
|
||||
call zencoding#mergeConfig(ret, s:zen_settings[ext][a:name])
|
||||
if has_key(s:emmet_settings, ext) && has_key(s:emmet_settings[ext], a:name)
|
||||
call emmet#mergeConfig(ret, s:emmet_settings[ext][a:name])
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
if has_key(s:zen_settings[a:type], a:name)
|
||||
let v = s:zen_settings[a:type][a:name]
|
||||
if has_key(s:emmet_settings[a:type], a:name)
|
||||
let v = s:emmet_settings[a:type][a:name]
|
||||
if type(ret) == 3 || type(ret) == 4
|
||||
call zencoding#mergeConfig(ret, s:zen_settings[a:type][a:name])
|
||||
call emmet#mergeConfig(ret, s:emmet_settings[a:type][a:name])
|
||||
else
|
||||
let ret = s:zen_settings[a:type][a:name]
|
||||
let ret = s:emmet_settings[a:type][a:name]
|
||||
endif
|
||||
endif
|
||||
|
||||
return ret
|
||||
endfunction
|
||||
|
||||
function! zencoding#getFileType(...)
|
||||
function! emmet#getFileType(...)
|
||||
let flg = get(a:000, 0, 0)
|
||||
let type = &ft
|
||||
if zencoding#lang#exists(&ft)
|
||||
if emmet#lang#exists(&ft)
|
||||
let type = &ft
|
||||
else
|
||||
let base = zencoding#getBaseType(type)
|
||||
let base = emmet#getBaseType(type)
|
||||
if base != ""
|
||||
if flg
|
||||
let type = &ft
|
||||
@@ -291,7 +292,7 @@ function! zencoding#getFileType(...)
|
||||
return type
|
||||
endfunction
|
||||
|
||||
function! zencoding#getDollarExprs(expand)
|
||||
function! emmet#getDollarExprs(expand)
|
||||
let expand = a:expand
|
||||
let dollar_list = []
|
||||
let dollar_reg = '\%(\\\)\@<!\${\(\([^{}]\|\%(\\\)\@\<=[{}]\)\{}\)}'
|
||||
@@ -302,7 +303,7 @@ function! zencoding#getDollarExprs(expand)
|
||||
if key !~ '^\d\+:'
|
||||
let key = substitute(key, '\\{', '{', 'g')
|
||||
let key = substitute(key, '\\}', '}', 'g')
|
||||
let value = zencoding#getDollarValueByKey(key)
|
||||
let value = emmet#getDollarValueByKey(key)
|
||||
if type(value) == type('')
|
||||
let expr = get(matcharr, 0)
|
||||
call add(dollar_list, {'expr': expr, 'value': value})
|
||||
@@ -316,22 +317,22 @@ function! zencoding#getDollarExprs(expand)
|
||||
return dollar_list
|
||||
endfunction
|
||||
|
||||
function! zencoding#getDollarValueByKey(key)
|
||||
function! emmet#getDollarValueByKey(key)
|
||||
let ret = 0
|
||||
let key = a:key
|
||||
let ftsetting = get(s:zen_settings, zencoding#getFileType())
|
||||
let ftsetting = get(s:emmet_settings, emmet#getFileType())
|
||||
if type(ftsetting) == 4 && has_key(ftsetting, key)
|
||||
let V = get(ftsetting, key)
|
||||
if type(V) == 1 | return V | endif
|
||||
endif
|
||||
if type(ret) != 1 && has_key(s:zen_settings, key)
|
||||
let V = get(s:zen_settings, key)
|
||||
if type(ret) != 1 && has_key(s:emmet_settings, key)
|
||||
let V = get(s:emmet_settings, key)
|
||||
if type(V) == 1 | return V | endif
|
||||
endif
|
||||
if has_key(s:zen_settings, 'custom_expands') && type(s:zen_settings['custom_expands']) == 4
|
||||
for k in keys(s:zen_settings['custom_expands'])
|
||||
if has_key(s:emmet_settings, 'custom_expands') && type(s:emmet_settings['custom_expands']) == 4
|
||||
for k in keys(s:emmet_settings['custom_expands'])
|
||||
if key =~ k
|
||||
let V = get(s:zen_settings['custom_expands'], k)
|
||||
let V = get(s:emmet_settings['custom_expands'], k)
|
||||
if type(V) == 1 | return V | endif
|
||||
if type(V) == 2 | return V(key) | endif
|
||||
endif
|
||||
@@ -340,9 +341,9 @@ function! zencoding#getDollarValueByKey(key)
|
||||
return ret
|
||||
endfunction
|
||||
|
||||
function! zencoding#reExpandDollarExpr(expand, times)
|
||||
function! emmet#reExpandDollarExpr(expand, times)
|
||||
let expand = a:expand
|
||||
let dollar_exprs = zencoding#getDollarExprs(expand)
|
||||
let dollar_exprs = emmet#getDollarExprs(expand)
|
||||
if len(dollar_exprs) > 0
|
||||
if a:times < 9
|
||||
for n in range(len(dollar_exprs))
|
||||
@@ -351,20 +352,20 @@ function! zencoding#reExpandDollarExpr(expand, times)
|
||||
let sub = get(pair, 'value')
|
||||
let expand = substitute(expand, pat, sub, '')
|
||||
endfor
|
||||
return zencoding#reExpandDollarExpr(expand, a:times + 1)
|
||||
return emmet#reExpandDollarExpr(expand, a:times + 1)
|
||||
endif
|
||||
endif
|
||||
return expand
|
||||
endfunction
|
||||
|
||||
function! zencoding#expandDollarExpr(expand)
|
||||
return zencoding#reExpandDollarExpr(a:expand, 0)
|
||||
function! emmet#expandDollarExpr(expand)
|
||||
return emmet#reExpandDollarExpr(a:expand, 0)
|
||||
endfunction
|
||||
|
||||
function! zencoding#expandCursorExpr(expand, mode)
|
||||
function! emmet#expandCursorExpr(expand, mode)
|
||||
let expand = a:expand
|
||||
let type = zencoding#getFileType()
|
||||
let use_pipe_for_cursor = zencoding#getResource(type, 'use_pipe_for_cursor', 1)
|
||||
let type = emmet#getFileType()
|
||||
let use_pipe_for_cursor = emmet#getResource(type, 'use_pipe_for_cursor', 1)
|
||||
if use_pipe_for_cursor
|
||||
let expand = substitute(expand, '|', '${cursor}', 'g')
|
||||
endif
|
||||
@@ -380,22 +381,22 @@ function! zencoding#expandCursorExpr(expand, mode)
|
||||
return expand
|
||||
endfunction
|
||||
|
||||
function! zencoding#unescapeDollarExpr(expand)
|
||||
function! emmet#unescapeDollarExpr(expand)
|
||||
return substitute(a:expand, '\\\$', '$', 'g')
|
||||
endfunction
|
||||
|
||||
function! zencoding#expandAbbr(mode, abbr) range
|
||||
let type = zencoding#getFileType()
|
||||
let rtype = zencoding#getFileType(1)
|
||||
let indent = zencoding#getIndentation(type)
|
||||
function! emmet#expandAbbr(mode, abbr) range
|
||||
let type = emmet#getFileType()
|
||||
let rtype = emmet#getFileType(1)
|
||||
let indent = emmet#getIndentation(type)
|
||||
let expand = ''
|
||||
let filters = ['html']
|
||||
let line = ''
|
||||
let part = ''
|
||||
let rest = ''
|
||||
|
||||
if has_key(s:zen_settings, type) && has_key(s:zen_settings[type], 'filters')
|
||||
let filters = split(s:zen_settings[type].filters, '\s*,\s*')
|
||||
if has_key(s:emmet_settings, type) && has_key(s:emmet_settings[type], 'filters')
|
||||
let filters = split(s:emmet_settings[type].filters, '\s*,\s*')
|
||||
endif
|
||||
|
||||
if a:mode == 2
|
||||
@@ -413,16 +414,16 @@ function! zencoding#expandAbbr(mode, abbr) range
|
||||
if query !~ '}\s*$'
|
||||
let query .= '>{$#}'
|
||||
endif
|
||||
if zencoding#useFilter(filters, '/')
|
||||
let spl = zencoding#splitFilterArg(filters)
|
||||
if emmet#useFilter(filters, '/')
|
||||
let spl = emmet#splitFilterArg(filters)
|
||||
let fline = getline(a:firstline)
|
||||
let query = substitute(query, '>\{0,1}{\$#}\s*$', '{\\$column\\$}*' . len(split(fline, spl)), '')
|
||||
endif
|
||||
let items = zencoding#parseIntoTree(query, type).child
|
||||
let items = emmet#parseIntoTree(query, type).child
|
||||
for item in items
|
||||
let expand .= zencoding#toString(item, type, 0, filters, 0, indent)
|
||||
let expand .= emmet#toString(item, type, 0, filters, 0, indent)
|
||||
endfor
|
||||
if zencoding#useFilter(filters, 'e')
|
||||
if emmet#useFilter(filters, 'e')
|
||||
let expand = substitute(expand, '&', '\&', 'g')
|
||||
let expand = substitute(expand, '<', '\<', 'g')
|
||||
let expand = substitute(expand, '>', '\>', 'g')
|
||||
@@ -432,11 +433,11 @@ function! zencoding#expandAbbr(mode, abbr) range
|
||||
for n in range(a:firstline, a:lastline)
|
||||
let lline = getline(n)
|
||||
let lpart = substitute(lline, '^\s\+', '', '')
|
||||
if zencoding#useFilter(filters, 't')
|
||||
if emmet#useFilter(filters, 't')
|
||||
let lpart = substitute(lpart, '^[0-9.-]\+\s\+', '', '')
|
||||
let lpart = substitute(lpart, '\s\+$', '', '')
|
||||
endif
|
||||
if zencoding#useFilter(filters, '/')
|
||||
if emmet#useFilter(filters, '/')
|
||||
for column in split(lpart, spl)
|
||||
let expand = substitute(expand, '\$column\$', '\=column', '')
|
||||
endfor
|
||||
@@ -465,19 +466,19 @@ function! zencoding#expandAbbr(mode, abbr) range
|
||||
endif
|
||||
endfor
|
||||
let leader .= (str =~ "\n" ? ">{\n" : "{") . str . "}"
|
||||
let items = zencoding#parseIntoTree(leader, type).child
|
||||
let items = emmet#parseIntoTree(leader, type).child
|
||||
else
|
||||
let save_regcont = @"
|
||||
let save_regtype = getregtype('"')
|
||||
silent! normal! gvygv
|
||||
let str = @"
|
||||
call setreg('"', save_regcont, save_regtype)
|
||||
let items = zencoding#parseIntoTree(leader . "{".str."}", type).child
|
||||
let items = emmet#parseIntoTree(leader . "{".str."}", type).child
|
||||
endif
|
||||
for item in items
|
||||
let expand .= zencoding#toString(item, type, 0, filters, 0, '')
|
||||
let expand .= emmet#toString(item, type, 0, filters, 0, '')
|
||||
endfor
|
||||
if zencoding#useFilter(filters, 'e')
|
||||
if emmet#useFilter(filters, 'e')
|
||||
let expand = substitute(expand, '&', '\&', 'g')
|
||||
let expand = substitute(expand, '<', '\<', 'g')
|
||||
let expand = substitute(expand, '>', '\>', 'g')
|
||||
@@ -492,7 +493,7 @@ function! zencoding#expandAbbr(mode, abbr) range
|
||||
call setline('.', spaces.a:abbr)
|
||||
endif
|
||||
normal! $
|
||||
call zencoding#expandAbbr(0, "")
|
||||
call emmet#expandAbbr(0, "")
|
||||
return
|
||||
else
|
||||
let line = getline('.')
|
||||
@@ -503,8 +504,8 @@ function! zencoding#expandAbbr(mode, abbr) range
|
||||
let part = matchstr(line, '\([a-zA-Z0-9:_\-\@|]\+\)$')
|
||||
else
|
||||
let part = matchstr(line, '\(\S.*\)$')
|
||||
let ftype = zencoding#lang#exists(type) ? type : 'html'
|
||||
let part = zencoding#lang#{ftype}#findTokens(part)
|
||||
let ftype = emmet#lang#exists(type) ? type : 'html'
|
||||
let part = emmet#lang#{ftype}#findTokens(part)
|
||||
endif
|
||||
let rest = getline('.')[len(line):]
|
||||
let str = part
|
||||
@@ -513,27 +514,27 @@ function! zencoding#expandAbbr(mode, abbr) range
|
||||
let filters = split(matchstr(str, mx)[1:], '\s*,\s*')
|
||||
let str = substitute(str, mx, '', '')
|
||||
endif
|
||||
let items = zencoding#parseIntoTree(str, rtype).child
|
||||
let items = emmet#parseIntoTree(str, rtype).child
|
||||
for item in items
|
||||
let expand .= zencoding#toString(item, rtype, 0, filters, 0, indent)
|
||||
let expand .= emmet#toString(item, rtype, 0, filters, 0, indent)
|
||||
endfor
|
||||
if zencoding#useFilter(filters, 'e')
|
||||
if emmet#useFilter(filters, 'e')
|
||||
let expand = substitute(expand, '&', '\&', 'g')
|
||||
let expand = substitute(expand, '<', '\<', 'g')
|
||||
let expand = substitute(expand, '>', '\>', 'g')
|
||||
endif
|
||||
let expand = substitute(expand, '\$line\([0-9]\+\)\$', '\=submatch(1)', 'g')
|
||||
endif
|
||||
let expand = zencoding#expandDollarExpr(expand)
|
||||
let expand = zencoding#expandCursorExpr(expand, a:mode)
|
||||
let expand = emmet#expandDollarExpr(expand)
|
||||
let expand = emmet#expandCursorExpr(expand, a:mode)
|
||||
if len(expand)
|
||||
if has_key(s:zen_settings, 'timezone') && len(s:zen_settings.timezone)
|
||||
let expand = substitute(expand, '${datetime}', strftime("%Y-%m-%dT%H:%M:%S") . s:zen_settings.timezone, 'g')
|
||||
if has_key(s:emmet_settings, 'timezone') && len(s:emmet_settings.timezone)
|
||||
let expand = substitute(expand, '${datetime}', strftime("%Y-%m-%dT%H:%M:%S") . s:emmet_settings.timezone, 'g')
|
||||
else
|
||||
" TODO: on windows, %z/%Z is 'Tokyo(Standard)'
|
||||
let expand = substitute(expand, '${datetime}', strftime("%Y-%m-%dT%H:%M:%S %z"), 'g')
|
||||
endif
|
||||
let expand = zencoding#unescapeDollarExpr(expand)
|
||||
let expand = emmet#unescapeDollarExpr(expand)
|
||||
if a:mode == 2 && visualmode() ==# 'v'
|
||||
if a:firstline == a:lastline
|
||||
let expand = substitute(expand, '\n\s*', '', 'g')
|
||||
@@ -577,115 +578,115 @@ function! zencoding#expandAbbr(mode, abbr) range
|
||||
silent! exe "normal! v7h\"_s"
|
||||
let &selection = oldselection
|
||||
endif
|
||||
if g:zencoding_debug > 1
|
||||
if g:emmet_debug > 1
|
||||
call getchar()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! zencoding#moveNextPrev(flag)
|
||||
let type = zencoding#getFileType()
|
||||
let rtype = zencoding#lang#exists(type) ? type : 'html'
|
||||
return zencoding#lang#{rtype}#moveNextPrev(a:flag)
|
||||
function! emmet#moveNextPrev(flag)
|
||||
let type = emmet#getFileType()
|
||||
let rtype = emmet#lang#exists(type) ? type : 'html'
|
||||
return emmet#lang#{rtype}#moveNextPrev(a:flag)
|
||||
endfunction
|
||||
|
||||
function! zencoding#imageSize()
|
||||
let type = zencoding#getFileType()
|
||||
let rtype = zencoding#lang#exists(type) ? type : 'html'
|
||||
return zencoding#lang#{rtype}#imageSize()
|
||||
function! emmet#imageSize()
|
||||
let type = emmet#getFileType()
|
||||
let rtype = emmet#lang#exists(type) ? type : 'html'
|
||||
return emmet#lang#{rtype}#imageSize()
|
||||
endfunction
|
||||
|
||||
function! zencoding#encodeImage()
|
||||
let type = zencoding#getFileType()
|
||||
let rtype = zencoding#lang#exists(type) ? type : 'html'
|
||||
return zencoding#lang#{rtype}#encodeImage()
|
||||
function! emmet#encodeImage()
|
||||
let type = emmet#getFileType()
|
||||
let rtype = emmet#lang#exists(type) ? type : 'html'
|
||||
return emmet#lang#{rtype}#encodeImage()
|
||||
endfunction
|
||||
|
||||
function! zencoding#toggleComment()
|
||||
let type = zencoding#getFileType()
|
||||
let rtype = zencoding#lang#exists(type) ? type : 'html'
|
||||
return zencoding#lang#{rtype}#toggleComment()
|
||||
function! emmet#toggleComment()
|
||||
let type = emmet#getFileType()
|
||||
let rtype = emmet#lang#exists(type) ? type : 'html'
|
||||
return emmet#lang#{rtype}#toggleComment()
|
||||
endfunction
|
||||
|
||||
function! zencoding#balanceTag(flag) range
|
||||
let type = zencoding#getFileType()
|
||||
let rtype = zencoding#lang#exists(type) ? type : 'html'
|
||||
return zencoding#lang#{rtype}#balanceTag(a:flag)
|
||||
function! emmet#balanceTag(flag) range
|
||||
let type = emmet#getFileType()
|
||||
let rtype = emmet#lang#exists(type) ? type : 'html'
|
||||
return emmet#lang#{rtype}#balanceTag(a:flag)
|
||||
endfunction
|
||||
|
||||
function! zencoding#splitJoinTag()
|
||||
let type = zencoding#getFileType()
|
||||
let rtype = zencoding#lang#exists(type) ? type : 'html'
|
||||
return zencoding#lang#{rtype}#splitJoinTag()
|
||||
function! emmet#splitJoinTag()
|
||||
let type = emmet#getFileType()
|
||||
let rtype = emmet#lang#exists(type) ? type : 'html'
|
||||
return emmet#lang#{rtype}#splitJoinTag()
|
||||
endfunction
|
||||
|
||||
function! zencoding#mergeLines() range
|
||||
function! emmet#mergeLines() range
|
||||
let lines = join(map(getline(a:firstline, a:lastline), 'matchstr(v:val, "^\\s*\\zs.*\\ze\\s*$")'), '')
|
||||
let indent = substitute(getline('.'), '^\(\s*\).*', '\1', '')
|
||||
silent! exe "normal! gvc"
|
||||
call setline('.', indent . lines)
|
||||
endfunction
|
||||
|
||||
function! zencoding#removeTag()
|
||||
let type = zencoding#getFileType()
|
||||
let rtype = zencoding#lang#exists(type) ? type : 'html'
|
||||
return zencoding#lang#{rtype}#removeTag()
|
||||
function! emmet#removeTag()
|
||||
let type = emmet#getFileType()
|
||||
let rtype = emmet#lang#exists(type) ? type : 'html'
|
||||
return emmet#lang#{rtype}#removeTag()
|
||||
endfunction
|
||||
|
||||
function! zencoding#anchorizeURL(flag)
|
||||
function! emmet#anchorizeURL(flag)
|
||||
let mx = 'https\=:\/\/[-!#$%&*+,./:;=?@0-9a-zA-Z_~]\+'
|
||||
let pos1 = searchpos(mx, 'bcnW')
|
||||
let url = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
|
||||
let block = [pos1, [pos1[0], pos1[1] + len(url) - 1]]
|
||||
if !zencoding#util#cursorInRegion(block)
|
||||
if !emmet#util#cursorInRegion(block)
|
||||
return
|
||||
endif
|
||||
|
||||
let mx = '.*<title[^>]*>\s*\zs\([^<]\+\)\ze\s*<\/title[^>]*>.*'
|
||||
let content = zencoding#util#getContentFromURL(url)
|
||||
let content = emmet#util#getContentFromURL(url)
|
||||
let content = substitute(content, '\r', '', 'g')
|
||||
let content = substitute(content, '[ \n]\+', ' ', 'g')
|
||||
let content = substitute(content, '<!--.\{-}-->', '', 'g')
|
||||
let title = matchstr(content, mx)
|
||||
|
||||
let type = zencoding#getFileType()
|
||||
let rtype = zencoding#lang#exists(type) ? type : 'html'
|
||||
let type = emmet#getFileType()
|
||||
let rtype = emmet#lang#exists(type) ? type : 'html'
|
||||
if a:flag == 0
|
||||
let a = zencoding#lang#html#parseTag('<a>')
|
||||
let a = emmet#lang#html#parseTag('<a>')
|
||||
let a.attr.href = url
|
||||
let a.value = '{' . title . '}'
|
||||
let expand = zencoding#toString(a, rtype, 0, [])
|
||||
let expand = emmet#toString(a, rtype, 0, [])
|
||||
let expand = substitute(expand, '\${cursor}', '', 'g')
|
||||
else
|
||||
let body = zencoding#util#getTextFromHTML(content)
|
||||
let body = emmet#util#getTextFromHTML(content)
|
||||
let body = '{' . substitute(body, '^\(.\{0,100}\).*', '\1', '') . '...}'
|
||||
|
||||
let blockquote = zencoding#lang#html#parseTag('<blockquote class="quote">')
|
||||
let a = zencoding#lang#html#parseTag('<a>')
|
||||
let blockquote = emmet#lang#html#parseTag('<blockquote class="quote">')
|
||||
let a = emmet#lang#html#parseTag('<a>')
|
||||
let a.attr.href = url
|
||||
let a.value = '{' . title . '}'
|
||||
call add(blockquote.child, a)
|
||||
call add(blockquote.child, zencoding#lang#html#parseTag('<br/>'))
|
||||
let p = zencoding#lang#html#parseTag('<p>')
|
||||
call add(blockquote.child, emmet#lang#html#parseTag('<br/>'))
|
||||
let p = emmet#lang#html#parseTag('<p>')
|
||||
let p.value = body
|
||||
call add(blockquote.child, p)
|
||||
let cite = zencoding#lang#html#parseTag('<cite>')
|
||||
let cite = emmet#lang#html#parseTag('<cite>')
|
||||
let cite.value = '{' . url . '}'
|
||||
call add(blockquote.child, cite)
|
||||
let expand = zencoding#toString(blockquote, rtype, 0, [])
|
||||
let expand = emmet#toString(blockquote, rtype, 0, [])
|
||||
let expand = substitute(expand, '\${cursor}', '', 'g')
|
||||
endif
|
||||
let indent = substitute(getline('.'), '^\(\s*\).*', '\1', '')
|
||||
let expand = substitute(expand, "\n", "\n" . indent, 'g')
|
||||
call zencoding#util#setContent(block, expand)
|
||||
call emmet#util#setContent(block, expand)
|
||||
endfunction
|
||||
|
||||
function! zencoding#codePretty() range
|
||||
function! emmet#codePretty() range
|
||||
let type = input('FileType: ', &ft, 'filetype')
|
||||
if len(type) == 0
|
||||
return
|
||||
endif
|
||||
let block = zencoding#util#getVisualBlock()
|
||||
let content = zencoding#util#getContent(block)
|
||||
let block = emmet#util#getVisualBlock()
|
||||
let content = emmet#util#getContent(block)
|
||||
silent! 1new
|
||||
let &l:filetype = type
|
||||
call setline(1, split(content, "\n"))
|
||||
@@ -697,50 +698,50 @@ function! zencoding#codePretty() range
|
||||
silent! bw!
|
||||
silent! bw!
|
||||
let content = matchstr(content, '<body[^>]*>[\s\n]*\zs.*\ze</body>')
|
||||
call zencoding#util#setContent(block, content)
|
||||
call emmet#util#setContent(block, content)
|
||||
endfunction
|
||||
|
||||
function! zencoding#ExpandWord(abbr, type, orig)
|
||||
function! emmet#ExpandWord(abbr, type, orig)
|
||||
let mx = '|\(\%(html\|haml\|slim\|e\|c\|fc\|xsl\|t\|\/[^ ]\+\)\s*,\{0,1}\s*\)*$'
|
||||
let str = a:abbr
|
||||
let type = a:type
|
||||
let indent = zencoding#getIndentation(type)
|
||||
let indent = emmet#getIndentation(type)
|
||||
|
||||
if len(type) == 0 | let type = 'html' | endif
|
||||
if str =~ mx
|
||||
let filters = split(matchstr(str, mx)[1:], '\s*,\s*')
|
||||
let str = substitute(str, mx, '', '')
|
||||
elseif has_key(s:zen_settings[a:type], 'filters')
|
||||
let filters = split(s:zen_settings[a:type].filters, '\s*,\s*')
|
||||
elseif has_key(s:emmet_settings[a:type], 'filters')
|
||||
let filters = split(s:emmet_settings[a:type].filters, '\s*,\s*')
|
||||
else
|
||||
let filters = ['html']
|
||||
endif
|
||||
let items = zencoding#parseIntoTree(str, a:type).child
|
||||
let items = emmet#parseIntoTree(str, a:type).child
|
||||
let expand = ''
|
||||
for item in items
|
||||
let expand .= zencoding#toString(item, a:type, 0, filters, 0, indent)
|
||||
let expand .= emmet#toString(item, a:type, 0, filters, 0, indent)
|
||||
endfor
|
||||
if zencoding#useFilter(filters, 'e')
|
||||
if emmet#useFilter(filters, 'e')
|
||||
let expand = substitute(expand, '&', '\&', 'g')
|
||||
let expand = substitute(expand, '<', '\<', 'g')
|
||||
let expand = substitute(expand, '>', '\>', 'g')
|
||||
endif
|
||||
if a:orig == 0
|
||||
let expand = zencoding#expandDollarExpr(expand)
|
||||
let expand = emmet#expandDollarExpr(expand)
|
||||
let expand = substitute(expand, '\${cursor}', '', 'g')
|
||||
endif
|
||||
return expand
|
||||
endfunction
|
||||
|
||||
function! zencoding#getSnippets(type)
|
||||
function! emmet#getSnippets(type)
|
||||
let type = a:type
|
||||
if len(type) == 0 || !has_key(s:zen_settings, type)
|
||||
if len(type) == 0 || !has_key(s:emmet_settings, type)
|
||||
let type = 'html'
|
||||
endif
|
||||
return zencoding#getResource(type, 'snippets', {})
|
||||
return emmet#getResource(type, 'snippets', {})
|
||||
endfunction
|
||||
|
||||
function! zencoding#CompleteTag(findstart, base)
|
||||
function! emmet#CompleteTag(findstart, base)
|
||||
if a:findstart
|
||||
let line = getline('.')
|
||||
let start = col('.') - 1
|
||||
@@ -749,16 +750,16 @@ function! zencoding#CompleteTag(findstart, base)
|
||||
endwhile
|
||||
return start
|
||||
else
|
||||
let type = zencoding#getFileType()
|
||||
let type = emmet#getFileType()
|
||||
let res = []
|
||||
|
||||
let snippets = zencoding#getResource(type, 'snippets', {})
|
||||
let snippets = emmet#getResource(type, 'snippets', {})
|
||||
for item in keys(snippets)
|
||||
if stridx(item, a:base) != -1
|
||||
call add(res, substitute(item, '\${cursor}\||', '', 'g'))
|
||||
endif
|
||||
endfor
|
||||
let aliases = zencoding#getResource(type, 'aliases', {})
|
||||
let aliases = emmet#getResource(type, 'aliases', {})
|
||||
for item in values(aliases)
|
||||
if stridx(item, a:base) != -1
|
||||
call add(res, substitute(item, '\${cursor}\||', '', 'g'))
|
||||
@@ -768,12 +769,12 @@ function! zencoding#CompleteTag(findstart, base)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
unlet! s:zen_settings
|
||||
let s:zen_settings = {
|
||||
unlet! s:emmet_settings
|
||||
let s:emmet_settings = {
|
||||
\ 'lang': "en",
|
||||
\ 'charset': "UTF-8",
|
||||
\ 'custom_expands' : {
|
||||
\ '^\%(lorem\|lipsum\)\(\d*\)$' : function('zencoding#lorem#en#expand'),
|
||||
\ '^\%(lorem\|lipsum\)\(\d*\)$' : function('emmet#lorem#en#expand'),
|
||||
\ },
|
||||
\ 'css': {
|
||||
\ 'snippets': {
|
||||
@@ -1275,6 +1276,7 @@ let s:zen_settings = {
|
||||
\ 'extends': 'css',
|
||||
\ },
|
||||
\ 'html': {
|
||||
\ 'indentation': "\t",
|
||||
\ 'snippets': {
|
||||
\ 'cc:ie6': "<!--[if lte IE 6]>\n\t${child}|\n<![endif]-->",
|
||||
\ 'cc:ie': "<!--[if IE]>\n\t${child}|\n<![endif]-->",
|
||||
@@ -1563,8 +1565,8 @@ let s:zen_settings = {
|
||||
\ }
|
||||
\}
|
||||
|
||||
if exists('g:user_zen_settings')
|
||||
call zencoding#mergeConfig(s:zen_settings, g:user_zen_settings)
|
||||
if exists('g:user_emmet_settings')
|
||||
call emmet#mergeConfig(s:emmet_settings, g:user_emmet_settings)
|
||||
endif
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
@@ -1,11 +1,11 @@
|
||||
let s:exists = {}
|
||||
function zencoding#lang#exists(type)
|
||||
function! emmet#lang#exists(type)
|
||||
if len(a:type) == 0
|
||||
return 0
|
||||
elseif has_key(s:exists, a:type)
|
||||
return s:exists[a:type]
|
||||
endif
|
||||
let s:exists[a:type] = len(globpath(&rtp, 'autoload/zencoding/lang/'.a:type.'.vim')) > 0
|
||||
let s:exists[a:type] = len(globpath(&rtp, 'autoload/emmet/lang/'.a:type.'.vim')) > 0
|
||||
return s:exists[a:type]
|
||||
endfunction
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
function! zencoding#lang#css#findTokens(str)
|
||||
function! emmet#lang#css#findTokens(str)
|
||||
return substitute(a:str, '^.*[;{]\s*', '', '')
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#css#parseIntoTree(abbr, type)
|
||||
function! emmet#lang#css#parseIntoTree(abbr, type)
|
||||
let abbr = a:abbr
|
||||
let type = a:type
|
||||
let prefix = 0
|
||||
let value = ''
|
||||
|
||||
let settings = zencoding#getSettings()
|
||||
let indent = zencoding#getIndentation(type)
|
||||
let aliases = zencoding#getResource(type, 'aliases', {})
|
||||
let snippets = zencoding#getResource(type, 'snippets', {})
|
||||
let use_pipe_for_cursor = zencoding#getResource(type, 'use_pipe_for_cursor', 1)
|
||||
let settings = emmet#getSettings()
|
||||
let indent = emmet#getIndentation(type)
|
||||
let aliases = emmet#getResource(type, 'aliases', {})
|
||||
let snippets = emmet#getResource(type, 'snippets', {})
|
||||
let use_pipe_for_cursor = emmet#getResource(type, 'use_pipe_for_cursor', 1)
|
||||
|
||||
let root = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'pos': 0, 'important': 0 }
|
||||
|
||||
@@ -115,10 +115,10 @@ function! zencoding#lang#css#parseIntoTree(abbr, type)
|
||||
return root
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#css#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
function! emmet#lang#css#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
let current = a:current
|
||||
let value = current.value[1:-2]
|
||||
if zencoding#useFilter(a:filters, 'fc')
|
||||
if emmet#useFilter(a:filters, 'fc')
|
||||
let value = substitute(value, '\([^:]\+\):\([^;]*;\)', '\1: \2', 'g')
|
||||
else
|
||||
let value = substitute(value, '\([^:]\+\):\([^;]*;\)', '\1:\2', 'g')
|
||||
@@ -129,25 +129,25 @@ function! zencoding#lang#css#toString(settings, current, type, inline, filters,
|
||||
return value
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#css#imageSize()
|
||||
function! emmet#lang#css#imageSize()
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#css#encodeImage()
|
||||
function! emmet#lang#css#encodeImage()
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#css#parseTag(tag)
|
||||
function! emmet#lang#css#parseTag(tag)
|
||||
return {}
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#css#toggleComment()
|
||||
function! emmet#lang#css#toggleComment()
|
||||
let line = getline('.')
|
||||
let mx = '^\(\s*\)/\*\s*\(.*\)\s*\*/\s*$'
|
||||
if line =~ '{\s*$'
|
||||
let block = zencoding#util#searchRegion('/\*', '\*/\zs')
|
||||
if zencoding#util#regionIsValid(block)
|
||||
let content = zencoding#util#getContent(block)
|
||||
let block = emmet#util#searchRegion('/\*', '\*/\zs')
|
||||
if emmet#util#regionIsValid(block)
|
||||
let content = emmet#util#getContent(block)
|
||||
let content = substitute(content, '/\*\s\(.*\)\s\*/', '\1', '')
|
||||
call zencoding#util#setContent(block, content)
|
||||
call emmet#util#setContent(block, content)
|
||||
else
|
||||
let node = expand('<cword>')
|
||||
if len(node)
|
||||
@@ -167,28 +167,28 @@ function! zencoding#lang#css#toggleComment()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#css#balanceTag(flag) range
|
||||
function! emmet#lang#css#balanceTag(flag) range
|
||||
if a:flag == -2 || a:flag == 2
|
||||
let curpos = [0, line("'<"), col("'<"), 0]
|
||||
else
|
||||
let curpos = getpos('.')
|
||||
endif
|
||||
let block = zencoding#util#getVisualBlock()
|
||||
if !zencoding#util#regionIsValid(block)
|
||||
let block = emmet#util#getVisualBlock()
|
||||
if !emmet#util#regionIsValid(block)
|
||||
if a:flag > 0
|
||||
let block = zencoding#util#searchRegion('^', ';')
|
||||
if zencoding#util#regionIsValid(block)
|
||||
call zencoding#util#selectRegion(block)
|
||||
let block = emmet#util#searchRegion('^', ';')
|
||||
if emmet#util#regionIsValid(block)
|
||||
call emmet#util#selectRegion(block)
|
||||
return
|
||||
endif
|
||||
endif
|
||||
else
|
||||
if a:flag > 0
|
||||
let content = zencoding#util#getContent(block)
|
||||
let content = emmet#util#getContent(block)
|
||||
if content !~ '^{.*}$'
|
||||
let block = zencoding#util#searchRegion('{', '}')
|
||||
if zencoding#util#regionIsValid(block)
|
||||
call zencoding#util#selectRegion(block)
|
||||
let block = emmet#util#searchRegion('{', '}')
|
||||
if emmet#util#regionIsValid(block)
|
||||
call emmet#util#selectRegion(block)
|
||||
return
|
||||
endif
|
||||
endif
|
||||
@@ -196,9 +196,9 @@ function! zencoding#lang#css#balanceTag(flag) range
|
||||
let pos = searchpos('.*;', 'nW')
|
||||
if pos[0] != 0
|
||||
call setpos('.', [0, pos[0], pos[1], 0])
|
||||
let block = zencoding#util#searchRegion('^', ';')
|
||||
if zencoding#util#regionIsValid(block)
|
||||
call zencoding#util#selectRegion(block)
|
||||
let block = emmet#util#searchRegion('^', ';')
|
||||
if emmet#util#regionIsValid(block)
|
||||
call emmet#util#selectRegion(block)
|
||||
return
|
||||
endif
|
||||
endif
|
||||
@@ -211,7 +211,7 @@ function! zencoding#lang#css#balanceTag(flag) range
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#css#moveNextPrev(flag)
|
||||
function! emmet#lang#css#moveNextPrev(flag)
|
||||
let pos = search('""\|()\|\(:\s*\zs$\)', a:flag ? 'Wbp' : 'Wp')
|
||||
if pos == 2
|
||||
startinsert!
|
||||
@@ -221,10 +221,10 @@ function! zencoding#lang#css#moveNextPrev(flag)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#css#splitJoinTag()
|
||||
function! emmet#lang#css#splitJoinTag()
|
||||
" nothing to do
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#css#removeTag()
|
||||
function! emmet#lang#css#removeTag()
|
||||
" nothing to do
|
||||
endfunction
|
||||
@@ -1,20 +1,20 @@
|
||||
function! zencoding#lang#haml#findTokens(str)
|
||||
return zencoding#lang#html#findTokens(a:str)
|
||||
function! emmet#lang#haml#findTokens(str)
|
||||
return emmet#lang#html#findTokens(a:str)
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#haml#parseIntoTree(abbr, type)
|
||||
return zencoding#lang#html#parseIntoTree(a:abbr, a:type)
|
||||
function! emmet#lang#haml#parseIntoTree(abbr, type)
|
||||
return emmet#lang#html#parseIntoTree(a:abbr, a:type)
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#haml#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
function! emmet#lang#haml#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
let settings = a:settings
|
||||
let current = a:current
|
||||
let type = a:type
|
||||
let inline = a:inline
|
||||
let filters = a:filters
|
||||
let itemno = a:itemno
|
||||
let indent = zencoding#getIndentation(type)
|
||||
let dollar_expr = zencoding#getResource(type, 'dollar_expr', 1)
|
||||
let indent = emmet#getIndentation(type)
|
||||
let dollar_expr = emmet#getResource(type, 'dollar_expr', 1)
|
||||
let str = ""
|
||||
|
||||
let comment_indent = ''
|
||||
@@ -26,7 +26,7 @@ function! zencoding#lang#haml#toString(settings, current, type, inline, filters,
|
||||
if len(current.name) > 0
|
||||
let str .= '%' . current_name
|
||||
let tmp = ''
|
||||
for attr in zencoding#util#unique(current.attrs_order + keys(current.attr))
|
||||
for attr in emmet#util#unique(current.attrs_order + keys(current.attr))
|
||||
if !has_key(current.attr, attr)
|
||||
continue
|
||||
endif
|
||||
@@ -92,7 +92,7 @@ function! zencoding#lang#haml#toString(settings, current, type, inline, filters,
|
||||
endif
|
||||
elseif len(current.child) > 0
|
||||
for child in current.child
|
||||
let inner .= zencoding#toString(child, type, inline, filters, itemno, indent)
|
||||
let inner .= emmet#toString(child, type, inline, filters, itemno, indent)
|
||||
endfor
|
||||
let inner = substitute(inner, "\n", "\n" . escape(indent, '\'), 'g')
|
||||
let inner = substitute(inner, "\n" . escape(indent, '\') . "$", "", 'g')
|
||||
@@ -110,9 +110,9 @@ function! zencoding#lang#haml#toString(settings, current, type, inline, filters,
|
||||
return str
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#haml#imageSize()
|
||||
function! emmet#lang#haml#imageSize()
|
||||
let line = getline('.')
|
||||
let current = zencoding#lang#haml#parseTag(line)
|
||||
let current = emmet#lang#haml#parseTag(line)
|
||||
if empty(current) || !has_key(current.attr, 'src')
|
||||
return
|
||||
endif
|
||||
@@ -123,22 +123,22 @@ function! zencoding#lang#haml#imageSize()
|
||||
let fn = simplify(expand('%:h') . '/' . fn)
|
||||
endif
|
||||
|
||||
let [width, height] = zencoding#util#getImageSize(fn)
|
||||
let [width, height] = emmet#util#getImageSize(fn)
|
||||
if width == -1 && height == -1
|
||||
return
|
||||
endif
|
||||
let current.attr.width = width
|
||||
let current.attr.height = height
|
||||
let current.attrs_order += ['width', 'height']
|
||||
let haml = zencoding#toString(current, 'haml', 1)
|
||||
let haml = emmet#toString(current, 'haml', 1)
|
||||
let haml = substitute(haml, '\${cursor}', '', '')
|
||||
call setline('.', substitute(matchstr(line, '^\s*') . haml, "\n", "", "g"))
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#haml#encodeImage()
|
||||
function! emmet#lang#haml#encodeImage()
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#haml#parseTag(tag)
|
||||
function! emmet#lang#haml#parseTag(tag)
|
||||
let current = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'pos': 0, 'attrs_order': [] }
|
||||
let mx = '%\([a-zA-Z][a-zA-Z0-9]*\)\s*\%({\(.*\)}\)'
|
||||
let match = matchstr(a:tag, mx)
|
||||
@@ -160,7 +160,7 @@ function! zencoding#lang#haml#parseTag(tag)
|
||||
return current
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#haml#toggleComment()
|
||||
function! emmet#lang#haml#toggleComment()
|
||||
let line = getline('.')
|
||||
let space = matchstr(line, '^\s*')
|
||||
if line =~ '^\s*-#'
|
||||
@@ -170,8 +170,8 @@ function! zencoding#lang#haml#toggleComment()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#haml#balanceTag(flag) range
|
||||
let block = zencoding#util#getVisualBlock()
|
||||
function! emmet#lang#haml#balanceTag(flag) range
|
||||
let block = emmet#util#getVisualBlock()
|
||||
if a:flag == -2 || a:flag == 2
|
||||
let curpos = [0, line("'<"), col("'<"), 0]
|
||||
else
|
||||
@@ -181,7 +181,7 @@ function! zencoding#lang#haml#balanceTag(flag) range
|
||||
let ml = len(matchstr(getline(n), '^\s*'))
|
||||
|
||||
if a:flag > 0
|
||||
if a:flag == 1 || !zencoding#util#regionIsValid(block)
|
||||
if a:flag == 1 || !emmet#util#regionIsValid(block)
|
||||
let n = line('.')
|
||||
else
|
||||
while n > 0
|
||||
@@ -235,7 +235,7 @@ function! zencoding#lang#haml#balanceTag(flag) range
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#haml#moveNextPrev(flag)
|
||||
function! emmet#lang#haml#moveNextPrev(flag)
|
||||
let pos = search('""', a:flag ? 'Wb' : 'W')
|
||||
if pos != 0
|
||||
silent! normal! l
|
||||
@@ -243,7 +243,7 @@ function! zencoding#lang#haml#moveNextPrev(flag)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#haml#splitJoinTag()
|
||||
function! emmet#lang#haml#splitJoinTag()
|
||||
let n = line('.')
|
||||
let sml = len(matchstr(getline(n), '^\s*%[a-z]'))
|
||||
while n > 0
|
||||
@@ -268,7 +268,7 @@ function! zencoding#lang#haml#splitJoinTag()
|
||||
else
|
||||
let tag = matchstr(getline(sn), '^\s*%\zs\(\w\+\)')
|
||||
let spaces = matchstr(getline(sn), '^\s*')
|
||||
let settings = zencoding#getSettings()
|
||||
let settings = emmet#getSettings()
|
||||
if stridx(','.settings.html.inline_elements.',', ','.tag.',') == -1
|
||||
call append(sn, spaces . ' ')
|
||||
call setpos('.', [0, sn+1, 1, 0])
|
||||
@@ -283,7 +283,7 @@ function! zencoding#lang#haml#splitJoinTag()
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#haml#removeTag()
|
||||
function! emmet#lang#haml#removeTag()
|
||||
let n = line('.')
|
||||
let ml = 0
|
||||
while n > 0
|
||||
@@ -12,7 +12,7 @@ let s:mx = '\([+>]\|[<^]\+\)\{-}\s*'
|
||||
\ .'\%(\*\([0-9]\+\)\)\{0,1}'
|
||||
\ .'\(\%()\%(\*[0-9]\+\)\{0,1}\)*\)'
|
||||
|
||||
function! zencoding#lang#html#findTokens(str)
|
||||
function! emmet#lang#html#findTokens(str)
|
||||
let str = a:str
|
||||
let [pos, last_pos] = [0, 0]
|
||||
while 1
|
||||
@@ -37,24 +37,24 @@ function! zencoding#lang#html#findTokens(str)
|
||||
return a:str[last_pos :-1]
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#html#parseIntoTree(abbr, type)
|
||||
function! emmet#lang#html#parseIntoTree(abbr, type)
|
||||
let abbr = a:abbr
|
||||
let type = a:type
|
||||
|
||||
let settings = zencoding#getSettings()
|
||||
let settings = emmet#getSettings()
|
||||
if !has_key(settings, type)
|
||||
let type = 'html'
|
||||
endif
|
||||
if len(type) == 0 | let type = 'html' | endif
|
||||
|
||||
let settings = zencoding#getSettings()
|
||||
let indent = zencoding#getIndentation(type)
|
||||
let settings = emmet#getSettings()
|
||||
let indent = emmet#getIndentation(type)
|
||||
|
||||
" try 'foo' to (foo-x)
|
||||
let rabbr = zencoding#getExpandos(type, abbr)
|
||||
let rabbr = emmet#getExpandos(type, abbr)
|
||||
if rabbr == abbr
|
||||
" try 'foo+(' to (foo-x)
|
||||
let rabbr = substitute(abbr, '\%(+\|^\)\([a-zA-Z][a-zA-Z0-9+]\+\)+\([(){}>]\|$\)', '\="(".zencoding#getExpandos(type, submatch(1)).")".submatch(2)', 'i')
|
||||
let rabbr = substitute(abbr, '\%(+\|^\)\([a-zA-Z][a-zA-Z0-9+]\+\)+\([(){}>]\|$\)', '\="(".emmet#getExpandos(type, submatch(1)).")".submatch(2)', 'i')
|
||||
endif
|
||||
let abbr = rabbr
|
||||
|
||||
@@ -98,15 +98,15 @@ function! zencoding#lang#html#parseIntoTree(abbr, type)
|
||||
let current.important = important
|
||||
|
||||
" aliases
|
||||
let aliases = zencoding#getResource(type, 'aliases', {})
|
||||
let aliases = emmet#getResource(type, 'aliases', {})
|
||||
if has_key(aliases, tag_name)
|
||||
let current.name = aliases[tag_name]
|
||||
endif
|
||||
|
||||
let use_pipe_for_cursor = zencoding#getResource(type, 'use_pipe_for_cursor', 1)
|
||||
let use_pipe_for_cursor = emmet#getResource(type, 'use_pipe_for_cursor', 1)
|
||||
|
||||
" snippets
|
||||
let snippets = zencoding#getResource(type, 'snippets', {})
|
||||
let snippets = emmet#getResource(type, 'snippets', {})
|
||||
if !empty(snippets) && has_key(snippets, tag_name)
|
||||
let snippet = snippets[tag_name]
|
||||
if use_pipe_for_cursor
|
||||
@@ -118,16 +118,16 @@ function! zencoding#lang#html#parseIntoTree(abbr, type)
|
||||
let current.name = ''
|
||||
endif
|
||||
|
||||
let custom_expands = zencoding#getResource(type, 'custom_expands', {})
|
||||
let custom_expands = emmet#getResource(type, 'custom_expands', {})
|
||||
if empty(custom_expands) && has_key(settings, 'custom_expands')
|
||||
let custom_expands = settings['custom_expands']
|
||||
endif
|
||||
for k in keys(custom_expands)
|
||||
if tag_name =~ k
|
||||
if parent.name == ''
|
||||
let div = zencoding#lang#html#parseTag('<div/>')
|
||||
let div = emmet#lang#html#parseTag('<div/>')
|
||||
let div.value = '{\${' . tag_name . '}}'
|
||||
let current.snippet = zencoding#toString(div, type, 0, [])
|
||||
let current.snippet = emmet#toString(div, type, 0, [])
|
||||
else
|
||||
let current.snippet = '${' . tag_name . '}'
|
||||
endif
|
||||
@@ -137,7 +137,7 @@ function! zencoding#lang#html#parseIntoTree(abbr, type)
|
||||
endfor
|
||||
|
||||
" default_attributes
|
||||
let default_attributes = zencoding#getResource(type, 'default_attributes', {})
|
||||
let default_attributes = emmet#getResource(type, 'default_attributes', {})
|
||||
if !empty(default_attributes)
|
||||
for pat in [current.name, tag_name]
|
||||
if has_key(default_attributes, pat)
|
||||
@@ -288,7 +288,7 @@ function! zencoding#lang#html#parseIntoTree(abbr, type)
|
||||
endif
|
||||
let abbr = abbr[stridx(abbr, match) + len(match):]
|
||||
|
||||
if g:zencoding_debug > 1
|
||||
if g:emmet_debug > 1
|
||||
echomsg "str=".str
|
||||
echomsg "block_start=".block_start
|
||||
echomsg "tag_name=".tag_name
|
||||
@@ -305,7 +305,7 @@ function! zencoding#lang#html#parseIntoTree(abbr, type)
|
||||
return root
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#html#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
function! emmet#lang#html#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
let settings = a:settings
|
||||
let current = a:current
|
||||
let type = a:type
|
||||
@@ -313,13 +313,13 @@ function! zencoding#lang#html#toString(settings, current, type, inline, filters,
|
||||
let filters = a:filters
|
||||
let itemno = a:itemno
|
||||
let indent = a:indent
|
||||
let dollar_expr = zencoding#getResource(type, 'dollar_expr', 1)
|
||||
let dollar_expr = emmet#getResource(type, 'dollar_expr', 1)
|
||||
|
||||
if zencoding#useFilter(filters, 'haml')
|
||||
return zencoding#lang#haml#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
if emmet#useFilter(filters, 'haml')
|
||||
return emmet#lang#haml#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
endif
|
||||
if zencoding#useFilter(filters, 'slim')
|
||||
return zencoding#lang#slim#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
if emmet#useFilter(filters, 'slim')
|
||||
return emmet#lang#slim#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
endif
|
||||
|
||||
let comment = ''
|
||||
@@ -332,7 +332,8 @@ function! zencoding#lang#html#toString(settings, current, type, inline, filters,
|
||||
if len(current_name) == 0
|
||||
let text = current.value[1:-2]
|
||||
if dollar_expr
|
||||
let text = substitute(text, '\%(\\\)\@\<!\(\$\+\)\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
|
||||
" TODO: regexp engine specified
|
||||
let text = substitute(text, '\%#=1\%(\\\)\@\<!\(\$\+\)\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
|
||||
let text = substitute(text, '\${nr}', "\n", 'g')
|
||||
let text = substitute(text, '\\\$', '$', 'g')
|
||||
endif
|
||||
@@ -340,19 +341,20 @@ function! zencoding#lang#html#toString(settings, current, type, inline, filters,
|
||||
endif
|
||||
if len(current_name) > 0
|
||||
let str .= '<' . current_name
|
||||
for attr in zencoding#util#unique(current.attrs_order + keys(current.attr))
|
||||
for attr in emmet#util#unique(current.attrs_order + keys(current.attr))
|
||||
if !has_key(current.attr, attr)
|
||||
continue
|
||||
endif
|
||||
let val = current.attr[attr]
|
||||
if dollar_expr
|
||||
while val =~ '\$\([^#{]\|$\)'
|
||||
let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
|
||||
" TODO: regexp engine specified
|
||||
let val = substitute(val, '\%#=1\(\$\+\)\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
|
||||
endwhile
|
||||
let attr = substitute(attr, '\$$', itemno+1, '')
|
||||
endif
|
||||
let str .= ' ' . attr . '="' . val . '"'
|
||||
if zencoding#useFilter(filters, 'c')
|
||||
if emmet#useFilter(filters, 'c')
|
||||
if attr == 'id' | let comment .= '#' . val | endif
|
||||
if attr == 'class' | let comment .= '.' . val | endif
|
||||
endif
|
||||
@@ -366,7 +368,8 @@ function! zencoding#lang#html#toString(settings, current, type, inline, filters,
|
||||
let str .= ">"
|
||||
let text = current.value[1:-2]
|
||||
if dollar_expr
|
||||
let text = substitute(text, '\%(\\\)\@\<!\(\$\+\)\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
|
||||
" TODO: regexp engine specified
|
||||
let text = substitute(text, '\%#=1\%(\\\)\@\<!\(\$\+\)\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
|
||||
let text = substitute(text, '\${nr}', "\n", 'g')
|
||||
let text = substitute(text, '\\\$', '$', 'g')
|
||||
let str = substitute(str, '\("\zs$#\ze"\|\s\zs\$#"\|"\$#\ze\s\)', text, 'g')
|
||||
@@ -389,7 +392,7 @@ function! zencoding#lang#html#toString(settings, current, type, inline, filters,
|
||||
let dr = 1
|
||||
endif
|
||||
endif
|
||||
let inner = zencoding#toString(child, type, 0, filters, itemno, indent)
|
||||
let inner = emmet#toString(child, type, 0, filters, itemno, indent)
|
||||
let inner = substitute(inner, "^\n", "", 'g')
|
||||
let inner = substitute(inner, "\n", "\n" . escape(indent, '\'), 'g')
|
||||
let inner = substitute(inner, "\n" . escape(indent, '\') . '$', '', 'g')
|
||||
@@ -412,16 +415,16 @@ function! zencoding#lang#html#toString(settings, current, type, inline, filters,
|
||||
return str
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#html#imageSize()
|
||||
let img_region = zencoding#util#searchRegion('<img\s', '>')
|
||||
if !zencoding#util#regionIsValid(img_region) || !zencoding#util#cursorInRegion(img_region)
|
||||
function! emmet#lang#html#imageSize()
|
||||
let img_region = emmet#util#searchRegion('<img\s', '>')
|
||||
if !emmet#util#regionIsValid(img_region) || !emmet#util#cursorInRegion(img_region)
|
||||
return
|
||||
endif
|
||||
let content = zencoding#util#getContent(img_region)
|
||||
let content = emmet#util#getContent(img_region)
|
||||
if content !~ '^<img[^><]\+>$'
|
||||
return
|
||||
endif
|
||||
let current = zencoding#lang#html#parseTag(content)
|
||||
let current = emmet#lang#html#parseTag(content)
|
||||
if empty(current) || !has_key(current.attr, 'src')
|
||||
return
|
||||
endif
|
||||
@@ -432,28 +435,28 @@ function! zencoding#lang#html#imageSize()
|
||||
let fn = simplify(expand('%:h') . '/' . fn)
|
||||
endif
|
||||
|
||||
let [width, height] = zencoding#util#getImageSize(fn)
|
||||
let [width, height] = emmet#util#getImageSize(fn)
|
||||
if width == -1 && height == -1
|
||||
return
|
||||
endif
|
||||
let current.attr.width = width
|
||||
let current.attr.height = height
|
||||
let current.attrs_order += ['width', 'height']
|
||||
let html = substitute(zencoding#toString(current, 'html', 1), '\n', '', '')
|
||||
let html = substitute(emmet#toString(current, 'html', 1), '\n', '', '')
|
||||
let html = substitute(html, '\${cursor}', '', '')
|
||||
call zencoding#util#setContent(img_region, html)
|
||||
call emmet#util#setContent(img_region, html)
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#html#encodeImage()
|
||||
let img_region = zencoding#util#searchRegion('<img\s', '>')
|
||||
if !zencoding#util#regionIsValid(img_region) || !zencoding#util#cursorInRegion(img_region)
|
||||
function! emmet#lang#html#encodeImage()
|
||||
let img_region = emmet#util#searchRegion('<img\s', '>')
|
||||
if !emmet#util#regionIsValid(img_region) || !emmet#util#cursorInRegion(img_region)
|
||||
return
|
||||
endif
|
||||
let content = zencoding#util#getContent(img_region)
|
||||
let content = emmet#util#getContent(img_region)
|
||||
if content !~ '^<img[^><]\+>$'
|
||||
return
|
||||
endif
|
||||
let current = zencoding#lang#html#parseTag(content)
|
||||
let current = emmet#lang#html#parseTag(content)
|
||||
if empty(current) || !has_key(current.attr, 'src')
|
||||
return
|
||||
endif
|
||||
@@ -462,17 +465,17 @@ function! zencoding#lang#html#encodeImage()
|
||||
let fn = simplify(expand('%:h') . '/' . fn)
|
||||
endif
|
||||
|
||||
let [width, height] = zencoding#util#getImageSize(fn)
|
||||
let [width, height] = emmet#util#getImageSize(fn)
|
||||
if width == -1 && height == -1
|
||||
return
|
||||
endif
|
||||
let current.attr.width = width
|
||||
let current.attr.height = height
|
||||
let html = zencoding#toString(current, 'html', 1)
|
||||
call zencoding#util#setContent(img_region, html)
|
||||
let html = emmet#toString(current, 'html', 1)
|
||||
call emmet#util#setContent(img_region, html)
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#html#parseTag(tag)
|
||||
function! emmet#lang#html#parseTag(tag)
|
||||
let current = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'pos': 0, 'attrs_order': [] }
|
||||
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)
|
||||
@@ -494,22 +497,22 @@ function! zencoding#lang#html#parseTag(tag)
|
||||
return current
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#html#toggleComment()
|
||||
function! emmet#lang#html#toggleComment()
|
||||
let orgpos = getpos('.')
|
||||
let curpos = getpos('.')
|
||||
let mx = '<\%#[^>]*>'
|
||||
while 1
|
||||
let block = zencoding#util#searchRegion('<!--', '-->')
|
||||
if zencoding#util#regionIsValid(block)
|
||||
let block = emmet#util#searchRegion('<!--', '-->')
|
||||
if emmet#util#regionIsValid(block)
|
||||
let block[1][1] += 2
|
||||
let content = zencoding#util#getContent(block)
|
||||
let content = emmet#util#getContent(block)
|
||||
let content = substitute(content, '^<!--\s\(.*\)\s-->$', '\1', '')
|
||||
call zencoding#util#setContent(block, content)
|
||||
call emmet#util#setContent(block, content)
|
||||
silent! call setpos('.', orgpos)
|
||||
return
|
||||
endif
|
||||
let block = zencoding#util#searchRegion('<[^>]', '>')
|
||||
if !zencoding#util#regionIsValid(block)
|
||||
let block = emmet#util#searchRegion('<[^>]', '>')
|
||||
if !emmet#util#regionIsValid(block)
|
||||
let pos1 = searchpos('<', 'bcW')
|
||||
if pos1[0] == 0 && pos1[1] == 0
|
||||
return
|
||||
@@ -519,7 +522,7 @@ function! zencoding#lang#html#toggleComment()
|
||||
endif
|
||||
let pos1 = block[0]
|
||||
let pos2 = block[1]
|
||||
let content = zencoding#util#getContent(block)
|
||||
let content = emmet#util#getContent(block)
|
||||
let tag_name = matchstr(content, '^<\zs/\{0,1}[^ \r\n>]\+')
|
||||
if tag_name[0] == '/'
|
||||
call setpos('.', [0, pos1[0], pos1[1], 0])
|
||||
@@ -527,12 +530,12 @@ function! zencoding#lang#html#toggleComment()
|
||||
let pos1 = searchpos('>', 'cneW')
|
||||
let block = [pos2, pos1]
|
||||
elseif tag_name =~ '/$'
|
||||
if !zencoding#util#pointInRegion(orgpos[1:2], block)
|
||||
if !emmet#util#pointInRegion(orgpos[1:2], block)
|
||||
" it's broken tree
|
||||
call setpos('.', orgpos)
|
||||
let block = zencoding#util#searchRegion('>', '<')
|
||||
let content = '><!-- ' . zencoding#util#getContent(block)[1:-2] . ' --><'
|
||||
call zencoding#util#setContent(block, content)
|
||||
let block = emmet#util#searchRegion('>', '<')
|
||||
let content = '><!-- ' . emmet#util#getContent(block)[1:-2] . ' --><'
|
||||
call emmet#util#setContent(block, content)
|
||||
silent! call setpos('.', orgpos)
|
||||
return
|
||||
endif
|
||||
@@ -543,27 +546,27 @@ function! zencoding#lang#html#toggleComment()
|
||||
let pos2 = searchpos('>', 'neW')
|
||||
let block = [pos1, pos2]
|
||||
endif
|
||||
if !zencoding#util#regionIsValid(block)
|
||||
if !emmet#util#regionIsValid(block)
|
||||
silent! call setpos('.', orgpos)
|
||||
return
|
||||
endif
|
||||
if zencoding#util#pointInRegion(curpos[1:2], block)
|
||||
let content = '<!-- ' . zencoding#util#getContent(block) . ' -->'
|
||||
call zencoding#util#setContent(block, content)
|
||||
if emmet#util#pointInRegion(curpos[1:2], block)
|
||||
let content = '<!-- ' . emmet#util#getContent(block) . ' -->'
|
||||
call emmet#util#setContent(block, content)
|
||||
silent! call setpos('.', orgpos)
|
||||
return
|
||||
endif
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#html#balanceTag(flag) range
|
||||
let vblock = zencoding#util#getVisualBlock()
|
||||
function! emmet#lang#html#balanceTag(flag) range
|
||||
let vblock = emmet#util#getVisualBlock()
|
||||
if a:flag == -2 || a:flag == 2
|
||||
let curpos = [0, line("'<"), col("'<"), 0]
|
||||
else
|
||||
let curpos = getpos('.')
|
||||
endif
|
||||
let settings = zencoding#getSettings()
|
||||
let settings = emmet#getSettings()
|
||||
|
||||
if a:flag > 0
|
||||
let mx = '<\([a-zA-Z][a-zA-Z0-9:_\-]*\)[^>]*>'
|
||||
@@ -580,8 +583,8 @@ function! zencoding#lang#html#balanceTag(flag) range
|
||||
if pos1[0] == 0 && pos1[1] == 0
|
||||
break
|
||||
endif
|
||||
if zencoding#util#pointInRegion(curpos[1:2], block) && zencoding#util#regionIsValid(block)
|
||||
call zencoding#util#selectRegion(block)
|
||||
if emmet#util#pointInRegion(curpos[1:2], block) && emmet#util#regionIsValid(block)
|
||||
call emmet#util#selectRegion(block)
|
||||
return
|
||||
endif
|
||||
endwhile
|
||||
@@ -593,8 +596,8 @@ function! zencoding#lang#html#balanceTag(flag) range
|
||||
let pos1 = searchpos(mx . '\zs', 'W')
|
||||
let pos2 = searchpos('.\ze<', 'W')
|
||||
let block = [pos1, pos2]
|
||||
if zencoding#util#regionIsValid(block)
|
||||
call zencoding#util#selectRegion(block)
|
||||
if emmet#util#regionIsValid(block)
|
||||
call emmet#util#selectRegion(block)
|
||||
return
|
||||
endif
|
||||
endif
|
||||
@@ -609,8 +612,8 @@ function! zencoding#lang#html#balanceTag(flag) range
|
||||
if pos1[0] == 0 && pos1[1] == 0
|
||||
break
|
||||
endif
|
||||
if zencoding#util#regionIsValid(block)
|
||||
call zencoding#util#selectRegion(block)
|
||||
if emmet#util#regionIsValid(block)
|
||||
call emmet#util#selectRegion(block)
|
||||
return
|
||||
endif
|
||||
endwhile
|
||||
@@ -622,7 +625,7 @@ function! zencoding#lang#html#balanceTag(flag) range
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#html#moveNextPrev(flag)
|
||||
function! emmet#lang#html#moveNextPrev(flag)
|
||||
let pos = search('\%(</\w\+\)\@<!\zs><\/\|\(""\)\|^\(\s*\)$', a:flag ? 'Wpb' : 'Wp')
|
||||
if pos == 3
|
||||
startinsert!
|
||||
@@ -632,7 +635,7 @@ function! zencoding#lang#html#moveNextPrev(flag)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#html#splitJoinTag()
|
||||
function! emmet#lang#html#splitJoinTag()
|
||||
let curpos = getpos('.')
|
||||
while 1
|
||||
let mx = '<\(/\{0,1}[a-zA-Z][a-zA-Z0-9:_\-]*\)[^>]*>'
|
||||
@@ -640,9 +643,9 @@ function! zencoding#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:] == '/>' && zencoding#util#cursorInRegion(block)
|
||||
if content[-2:] == '/>' && emmet#util#cursorInRegion(block)
|
||||
let content = content[:-3] . "></" . tag_name . '>'
|
||||
call zencoding#util#setContent(block, content)
|
||||
call emmet#util#setContent(block, content)
|
||||
call setpos('.', [0, block[0][0], block[0][1], 0])
|
||||
return
|
||||
else
|
||||
@@ -654,10 +657,10 @@ function! zencoding#lang#html#splitJoinTag()
|
||||
let pos2 = searchpos('</' . tag_name . '>', 'cneW')
|
||||
endif
|
||||
let block = [pos1, pos2]
|
||||
let content = zencoding#util#getContent(block)
|
||||
if zencoding#util#pointInRegion(curpos[1:2], block) && content[1:] !~ '<' . tag_name . '[^a-zA-Z0-9]*[^>]*>'
|
||||
let content = emmet#util#getContent(block)
|
||||
if emmet#util#pointInRegion(curpos[1:2], block) && content[1:] !~ '<' . tag_name . '[^a-zA-Z0-9]*[^>]*>'
|
||||
let content = matchstr(content, mx)[:-2] . '/>'
|
||||
call zencoding#util#setContent(block, content)
|
||||
call emmet#util#setContent(block, content)
|
||||
call setpos('.', [0, block[0][0], block[0][1], 0])
|
||||
return
|
||||
else
|
||||
@@ -672,7 +675,7 @@ function! zencoding#lang#html#splitJoinTag()
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#html#removeTag()
|
||||
function! emmet#lang#html#removeTag()
|
||||
let curpos = getpos('.')
|
||||
while 1
|
||||
let mx = '<\(/\{0,1}[a-zA-Z][a-zA-Z0-9:_\-]*\)[^>]*>'
|
||||
@@ -680,8 +683,8 @@ function! zencoding#lang#html#removeTag()
|
||||
let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
|
||||
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:] == '/>' && zencoding#util#cursorInRegion(block)
|
||||
call zencoding#util#setContent(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
|
||||
@@ -693,9 +696,9 @@ function! zencoding#lang#html#removeTag()
|
||||
let pos2 = searchpos('</' . tag_name . '>', 'cneW')
|
||||
endif
|
||||
let block = [pos1, pos2]
|
||||
let content = zencoding#util#getContent(block)
|
||||
if zencoding#util#pointInRegion(curpos[1:2], block) && content[1:] !~ '<' . tag_name . '[^a-zA-Z0-9]*[^>]*>'
|
||||
call zencoding#util#setContent(block, '')
|
||||
let content = emmet#util#getContent(block)
|
||||
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
|
||||
else
|
||||
@@ -1,16 +1,16 @@
|
||||
function! zencoding#lang#sass#findTokens(str)
|
||||
return zencoding#lang#html#findTokens(a:str)
|
||||
function! emmet#lang#sass#findTokens(str)
|
||||
return emmet#lang#html#findTokens(a:str)
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#sass#parseIntoTree(abbr, type)
|
||||
function! emmet#lang#sass#parseIntoTree(abbr, type)
|
||||
if a:abbr =~ '>'
|
||||
return zencoding#lang#html#parseIntoTree(a:abbr, a:type)
|
||||
return emmet#lang#html#parseIntoTree(a:abbr, a:type)
|
||||
else
|
||||
return zencoding#lang#css#parseIntoTree(a:abbr, a:type)
|
||||
return emmet#lang#css#parseIntoTree(a:abbr, a:type)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#sass#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
function! emmet#lang#sass#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
let settings = a:settings
|
||||
let current = a:current
|
||||
let type = a:type
|
||||
@@ -50,33 +50,33 @@ function! zencoding#lang#sass#toString(settings, current, type, inline, filters,
|
||||
|
||||
let inner = ''
|
||||
for child in current.child
|
||||
let inner .= zencoding#toString(child, type, inline, filters, itemno)
|
||||
let inner .= emmet#toString(child, type, inline, filters, itemno)
|
||||
endfor
|
||||
let inner = substitute(inner, "\n", "\n" . indent, 'g')
|
||||
let inner = substitute(inner, "\n" . indent . "$", "", 'g')
|
||||
let str .= indent . inner
|
||||
else
|
||||
let text = zencoding#lang#css#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
let text = emmet#lang#css#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
let text = substitute(text, '\s*;\ze\(\${[^}]\+}\)\?\(\n\|$\)', '', 'g')
|
||||
return text
|
||||
endif
|
||||
return str
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#sass#imageSize()
|
||||
function! emmet#lang#sass#imageSize()
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#sass#encodeImage()
|
||||
function! emmet#lang#sass#encodeImage()
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#sass#parseTag(tag)
|
||||
function! emmet#lang#sass#parseTag(tag)
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#sass#toggleComment()
|
||||
function! emmet#lang#sass#toggleComment()
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#sass#balanceTag(flag) range
|
||||
let block = zencoding#util#getVisualBlock()
|
||||
function! emmet#lang#sass#balanceTag(flag) range
|
||||
let block = emmet#util#getVisualBlock()
|
||||
if a:flag == -2 || a:flag == 2
|
||||
let curpos = [0, line("'<"), col("'<"), 0]
|
||||
else
|
||||
@@ -86,7 +86,7 @@ function! zencoding#lang#sass#balanceTag(flag) range
|
||||
let ml = len(matchstr(getline(n), '^\s*'))
|
||||
|
||||
if a:flag > 0
|
||||
if a:flag == 1 || !zencoding#util#regionIsValid(block)
|
||||
if a:flag == 1 || !emmet#util#regionIsValid(block)
|
||||
let n = line('.')
|
||||
else
|
||||
while n > 0
|
||||
@@ -140,7 +140,7 @@ function! zencoding#lang#sass#balanceTag(flag) range
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#sass#moveNextPrev(flag)
|
||||
function! emmet#lang#sass#moveNextPrev(flag)
|
||||
let pos = search('""\|\(^\s*|\s*\zs\)', a:flag ? 'Wpb' : 'Wp')
|
||||
if pos == 2
|
||||
startinsert!
|
||||
@@ -150,8 +150,8 @@ function! zencoding#lang#sass#moveNextPrev(flag)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#sass#splitJoinTag()
|
||||
function! emmet#lang#sass#splitJoinTag()
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#sass#removeTag()
|
||||
function! emmet#lang#sass#removeTag()
|
||||
endfunction
|
||||
@@ -1,16 +1,16 @@
|
||||
function! zencoding#lang#scss#findTokens(str)
|
||||
return zencoding#lang#html#findTokens(a:str)
|
||||
function! emmet#lang#scss#findTokens(str)
|
||||
return emmet#lang#html#findTokens(a:str)
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#scss#parseIntoTree(abbr, type)
|
||||
function! emmet#lang#scss#parseIntoTree(abbr, type)
|
||||
if a:abbr =~ '>'
|
||||
return zencoding#lang#html#parseIntoTree(a:abbr, a:type)
|
||||
return emmet#lang#html#parseIntoTree(a:abbr, a:type)
|
||||
else
|
||||
return zencoding#lang#css#parseIntoTree(a:abbr, a:type)
|
||||
return emmet#lang#css#parseIntoTree(a:abbr, a:type)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#scss#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
function! emmet#lang#scss#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
let settings = a:settings
|
||||
let current = a:current
|
||||
let type = a:type
|
||||
@@ -49,34 +49,34 @@ function! zencoding#lang#scss#toString(settings, current, type, inline, filters,
|
||||
|
||||
let inner = ''
|
||||
for child in current.child
|
||||
let inner .= zencoding#toString(child, type, inline, filters, itemno)
|
||||
let inner .= emmet#toString(child, type, inline, filters, itemno)
|
||||
endfor
|
||||
let inner = substitute(inner, "\n", "\n" . escape(indent, '\'), 'g')
|
||||
let inner = substitute(inner, "\n" . escape(indent, '\') . "$", "", 'g')
|
||||
let str .= indent . inner . "\n}\n"
|
||||
else
|
||||
return zencoding#lang#css#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
return emmet#lang#css#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
endif
|
||||
return str
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#scss#imageSize()
|
||||
call zencoding#lang#css#imageSize()
|
||||
function! emmet#lang#scss#imageSize()
|
||||
call emmet#lang#css#imageSize()
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#scss#encodeImage()
|
||||
return zencoding#lang#css#encodeImage()
|
||||
function! emmet#lang#scss#encodeImage()
|
||||
return emmet#lang#css#encodeImage()
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#scss#parseTag(tag)
|
||||
return zencoding#lang#css#parseTag(a:tag)
|
||||
function! emmet#lang#scss#parseTag(tag)
|
||||
return emmet#lang#css#parseTag(a:tag)
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#scss#toggleComment()
|
||||
call zencoding#lang#css#toggleComment()
|
||||
function! emmet#lang#scss#toggleComment()
|
||||
call emmet#lang#css#toggleComment()
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#scss#balanceTag(flag) range
|
||||
function! emmet#lang#scss#balanceTag(flag) range
|
||||
if a:flag == -2 || a:flag == 2
|
||||
let curpos = [0, line("'<"), col("'<"), 0]
|
||||
call setpos('.', curpos)
|
||||
@@ -96,8 +96,8 @@ function! zencoding#lang#scss#balanceTag(flag) range
|
||||
let pos2 = searchpairpos('{', '', '}')
|
||||
endif
|
||||
let block = [pos1, pos2]
|
||||
if zencoding#util#regionIsValid(block)
|
||||
call zencoding#util#selectRegion(block)
|
||||
if emmet#util#regionIsValid(block)
|
||||
call emmet#util#selectRegion(block)
|
||||
return
|
||||
endif
|
||||
endif
|
||||
@@ -108,14 +108,14 @@ function! zencoding#lang#scss#balanceTag(flag) range
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#scss#moveNextPrev(flag)
|
||||
call zencoding#lang#css#moveNextPrev(a:flag)
|
||||
function! emmet#lang#scss#moveNextPrev(flag)
|
||||
call emmet#lang#css#moveNextPrev(a:flag)
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#scss#splitJoinTag()
|
||||
call zencoding#lang#css#splitJoinTag()
|
||||
function! emmet#lang#scss#splitJoinTag()
|
||||
call emmet#lang#css#splitJoinTag()
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#scss#removeTag()
|
||||
call zencoding#lang#ss#removeTag()
|
||||
function! emmet#lang#scss#removeTag()
|
||||
call emmet#lang#ss#removeTag()
|
||||
endfunction
|
||||
@@ -1,20 +1,20 @@
|
||||
function! zencoding#lang#slim#findTokens(str)
|
||||
return zencoding#lang#html#findTokens(a:str)
|
||||
function! emmet#lang#slim#findTokens(str)
|
||||
return emmet#lang#html#findTokens(a:str)
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#slim#parseIntoTree(abbr, type)
|
||||
return zencoding#lang#html#parseIntoTree(a:abbr, a:type)
|
||||
function! emmet#lang#slim#parseIntoTree(abbr, type)
|
||||
return emmet#lang#html#parseIntoTree(a:abbr, a:type)
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#slim#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
function! emmet#lang#slim#toString(settings, current, type, inline, filters, itemno, indent)
|
||||
let settings = a:settings
|
||||
let current = a:current
|
||||
let type = a:type
|
||||
let inline = a:inline
|
||||
let filters = a:filters
|
||||
let itemno = a:itemno
|
||||
let indent = zencoding#getIndentation(type)
|
||||
let dollar_expr = zencoding#getResource(type, 'dollar_expr', 1)
|
||||
let indent = emmet#getIndentation(type)
|
||||
let dollar_expr = emmet#getResource(type, 'dollar_expr', 1)
|
||||
let str = ""
|
||||
|
||||
let comment_indent = ''
|
||||
@@ -25,7 +25,7 @@ function! zencoding#lang#slim#toString(settings, current, type, inline, filters,
|
||||
endif
|
||||
if len(current.name) > 0
|
||||
let str .= current_name
|
||||
for attr in zencoding#util#unique(current.attrs_order + keys(current.attr))
|
||||
for attr in emmet#util#unique(current.attrs_order + keys(current.attr))
|
||||
if !has_key(current.attr, attr)
|
||||
continue
|
||||
endif
|
||||
@@ -68,7 +68,7 @@ function! zencoding#lang#slim#toString(settings, current, type, inline, filters,
|
||||
endfor
|
||||
elseif len(current.child) > 0
|
||||
for child in current.child
|
||||
let inner .= zencoding#toString(child, type, inline, filters, itemno, indent)
|
||||
let inner .= emmet#toString(child, type, inline, filters, itemno, indent)
|
||||
endfor
|
||||
let inner = substitute(inner, "\n", "\n" . escape(indent, '\'), 'g')
|
||||
let inner = substitute(inner, "\n" . escape(indent, '\') . "$", "", 'g')
|
||||
@@ -88,9 +88,9 @@ function! zencoding#lang#slim#toString(settings, current, type, inline, filters,
|
||||
return str
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#slim#imageSize()
|
||||
function! emmet#lang#slim#imageSize()
|
||||
let line = getline('.')
|
||||
let current = zencoding#lang#slim#parseTag(line)
|
||||
let current = emmet#lang#slim#parseTag(line)
|
||||
if empty(current) || !has_key(current.attr, 'src')
|
||||
return
|
||||
endif
|
||||
@@ -101,22 +101,22 @@ function! zencoding#lang#slim#imageSize()
|
||||
let fn = simplify(expand('%:h') . '/' . fn)
|
||||
endif
|
||||
|
||||
let [width, height] = zencoding#util#getImageSize(fn)
|
||||
let [width, height] = emmet#util#getImageSize(fn)
|
||||
if width == -1 && height == -1
|
||||
return
|
||||
endif
|
||||
let current.attr.width = width
|
||||
let current.attr.height = height
|
||||
let current.attrs_order += ['width', 'height']
|
||||
let slim = zencoding#toString(current, 'slim', 1)
|
||||
let slim = emmet#toString(current, 'slim', 1)
|
||||
let slim = substitute(slim, '\${cursor}', '', '')
|
||||
call setline('.', substitute(matchstr(line, '^\s*') . slim, "\n", "", "g"))
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#slim#encodeImage()
|
||||
function! emmet#lang#slim#encodeImage()
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#slim#parseTag(tag)
|
||||
function! emmet#lang#slim#parseTag(tag)
|
||||
let current = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'pos': 0, 'attrs_order': [] }
|
||||
let mx = '\([a-zA-Z][a-zA-Z0-9]*\)\s\+\(.*\)'
|
||||
let match = matchstr(a:tag, mx)
|
||||
@@ -138,7 +138,7 @@ function! zencoding#lang#slim#parseTag(tag)
|
||||
return current
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#slim#toggleComment()
|
||||
function! emmet#lang#slim#toggleComment()
|
||||
let line = getline('.')
|
||||
let space = matchstr(line, '^\s*')
|
||||
if line =~ '^\s*/'
|
||||
@@ -148,8 +148,8 @@ function! zencoding#lang#slim#toggleComment()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#slim#balanceTag(flag) range
|
||||
let block = zencoding#util#getVisualBlock()
|
||||
function! emmet#lang#slim#balanceTag(flag) range
|
||||
let block = emmet#util#getVisualBlock()
|
||||
if a:flag == -2 || a:flag == 2
|
||||
let curpos = [0, line("'<"), col("'<"), 0]
|
||||
else
|
||||
@@ -159,7 +159,7 @@ function! zencoding#lang#slim#balanceTag(flag) range
|
||||
let ml = len(matchstr(getline(n), '^\s*'))
|
||||
|
||||
if a:flag > 0
|
||||
if a:flag == 1 || !zencoding#util#regionIsValid(block)
|
||||
if a:flag == 1 || !emmet#util#regionIsValid(block)
|
||||
let n = line('.')
|
||||
else
|
||||
while n > 0
|
||||
@@ -213,7 +213,7 @@ function! zencoding#lang#slim#balanceTag(flag) range
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#slim#moveNextPrev(flag)
|
||||
function! emmet#lang#slim#moveNextPrev(flag)
|
||||
let pos = search('""\|\(^\s*|\s*\zs\)', a:flag ? 'Wpb' : 'Wp')
|
||||
if pos == 2
|
||||
startinsert!
|
||||
@@ -223,7 +223,7 @@ function! zencoding#lang#slim#moveNextPrev(flag)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#slim#splitJoinTag()
|
||||
function! emmet#lang#slim#splitJoinTag()
|
||||
let n = line('.')
|
||||
while n > 0
|
||||
if getline(n) =~ '^\s*\ze[a-z]'
|
||||
@@ -249,7 +249,7 @@ function! zencoding#lang#slim#splitJoinTag()
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#slim#removeTag()
|
||||
function! emmet#lang#slim#removeTag()
|
||||
let n = line('.')
|
||||
let ml = 0
|
||||
while n > 0
|
||||
@@ -1,4 +1,4 @@
|
||||
function! zencoding#lorem#en#expand(command)
|
||||
function! emmet#lorem#en#expand(command)
|
||||
let wcount = matchstr(a:command, '^\%(lorem\|lipsum\)\(\d*\)}$', '\1', '')
|
||||
let wcount = wcount > 0 ? wcount : 30
|
||||
|
||||
@@ -39,19 +39,19 @@ function! zencoding#lorem#en#expand(command)
|
||||
if sentence > 0
|
||||
let arr += words
|
||||
endif
|
||||
let r = zencoding#util#rand()
|
||||
let r = emmet#util#rand()
|
||||
let word = arr[r % len(arr)]
|
||||
if sentence == 0
|
||||
let word = substitute(word, '^.', '\U&', '')
|
||||
endif
|
||||
let sentence += 1
|
||||
call add(ret, word)
|
||||
if (sentence > 5 && zencoding#util#rand() < 10000) || i == wcount - 1
|
||||
if (sentence > 5 && emmet#util#rand() < 10000) || i == wcount - 1
|
||||
if i == wcount - 1
|
||||
let endc = "?!..."[zencoding#util#rand() % 5]
|
||||
let endc = "?!..."[emmet#util#rand() % 5]
|
||||
call add(ret, endc)
|
||||
else
|
||||
let endc = "?!,..."[zencoding#util#rand() % 6]
|
||||
let endc = "?!,..."[emmet#util#rand() % 6]
|
||||
call add(ret, endc . ' ')
|
||||
endif
|
||||
if endc != ','
|
||||
@@ -1,19 +1,19 @@
|
||||
scriptencoding utf-8
|
||||
|
||||
function! zencoding#lorem#ja#expand(command)
|
||||
function! emmet#lorem#ja#expand(command)
|
||||
let wcount = matchstr(a:command, '^\%(lorem\|lipsum\)\(\d*\)}$', '\1', '')
|
||||
let wcount = wcount > 0 ? wcount : 30
|
||||
|
||||
let url = "http://www.aozora.gr.jp/cards/000081/files/470_15407.html"
|
||||
let content = zencoding#util#cache(url)
|
||||
let content = emmet#util#cache(url)
|
||||
if len(content) == 0
|
||||
let content = zencoding#util#getContentFromURL(url)
|
||||
let content = emmet#util#getContentFromURL(url)
|
||||
let content = matchstr(content, '<div[^>]*>\zs.\{-}</div>')
|
||||
let content = substitute(content, '[ \r]', '', 'g')
|
||||
let content = substitute(content, '<br[^>]*>', "\n", 'g')
|
||||
let content = substitute(content, '<[^>]\+>', '', 'g')
|
||||
let content = join(filter(split(content, "\n"), 'len(v:val)>0'), "\n")
|
||||
call zencoding#util#cache(url, content)
|
||||
call emmet#util#cache(url, content)
|
||||
endif
|
||||
|
||||
let content = substitute(content, "、\n", "、", "g")
|
||||
@@ -22,6 +22,6 @@ function! zencoding#lorem#ja#expand(command)
|
||||
if len(lines) == 0
|
||||
let lines = clines
|
||||
endif
|
||||
let r = zencoding#util#rand()
|
||||
let r = emmet#util#rand()
|
||||
return lines[r % len(lines)]
|
||||
endfunction
|
||||
@@ -11,7 +11,7 @@
|
||||
" --------------------
|
||||
" begin::end
|
||||
" --------------------
|
||||
function! zencoding#util#deleteContent(region)
|
||||
function! emmet#util#deleteContent(region)
|
||||
let lines = getline(a:region[0][0], a:region[1][0])
|
||||
call setpos('.', [0, a:region[0][0], a:region[0][1], 0])
|
||||
silent! exe "delete ".(a:region[1][0] - a:region[0][0])
|
||||
@@ -36,7 +36,7 @@ endfunction
|
||||
" bar
|
||||
" baz:end
|
||||
" --------------------
|
||||
function! zencoding#util#setContent(region, content)
|
||||
function! emmet#util#setContent(region, content)
|
||||
let newlines = split(a:content, '\n', 1)
|
||||
let oldlines = getline(a:region[0][0], a:region[1][0])
|
||||
call setpos('.', [0, a:region[0][0], a:region[0][1], 0])
|
||||
@@ -72,7 +72,7 @@ endfunction
|
||||
|
||||
" select_region : select region
|
||||
" this function make a selection of region
|
||||
function! zencoding#util#selectRegion(region)
|
||||
function! emmet#util#selectRegion(region)
|
||||
call setpos('.', [0, a:region[1][0], a:region[1][1], 0])
|
||||
normal! v
|
||||
call setpos('.', [0, a:region[0][0], a:region[0][1], 0])
|
||||
@@ -80,8 +80,8 @@ endfunction
|
||||
|
||||
" point_in_region : check point is in the region
|
||||
" this function return 0 or 1
|
||||
function! zencoding#util#pointInRegion(point, region)
|
||||
if !zencoding#util#regionIsValid(a:region) | return 0 | endif
|
||||
function! emmet#util#pointInRegion(point, region)
|
||||
if !emmet#util#regionIsValid(a:region) | return 0 | endif
|
||||
if a:region[0][0] > a:point[0] | return 0 | endif
|
||||
if a:region[1][0] < a:point[0] | return 0 | endif
|
||||
if a:region[0][0] == a:point[0] && a:region[0][1] > a:point[1] | return 0 | endif
|
||||
@@ -91,29 +91,29 @@ endfunction
|
||||
|
||||
" cursor_in_region : check cursor is in the region
|
||||
" this function return 0 or 1
|
||||
function! zencoding#util#cursorInRegion(region)
|
||||
if !zencoding#util#regionIsValid(a:region) | return 0 | endif
|
||||
function! emmet#util#cursorInRegion(region)
|
||||
if !emmet#util#regionIsValid(a:region) | return 0 | endif
|
||||
let cur = getpos('.')[1:2]
|
||||
return zencoding#util#pointInRegion(cur, a:region)
|
||||
return emmet#util#pointInRegion(cur, a:region)
|
||||
endfunction
|
||||
|
||||
" region_is_valid : check region is valid
|
||||
" this function return 0 or 1
|
||||
function! zencoding#util#regionIsValid(region)
|
||||
function! emmet#util#regionIsValid(region)
|
||||
if a:region[0][0] == 0 || a:region[1][0] == 0 | return 0 | endif
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
" search_region : make region from pattern which is composing start/end
|
||||
" this function return array of position
|
||||
function! zencoding#util#searchRegion(start, end)
|
||||
function! emmet#util#searchRegion(start, end)
|
||||
return [searchpairpos(a:start, '', a:end, 'bcnW'), searchpairpos(a:start, '\%#', a:end, 'nW')]
|
||||
endfunction
|
||||
|
||||
" get_content : get content in region
|
||||
" this function return string in region
|
||||
function! zencoding#util#getContent(region)
|
||||
if !zencoding#util#regionIsValid(a:region)
|
||||
function! emmet#util#getContent(region)
|
||||
if !emmet#util#regionIsValid(a:region)
|
||||
return ''
|
||||
endif
|
||||
let lines = getline(a:region[0][0], a:region[1][0])
|
||||
@@ -128,24 +128,24 @@ endfunction
|
||||
|
||||
" region_in_region : check region is in the region
|
||||
" this function return 0 or 1
|
||||
function! zencoding#util#regionInRegion(outer, inner)
|
||||
if !zencoding#util#regionIsValid(a:inner) || !zencoding#util#regionIsValid(a:outer)
|
||||
function! emmet#util#regionInRegion(outer, inner)
|
||||
if !emmet#util#regionIsValid(a:inner) || !emmet#util#regionIsValid(a:outer)
|
||||
return 0
|
||||
endif
|
||||
return zencoding#util#pointInRegion(a:inner[0], a:outer) && zencoding#util#pointInRegion(a:inner[1], a:outer)
|
||||
return emmet#util#pointInRegion(a:inner[0], a:outer) && emmet#util#pointInRegion(a:inner[1], a:outer)
|
||||
endfunction
|
||||
|
||||
" get_visualblock : get region of visual block
|
||||
" this function return region of visual block
|
||||
function! zencoding#util#getVisualBlock()
|
||||
function! emmet#util#getVisualBlock()
|
||||
return [[line("'<"), col("'<")], [line("'>"), col("'>")]]
|
||||
endfunction
|
||||
|
||||
"==============================================================================
|
||||
" html utils
|
||||
"==============================================================================
|
||||
function! zencoding#util#getContentFromURL(url)
|
||||
let res = system(printf("%s %s", g:zencoding_curl_command, shellescape(substitute(a:url, '#.*', '', ''))))
|
||||
function! emmet#util#getContentFromURL(url)
|
||||
let res = system(printf("%s %s", g:emmet_curl_command, shellescape(substitute(a:url, '#.*', '', ''))))
|
||||
let charset = matchstr(res, '<meta[^>]\+content=["''][^;"'']\+;\s*charset=\zs[^;"'']\+\ze["''][^>]*>')
|
||||
if len(charset) == 0
|
||||
let charset = matchstr(res, '<meta\s\+charset=["'']\?\zs[^"'']\+\ze["'']\?[^>]*>')
|
||||
@@ -159,7 +159,7 @@ function! zencoding#util#getContentFromURL(url)
|
||||
return iconv(res, charset, &encoding)
|
||||
endfunction
|
||||
|
||||
function! zencoding#util#getTextFromHTML(buf)
|
||||
function! emmet#util#getTextFromHTML(buf)
|
||||
let threshold_len = 100
|
||||
let threshold_per = 0.1
|
||||
let buf = a:buf
|
||||
@@ -196,17 +196,17 @@ function! zencoding#util#getTextFromHTML(buf)
|
||||
return res
|
||||
endfunction
|
||||
|
||||
function! zencoding#util#getImageSize(fn)
|
||||
function! emmet#util#getImageSize(fn)
|
||||
let fn = a:fn
|
||||
|
||||
if zencoding#util#isImageMagickInstalled()
|
||||
return zencoding#util#imageSizeWithImageMagick(fn)
|
||||
if emmet#util#isImageMagickInstalled()
|
||||
return emmet#util#imageSizeWithImageMagick(fn)
|
||||
endif
|
||||
|
||||
if filereadable(fn)
|
||||
let hex = substitute(system('xxd -p "'.fn.'"'), '\n', '', 'g')
|
||||
else
|
||||
let hex = substitute(system(g:zencoding_curl_command.' "'.fn.'" | xxd -p'), '\n', '', 'g')
|
||||
let hex = substitute(system(g:emmet_curl_command.' "'.fn.'" | xxd -p'), '\n', '', 'g')
|
||||
endif
|
||||
|
||||
let [width, height] = [-1, -1]
|
||||
@@ -240,7 +240,7 @@ function! zencoding#util#getImageSize(fn)
|
||||
return [width, height]
|
||||
endfunction
|
||||
|
||||
function! zencoding#util#imageSizeWithImageMagick(fn)
|
||||
function! emmet#util#imageSizeWithImageMagick(fn)
|
||||
let img_info = system('identify -format "%wx%h" "'.a:fn.'"')
|
||||
let img_size = split(substitute(img_info, '\n', '', ''), 'x')
|
||||
let width = img_size[0]
|
||||
@@ -248,14 +248,14 @@ function! zencoding#util#imageSizeWithImageMagick(fn)
|
||||
return [width, height]
|
||||
endfunction
|
||||
|
||||
function! zencoding#util#isImageMagickInstalled()
|
||||
if !get(s:, 'zencoding_use_identify', 1)
|
||||
function! emmet#util#isImageMagickInstalled()
|
||||
if !get(s:, 'emmet_use_identify', 1)
|
||||
return 0
|
||||
endif
|
||||
return executable('identify')
|
||||
endfunction
|
||||
|
||||
function! zencoding#util#unique(arr)
|
||||
function! emmet#util#unique(arr)
|
||||
let m = {}
|
||||
let r = []
|
||||
for i in a:arr
|
||||
@@ -268,18 +268,18 @@ function! zencoding#util#unique(arr)
|
||||
endfunction
|
||||
|
||||
let s:seed = localtime()
|
||||
function! zencoding#util#srand(seed)
|
||||
function! emmet#util#srand(seed)
|
||||
let s:seed = a:seed
|
||||
endfunction
|
||||
|
||||
function! zencoding#util#rand()
|
||||
function! emmet#util#rand()
|
||||
let s:seed = s:seed * 214013 + 2531011
|
||||
return (s:seed < 0 ? s:seed - 0x80000000 : s:seed) / 0x10000 % 0x8000
|
||||
endfunction
|
||||
|
||||
function! zencoding#util#cache(name, ...)
|
||||
function! emmet#util#cache(name, ...)
|
||||
let content = get(a:000, 0, "")
|
||||
let dir = expand("~/.zencoding/cache")
|
||||
let dir = expand("~/.emmet/cache")
|
||||
if !isdirectory(dir)
|
||||
call mkdir(dir, "p", 0700)
|
||||
endif
|
||||
@@ -1,48 +1,48 @@
|
||||
*zencoding.txt* ZenCoding for Vim
|
||||
*emmet.txt* Emmet for Vim
|
||||
|
||||
-------------------------------------------------------
|
||||
ZenCoding: vim plugins for HTML and CSS hi-speed coding
|
||||
Emmet: vim plugins for HTML and CSS hi-speed coding
|
||||
-------------------------------------------------------
|
||||
|
||||
Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
||||
WebSite: http://mattn.kaoriya.net/
|
||||
Repository: http://github.com/mattn/zencoding-vim
|
||||
Site: http://mattn.github.com/zencoding-vim
|
||||
Repository: http://github.com/mattn/emmet-vim
|
||||
Site: http://mattn.github.com/emmet-vim
|
||||
License: BSD style license
|
||||
|
||||
==============================================================================
|
||||
CONTENTS *zencoding-contents*
|
||||
CONTENTS *emmet-contents*
|
||||
|
||||
Introduction |zencoding-introduction|
|
||||
Install |zencoding-install|
|
||||
Tutorial |zencoding-tutorial|
|
||||
1. Expand Abbreviation |zencoding-expandabbr|
|
||||
2. Wrap with Abbreviation |zencoding-wrap-with-abbreviation|
|
||||
3. Balance Tag Inward |zencoding-balance-tag-inward|
|
||||
4. Balance Tag Outward |zencoding-balance-tag-outward|
|
||||
5. Go to Next Edit Point |zencoding-goto-next-point| |<C-Y>n|
|
||||
6. Go to Previous Edit Point |zencoding-goto-previous-point|
|
||||
7. Update <img> Size |zencoding-update-image-size|
|
||||
8. Merge Lines |zencoding-merge-lines|
|
||||
9. Remove Tag |zencoding-remove-tag|
|
||||
10. Split/Join Tag |zencoding-split-join-tag|
|
||||
11. Toggle Comment |zencoding-toggle-comment|
|
||||
12. Make anchor from URL |zencoding-make-anchor-url|
|
||||
13. Make quoted text from URL |zencoding-quoted-text-url|
|
||||
14. Code Pretty |zencoding-code-pretty|
|
||||
15. Lorem Ipsum |zencoding-lorem-ipsum|
|
||||
Customize |zencoding-customize|
|
||||
1. Key Mappings |zencoding-customize-keymappings|
|
||||
2. Indent Size |zencoding-indent-size|
|
||||
3. Define Tag's Behavior |zencoding-define-tags-behavior|
|
||||
4. Complete Tag |zencoding-complete-tag|
|
||||
Links |zencoding-links|
|
||||
ToDo |zencoding-todo|
|
||||
Introduction |emmet-introduction|
|
||||
Install |emmet-install|
|
||||
Tutorial |emmet-tutorial|
|
||||
1. Expand Abbreviation |emmet-expandabbr|
|
||||
2. Wrap with Abbreviation |emmet-wrap-with-abbreviation|
|
||||
3. Balance Tag Inward |emmet-balance-tag-inward|
|
||||
4. Balance Tag Outward |emmet-balance-tag-outward|
|
||||
5. Go to Next Edit Point |emmet-goto-next-point| |<C-Y>n|
|
||||
6. Go to Previous Edit Point |emmet-goto-previous-point|
|
||||
7. Update <img> Size |emmet-update-image-size|
|
||||
8. Merge Lines |emmet-merge-lines|
|
||||
9. Remove Tag |emmet-remove-tag|
|
||||
10. Split/Join Tag |emmet-split-join-tag|
|
||||
11. Toggle Comment |emmet-toggle-comment|
|
||||
12. Make anchor from URL |emmet-make-anchor-url|
|
||||
13. Make quoted text from URL |emmet-quoted-text-url|
|
||||
14. Code Pretty |emmet-code-pretty|
|
||||
15. Lorem Ipsum |emmet-lorem-ipsum|
|
||||
Customize |emmet-customize|
|
||||
1. Key Mappings |emmet-customize-keymappings|
|
||||
2. Indent Size |emmet-indent-size|
|
||||
3. Define Tag's Behavior |emmet-define-tags-behavior|
|
||||
4. Complete Tag |emmet-complete-tag|
|
||||
Links |emmet-links|
|
||||
ToDo |emmet-todo|
|
||||
|
||||
==============================================================================
|
||||
INTRODUCTION *zencoding-introduction* *zencoding*
|
||||
INTRODUCTION *emmet-introduction* *emmet*
|
||||
|
||||
|ZenCoding| is an editor plugin for high-speed HTML, XML, XSL (or any other
|
||||
|Emmet| is an editor plugin for high-speed HTML, XML, XSL (or any other
|
||||
structured code format) coding and editing. The core of this plugin is a
|
||||
powerful abbreviation engine which allows you to expand expressions?similar to
|
||||
CSS selectors?into HTML code:
|
||||
@@ -62,15 +62,15 @@ CSS selectors?into HTML code:
|
||||
</ul>
|
||||
</div>
|
||||
<
|
||||
Read more about current Zen Coding syntax
|
||||
http://code.google.com/p/zen-coding/wiki/ZenHTMLSelectorsEn
|
||||
Read more about current Emmet syntax
|
||||
http://docs.emmet.io/abbreviations/
|
||||
|
||||
Abbreviation engine has a modular structure which allows you to expand
|
||||
abbreviations into different languages. Zen Coding currently supports CSS,
|
||||
abbreviations into different languages. Emmet currently supports CSS,
|
||||
HTML, XML/XSL and HAML, Slim languages via filters.
|
||||
|
||||
==============================================================================
|
||||
INSTALL *zencoding-install*
|
||||
INSTALL *emmet-install*
|
||||
|
||||
Install the distributed files into Vim runtime directory which is usually
|
||||
~/.vim/, or $HOME/vimfiles on Windows.
|
||||
@@ -79,13 +79,13 @@ If you install pathogen that provided from Tim Pope, you should extract the
|
||||
file into 'bundle' directory.
|
||||
|
||||
==============================================================================
|
||||
TUTORIAL *zencoding-tutorial*
|
||||
TUTORIAL *emmet-tutorial*
|
||||
|
||||
If you are seeing this file as :help, then you can't edit this file.
|
||||
You should copy this section and create new buffer, paste and write as
|
||||
'zencoding-tutor.txt'. Formally, open the file to start tutorial.
|
||||
'emmet-tutor.txt'. Formally, open the file to start tutorial.
|
||||
|
||||
1. Expand Abbreviation *zencoding-expandabbr* *<C-Y>,*
|
||||
1. Expand Abbreviation *emmet-expandabbr* *<C-Y>,*
|
||||
|
||||
Type abbreviation as 'div>p#foo$*3>a' and type |<C-Y>,|.
|
||||
>
|
||||
@@ -101,7 +101,7 @@ You should copy this section and create new buffer, paste and write as
|
||||
</p>
|
||||
</div>
|
||||
<
|
||||
2. Wrap with Abbreviation *zencoding-wrap-with-abbreviation* *v_<C-Y>,*
|
||||
2. Wrap with Abbreviation *emmet-wrap-with-abbreviation* *v_<C-Y>,*
|
||||
|
||||
Write as below.
|
||||
>
|
||||
@@ -126,7 +126,7 @@ You should copy this section and create new buffer, paste and write as
|
||||
test3
|
||||
</blockquote>
|
||||
<
|
||||
3. Balance Tag Inward *zencoding-balance-tag-inward* *<C-Y>d*
|
||||
3. Balance Tag Inward *emmet-balance-tag-inward* *<C-Y>d*
|
||||
|
||||
To select inward of ul tag, type |<C-Y>d| in insert mode.
|
||||
>
|
||||
@@ -139,7 +139,7 @@ You should copy this section and create new buffer, paste and write as
|
||||
If cursor is at '*', |<C-Y>d| select from begin of <ul> to end of </ul>.
|
||||
If cursor is at first of <li>, it select <li class="list1"></li>.
|
||||
|
||||
4. Balance Tag Outward *zencoding-balance-tag-outward* *<C-Y>D*
|
||||
4. Balance Tag Outward *emmet-balance-tag-outward* *<C-Y>D*
|
||||
|
||||
To select outward of ul tag, insert mode, type <C-Y>D in insert mode.
|
||||
>
|
||||
@@ -153,7 +153,7 @@ You should copy this section and create new buffer, paste and write as
|
||||
letter of </ul>.
|
||||
If cursor is at first of <li>, it select <li class="list1"></li>.
|
||||
|
||||
5. Go to Next Edit Point *zencoding-goto-next-point* *<C-Y>n*
|
||||
5. Go to Next Edit Point *emmet-goto-next-point* *<C-Y>n*
|
||||
|
||||
To jump next point that need to edit, type |<C-Y>n| in insert mode.
|
||||
>
|
||||
@@ -164,7 +164,7 @@ You should copy this section and create new buffer, paste and write as
|
||||
specified id as 'foo'. And type again |<C-Y>n| move a cursor into inner of
|
||||
div specified id as 'bar'.
|
||||
|
||||
6. Go to Previous Edit Point *zencoding-goto-previous-point* *<C-Y>N*
|
||||
6. Go to Previous Edit Point *emmet-goto-previous-point* *<C-Y>N*
|
||||
|
||||
To jump previous point that need to edit, type |<C-Y>N| in insert mode.
|
||||
>
|
||||
@@ -174,7 +174,7 @@ You should copy this section and create new buffer, paste and write as
|
||||
If cursor is at '*', |<C-Y>N| move a cursor into div specified id as 'bar'.
|
||||
And type again |<C-Y>N| move a cursor into attribute value of 'foo'.
|
||||
|
||||
7. Update <img> Size *zencoding-update-image-size* *<C-Y>i*
|
||||
7. Update <img> Size *emmet-update-image-size* *<C-Y>i*
|
||||
|
||||
To expand or update size of image, type |<C-Y>i| on img tag
|
||||
>
|
||||
@@ -188,7 +188,7 @@ You should copy this section and create new buffer, paste and write as
|
||||
>
|
||||
<img src="foo-48.png" width="32" height="48" />
|
||||
<
|
||||
8. Merge Lines *zencoding-merge-lines*
|
||||
8. Merge Lines *emmet-merge-lines*
|
||||
|
||||
To join multi line text like following, type |J|.
|
||||
>
|
||||
@@ -205,7 +205,7 @@ You should copy this section and create new buffer, paste and write as
|
||||
<li class="list1"></li><li class="list2"></li><li class="list3"></li>
|
||||
</ul>
|
||||
<
|
||||
9. Remove Tag *zencoding-remove-tag* *<C-Y>k*
|
||||
9. Remove Tag *emmet-remove-tag* *<C-Y>k*
|
||||
|
||||
To remove tag in the block, type |<C-Y>k|.
|
||||
>
|
||||
@@ -221,7 +221,7 @@ You should copy this section and create new buffer, paste and write as
|
||||
<
|
||||
And type |<C-Y>k| in there again, then div will be removed.
|
||||
|
||||
10. Split/Join Tag *zencoding-split-join-tag* *<C-Y>j*
|
||||
10. Split/Join Tag *emmet-split-join-tag* *<C-Y>j*
|
||||
|
||||
To join block, type |<C-Y>j|.
|
||||
>
|
||||
@@ -238,7 +238,7 @@ You should copy this section and create new buffer, paste and write as
|
||||
<div class="foo">
|
||||
</div>
|
||||
<
|
||||
11. Toggle Comment *zencoding-toggle-comment* *<C-Y>/*
|
||||
11. Toggle Comment *emmet-toggle-comment* *<C-Y>/*
|
||||
|
||||
Move cursor to block
|
||||
>
|
||||
@@ -258,7 +258,7 @@ You should copy this section and create new buffer, paste and write as
|
||||
hello world
|
||||
</div>
|
||||
<
|
||||
12. Make anchor from URL *zencoding-make-anchor-url* *<C-Y>a*
|
||||
12. Make anchor from URL *emmet-make-anchor-url* *<C-Y>a*
|
||||
|
||||
Move cursor to URL
|
||||
>
|
||||
@@ -268,7 +268,7 @@ You should copy this section and create new buffer, paste and write as
|
||||
>
|
||||
<a href="http://www.google.com/">Google</a>
|
||||
<
|
||||
13. Make quoted text from URL *zencoding-quoted-text-url* *<C-Y>A*
|
||||
13. Make quoted text from URL *emmet-quoted-text-url* *<C-Y>A*
|
||||
|
||||
Move cursor to URL
|
||||
>
|
||||
@@ -282,7 +282,7 @@ You should copy this section and create new buffer, paste and write as
|
||||
<cite>http://github.com/</cite>
|
||||
</blockquote>
|
||||
<
|
||||
14. Code Pretty *zencoding-code-pretty* *<C-Y>c*
|
||||
14. Code Pretty *emmet-code-pretty* *<C-Y>c*
|
||||
|
||||
Select code block, for example select following code from "int main()".
|
||||
>
|
||||
@@ -298,7 +298,7 @@ You should copy this section and create new buffer, paste and write as
|
||||
puts(<span class="Constant">"hello world"</span>);<br />
|
||||
}<br />
|
||||
<
|
||||
15. Lorem Ipsum *zencoding-lorem-ipsum*
|
||||
15. Lorem Ipsum *emmet-lorem-ipsum*
|
||||
|
||||
To insert dummy text.
|
||||
>
|
||||
@@ -311,13 +311,13 @@ You should copy this section and create new buffer, paste and write as
|
||||
deserunt ab, veritatis commodi. Eius nobis ab deserunt magni iure quo
|
||||
laboriosam laboriosam.</div>
|
||||
<
|
||||
For japanese user, put like follow into your g:user_zen_settings:
|
||||
For japanese user, put like follow into your g:user_emmet_settings:
|
||||
>
|
||||
let g:user_zen_settings = {
|
||||
let g:user_emmet_settings = {
|
||||
...
|
||||
|
||||
\ 'custom_expands1' : {
|
||||
\ '^\%(lorem\|lipsum\)\(\d*\)$' : function('zencoding#lorem#ja#expand'),
|
||||
\ '^\%(lorem\|lipsum\)\(\d*\)$' : function('emmet#lorem#ja#expand'),
|
||||
\ },
|
||||
|
||||
...
|
||||
@@ -325,35 +325,35 @@ You should copy this section and create new buffer, paste and write as
|
||||
You will get japanese dummy text.
|
||||
>
|
||||
==============================================================================
|
||||
CUSTOMIZE *zencoding-customize*
|
||||
CUSTOMIZE *emmet-customize*
|
||||
|
||||
1. Key Mapping *zencoding-customize-keymappings*
|
||||
1. Key Mapping *emmet-customize-keymappings*
|
||||
|
||||
To specify leading key for expanding or balance tag, or for all,
|
||||
Add this line in your vimrc: >
|
||||
>
|
||||
let g:user_zen_leader_key = '<c-y>'
|
||||
let g:user_emmet_leader_key = '<c-y>'
|
||||
<
|
||||
Or if you prefer to map for each actions, then you set each variables.
|
||||
|
||||
'user_zen_expandabbr_key'
|
||||
'user_zen_expandword_key'
|
||||
'user_zen_balancetaginward_key'
|
||||
'user_zen_balancetagoutward_key'
|
||||
'user_zen_next_key'
|
||||
'user_zen_prev_key'
|
||||
'user_zen_imagesize_key'
|
||||
'user_zen_togglecomment_key'
|
||||
'user_zen_splitjointag_key'
|
||||
'user_zen_removetag_key'
|
||||
'user_zen_anchorizeurl_key'
|
||||
'user_zen_anchorizesummary_key'
|
||||
'user_emmet_expandabbr_key'
|
||||
'user_emmet_expandword_key'
|
||||
'user_emmet_balancetaginward_key'
|
||||
'user_emmet_balancetagoutward_key'
|
||||
'user_emmet_next_key'
|
||||
'user_emmet_prev_key'
|
||||
'user_emmet_imagesize_key'
|
||||
'user_emmet_togglecomment_key'
|
||||
'user_emmet_splitjointag_key'
|
||||
'user_emmet_removetag_key'
|
||||
'user_emmet_anchorizeurl_key'
|
||||
'user_emmet_anchorizesummary_key'
|
||||
|
||||
2. Indent Size *zencoding-indent-size*
|
||||
2. Indent Size *emmet-indent-size*
|
||||
|
||||
To change indent size of html, add this code in your vimrc.
|
||||
>
|
||||
let g:user_zen_settings = {
|
||||
let g:user_emmet_settings = {
|
||||
\ 'html' : {
|
||||
\ 'indentation' : ' '
|
||||
\ },
|
||||
@@ -361,17 +361,17 @@ CUSTOMIZE *zencoding-customize*
|
||||
<
|
||||
If you prefer to change global indent size then add this.
|
||||
>
|
||||
let g:user_zen_settings = {
|
||||
let g:user_emmet_settings = {
|
||||
\ 'indentation' : ' '
|
||||
\}
|
||||
<
|
||||
3. Define Tag's Behavior *zencoding-define-tags-behavior*
|
||||
3. Define Tag's Behavior *emmet-define-tags-behavior*
|
||||
|
||||
zencoding.vim can change behavior of expanding abbreviation for each
|
||||
filetypes as |Dictionary|. For details, see official site of zencoding.
|
||||
Emmet.vim can change behavior of expanding abbreviation for each
|
||||
filetypes as |Dictionary|. For details, see official site of Emmet.
|
||||
for example, vimmer can add following.
|
||||
>
|
||||
let g:user_zen_settings = {
|
||||
let g:user_emmet_settings = {
|
||||
\ 'lang' : 'ja',
|
||||
\ 'html' : {
|
||||
\ 'filters' : 'html',
|
||||
@@ -412,23 +412,29 @@ CUSTOMIZE *zencoding-customize*
|
||||
\ },
|
||||
\}
|
||||
<
|
||||
4. Complete Tag *zencoding-complete-tag*
|
||||
4. Complete Tag *emmet-complete-tag*
|
||||
|
||||
If you want to complete tags using |omnifunc| then add this.
|
||||
>
|
||||
let g:use_zen_complete_tag = 1
|
||||
let g:use_emmet_complete_tag = 1
|
||||
<
|
||||
|
||||
5. Enable functions in different mode
|
||||
|
||||
If you want to use zencoding only in some modes, set an mode option:
|
||||
If you want to use Emmet only in some modes, set an mode option:
|
||||
|
||||
let g:user_zen_mode='n' "only enable normal mode functions, or
|
||||
let g:user_zen_mode='inv' "enable all functions, which is equal to
|
||||
let g:user_zen_mode='a' "enable all function in all mode.
|
||||
let g:user_emmet_mode='n' "only enable normal mode functions, or
|
||||
let g:user_emmet_mode='inv' "enable all functions, which is equal to
|
||||
let g:user_emmet_mode='a' "enable all function in all mode.
|
||||
|
||||
==============================================================================
|
||||
LINKS *zencoding-links*
|
||||
LINKS *emmet-links*
|
||||
|
||||
Emmet official site:
|
||||
http://emmet.io/
|
||||
|
||||
zen-coding official site:
|
||||
http://code.google.com/p/zen-coding/
|
||||
|
||||
zen-coding official site:
|
||||
http://code.google.com/p/zen-coding/
|
||||
@@ -453,11 +459,11 @@ tutorial translated in Chinese:
|
||||
http://www.zfanw.com/blog/zencoding-vim-tutorial-chinese.html
|
||||
|
||||
==============================================================================
|
||||
TODO *zencoding-todo*
|
||||
TODO *emmet-todo*
|
||||
* wrapping inline selected.
|
||||
* more documents.
|
||||
* more contributor.
|
||||
* more time to improve zencoding.vim.
|
||||
* more time to improve emmet.vim.
|
||||
|
||||
==============================================================================
|
||||
vim:tw=78:ts=8:ft=help:norl:noet:fen:fdl=0:
|
||||
@@ -1,21 +1,21 @@
|
||||
script_name: ZenCoding.vim
|
||||
script_name: Emmet.vim
|
||||
script_id: '2981'
|
||||
script_type: utility
|
||||
script_package: zencoding-vim.zip
|
||||
script_package: emmet-vim.zip
|
||||
script_version: '0.80'
|
||||
required_vim_version: '7.0'
|
||||
summary: vim plugins for HTML and CSS hi-speed coding.
|
||||
|
||||
detailed_description: |
|
||||
|
||||
This is vim script support expanding abbreviation like zen-coding.
|
||||
ref: http://code.google.com/p/zen-coding/
|
||||
This is vim script support expanding abbreviation like emmet.
|
||||
ref: http://emmet.io/
|
||||
|
||||
There is a movie using zencoding.vim
|
||||
ref: http://mattn.github.com/zencoding-vim
|
||||
There is a movie using emmet.vim
|
||||
ref: http://mattn.github.com/emmet-vim
|
||||
|
||||
Source Repository.
|
||||
ref: http://github.com/mattn/zencoding-vim
|
||||
ref: http://github.com/mattn/emmet-vim
|
||||
|
||||
Type abbreviation
|
||||
+-------------------------------------
|
||||
@@ -52,18 +52,18 @@ detailed_description: |
|
||||
|
||||
Tutorial:
|
||||
|
||||
http://github.com/mattn/zencoding-vim/raw/master/TUTORIAL
|
||||
http://github.com/mattn/emmet-vim/raw/master/TUTORIAL
|
||||
|
||||
How work this:
|
||||
|
||||
http://mattn.github.com/zencoding-vim
|
||||
http://mattn.github.com/emmet-vim
|
||||
|
||||
Tips:
|
||||
|
||||
You can customize behavior of expanding with overriding config.
|
||||
This configuration will be merged at loading plugin.
|
||||
|
||||
let g:user_zen_settings = {
|
||||
let g:user_emmet_settings = {
|
||||
\ 'indentation' : ' ',
|
||||
\ 'perl' : {
|
||||
\ 'aliases' : {
|
||||
@@ -76,28 +76,30 @@ detailed_description: |
|
||||
\ }
|
||||
\}
|
||||
|
||||
let g:user_zen_expandabbr_key = '<c-e>'
|
||||
let g:user_emmet_expandabbr_key = '<c-e>'
|
||||
|
||||
let g:use_zen_complete_tag = 1
|
||||
let g:use_emmet_complete_tag = 1
|
||||
|
||||
You can set language attribute in html using zen_settings['lang'].
|
||||
You can set language attribute in html using emmet_settings['lang'].
|
||||
|
||||
install_details: |
|
||||
|
||||
# cd ~/.vim
|
||||
# unzip zencoding-vim.zip
|
||||
# unzip emmet-vim.zip
|
||||
|
||||
or if you install pathogen.vim:
|
||||
|
||||
# cd ~/.vim/bundle # or make directory
|
||||
# unzip /path/to/zencoding-vim.zip
|
||||
# unzip /path/to/emmet-vim.zip
|
||||
|
||||
if you get sources from repository:
|
||||
|
||||
# cd ~/.vim/bundle # or make directory
|
||||
# git clone http://github.com/mattn/zencoding-vim.git
|
||||
# git clone http://github.com/mattn/emmet-vim.git
|
||||
|
||||
versions:
|
||||
- '0.81': |
|
||||
Release of Emmet.vim: renamed from ZenCoding.vim.
|
||||
- '0.80': |
|
||||
This is an upgrade for ZenCoding.vim: add emmet features.
|
||||
- '0.74': |
|
||||
215
plugin/emmet.vim
Normal file
215
plugin/emmet.vim
Normal file
@@ -0,0 +1,215 @@
|
||||
"=============================================================================
|
||||
" File: emmet.vim
|
||||
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
||||
" Last Change: 06-Aug-2013.
|
||||
" Version: 0.75
|
||||
" WebPage: http://github.com/mattn/emmet-vim
|
||||
" Description: vim plugins for HTML and CSS hi-speed coding.
|
||||
" SeeAlso: http://emmet.io/
|
||||
" Usage:
|
||||
"
|
||||
" This is vim script support expanding abbreviation like emmet.
|
||||
" ref: http://emmet.io/
|
||||
"
|
||||
" Type abbreviation
|
||||
" +-------------------------------------
|
||||
" | html:5_
|
||||
" +-------------------------------------
|
||||
" "_" is a cursor position. and type "<c-y>," (Ctrl+y and Comma)
|
||||
" NOTE: Don't worry about key map. you can change it easily.
|
||||
" +-------------------------------------
|
||||
" | <!DOCTYPE HTML>
|
||||
" | <html lang="en">
|
||||
" | <head>
|
||||
" | <title></title>
|
||||
" | <meta charset="UTF-8">
|
||||
" | </head>
|
||||
" | <body>
|
||||
" | _
|
||||
" | </body>
|
||||
" | </html>
|
||||
" +-------------------------------------
|
||||
" Type following
|
||||
" +-------------------------------------
|
||||
" | div#foo$*2>div.bar
|
||||
" +-------------------------------------
|
||||
" And type "<c-y>,"
|
||||
" +-------------------------------------
|
||||
" |<div id="foo1">
|
||||
" | <div class="bar">_</div>
|
||||
" |</div>
|
||||
" |<div id="foo2">
|
||||
" | <div class="bar"></div>
|
||||
" |</div>
|
||||
" +-------------------------------------
|
||||
"
|
||||
" Tips:
|
||||
"
|
||||
" You can customize behavior of expanding with overriding config.
|
||||
" This configuration will be marged at loading plugin.
|
||||
"
|
||||
" let g:user_emmet_settings = {
|
||||
" \ 'indentation' : ' ',
|
||||
" \ 'perl' : {
|
||||
" \ 'aliases' : {
|
||||
" \ 'req' : 'require '
|
||||
" \ },
|
||||
" \ 'snippets' : {
|
||||
" \ 'use' : "use strict\nuse warnings\n\n",
|
||||
" \ 'warn' : "warn \"|\";",
|
||||
" \ }
|
||||
" \ }
|
||||
" \}
|
||||
"
|
||||
" You can set language attribute in html using 'emmet_settings.lang'.
|
||||
"
|
||||
" GetLatestVimScripts: 2981 1 :AutoInstall: emmet.vim
|
||||
" script type: plugin
|
||||
|
||||
if &cp || v:version < 702 || (exists('g:loaded_emmet_vim') && g:loaded_emmet_vim)
|
||||
finish
|
||||
endif
|
||||
let g:loaded_emmet_vim = 1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
if !exists('g:emmet_debug')
|
||||
let g:emmet_debug = 0
|
||||
endif
|
||||
|
||||
if !exists('g:emmet_curl_command')
|
||||
let g:emmet_curl_command = 'curl -s -L -A Mozilla/5.0'
|
||||
endif
|
||||
|
||||
if exists('g:use_emmet_complete_tag') && g:use_emmet_complete_tag
|
||||
setlocal omnifunc=emmet#CompleteTag
|
||||
endif
|
||||
|
||||
if !exists('g:user_emmet_leader_key')
|
||||
let g:user_emmet_leader_key = '<c-y>'
|
||||
endif
|
||||
|
||||
function! s:install_plugin_i()
|
||||
for item in [
|
||||
\ {'mode': 'i', 'var': 'user_emmet_expandabbr_key', 'key': ',', 'plug': 'EmmetExpandAbbr', 'func': '<c-g>u<esc>:call emmet#expandAbbr(0,"")<cr>a'},
|
||||
\ {'mode': 'i', 'var': 'user_emmet_expandword_key', 'key': ';', 'plug': 'EmmetExpandWord', 'func': '<c-g>u<esc>:call emmet#expandAbbr(1,"")<cr>a'},
|
||||
\ {'mode': 'i', 'var': 'user_emmet_balancetaginward_key', 'key': 'd', 'plug': 'EmmetBalanceTagInwardInsert', 'func': '<esc>:call emmet#balanceTag(1)<cr>'},
|
||||
\ {'mode': 'i', 'var': 'user_emmet_balancetagoutward_key', 'key': 'D', 'plug': 'EmmetBalanceTagOutwardInsert', 'func': '<esc>:call emmet#balanceTag(-1)<cr>'},
|
||||
\ {'mode': 'i', 'var': 'user_emmet_next_key', 'key': 'n', 'plug': 'EmmetNext', 'func': '<esc>:call emmet#moveNextPrev(0)<cr>'},
|
||||
\ {'mode': 'i', 'var': 'user_emmet_prev_key', 'key': 'N', 'plug': 'EmmetPrev', 'func': '<esc>:call emmet#moveNextPrev(1)<cr>'},
|
||||
\ {'mode': 'i', 'var': 'user_emmet_imagesize_key', 'key': 'i', 'plug': 'EmmetImageSize', 'func': '<esc>:call emmet#imageSize()<cr>a'},
|
||||
\ {'mode': 'i', 'var': 'user_emmet_togglecomment_key', 'key': '/', 'plug': 'EmmetToggleComment', 'func': '<esc>:call emmet#toggleComment()<cr>a'},
|
||||
\ {'mode': 'i', 'var': 'user_emmet_splitjointag_key', 'key': 'j', 'plug': 'EmmetSplitJoinTagInsert', 'func': '<esc>:call emmet#splitJoinTag()<cr>'},
|
||||
\ {'mode': 'i', 'var': 'user_emmet_removetag_key', 'key': 'k', 'plug': 'EmmetRemoveTag', 'func': '<esc>:call emmet#removeTag()<cr>a'},
|
||||
\ {'mode': 'i', 'var': 'user_emmet_anchorizeurl_key', 'key': 'a', 'plug': 'EmmetAnchorizeURL', 'func': '<esc>:call emmet#anchorizeURL(0)<cr>a'},
|
||||
\ {'mode': 'i', 'var': 'user_emmet_anchorizesummary_key', 'key': 'A', 'plug': 'EmmetAnchorizeSummary', 'func': '<esc>:call emmet#anchorizeURL(1)<cr>a'},
|
||||
\]
|
||||
|
||||
if !hasmapto('<plug>'.item.plug, item.mode)
|
||||
exe item.mode . 'noremap <plug>' . item.plug . ' ' . item.func
|
||||
endif
|
||||
if !exists('g:' . item.var)
|
||||
endif
|
||||
if exists('g:' . item.var)
|
||||
let key = eval('g:' . item.var)
|
||||
else
|
||||
let key = g:user_emmet_leader_key . item.key
|
||||
endif
|
||||
if len(maparg(key, item.mode)) == 0
|
||||
exe item.mode . 'map <unique> ' . key . ' <plug>' . item.plug
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! s:install_plugin_n()
|
||||
for item in [
|
||||
\ {'mode': 'n', 'var': 'user_emmet_expandabbr_key', 'key': ',', 'plug': 'EmmetExpandNormal', 'func': ':call emmet#expandAbbr(3,"")<cr>'},
|
||||
\ {'mode': 'n', 'var': 'user_emmet_expandword_key', 'key': ',', 'plug': 'EmmetExpandWord', 'func': ':call emmet#expandAbbr(1,"")<cr>'},
|
||||
\ {'mode': 'n', 'var': 'user_emmet_balancetaginward_key', 'key': 'd', 'plug': 'EmmetBalanceTagInwardNormal', 'func': ':call emmet#balanceTag(1)<cr>'},
|
||||
\ {'mode': 'n', 'var': 'user_emmet_balancetagoutward_key', 'key': 'D', 'plug': 'EmmetBalanceTagOutwardNormal', 'func': ':call emmet#balanceTag(-1)<cr>'},
|
||||
\ {'mode': 'n', 'var': 'user_emmet_next_key', 'key': 'n', 'plug': 'EmmetNext', 'func': ':call emmet#moveNextPrev(0)<cr>'},
|
||||
\ {'mode': 'n', 'var': 'user_emmet_prev_key', 'key': 'N', 'plug': 'EmmetPrev', 'func': ':call emmet#moveNextPrev(1)<cr>'},
|
||||
\ {'mode': 'n', 'var': 'user_emmet_imagesize_key', 'key': 'i', 'plug': 'EmmetImageSize', 'func': ':call emmet#imageSize()<cr>'},
|
||||
\ {'mode': 'n', 'var': 'user_emmet_togglecomment_key', 'key': '/', 'plug': 'EmmetToggleComment', 'func': ':call emmet#toggleComment()<cr>'},
|
||||
\ {'mode': 'n', 'var': 'user_emmet_splitjointag_key', 'key': 'j', 'plug': 'EmmetSplitJoinTagNormal', 'func': ':call emmet#splitJoinTag()<cr>'},
|
||||
\ {'mode': 'n', 'var': 'user_emmet_removetag_key', 'key': 'k', 'plug': 'EmmetRemoveTag', 'func': ':call emmet#removeTag()<cr>'},
|
||||
\ {'mode': 'n', 'var': 'user_emmet_anchorizeurl_key', 'key': 'a', 'plug': 'EmmetAnchorizeURL', 'func': ':call emmet#anchorizeURL(0)<cr>'},
|
||||
\ {'mode': 'n', 'var': 'user_emmet_anchorizesummary_key', 'key': 'A', 'plug': 'EmmetAnchorizeSummary', 'func': ':call emmet#anchorizeURL(1)<cr>'},
|
||||
\]
|
||||
|
||||
if !hasmapto('<plug>'.item.plug, item.mode)
|
||||
exe item.mode . 'noremap <plug>' . item.plug . ' ' . item.func
|
||||
endif
|
||||
if !exists('g:' . item.var)
|
||||
endif
|
||||
if exists('g:' . item.var)
|
||||
let key = eval('g:' . item.var)
|
||||
else
|
||||
let key = g:user_emmet_leader_key . item.key
|
||||
endif
|
||||
if len(maparg(key, item.mode)) == 0
|
||||
exe item.mode . 'map <unique> ' . key . ' <plug>' . item.plug
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! s:install_plugin_v()
|
||||
for item in [
|
||||
\ {'mode': 'v', 'var': 'user_emmet_expandabbr_key', 'key': ',', 'plug': 'EmmetExpandVisual', 'func': ':call emmet#expandAbbr(2,"")<cr>'},
|
||||
\ {'mode': 'v', 'var': 'user_emmet_balancetaginward_key', 'key': 'd', 'plug': 'EmmetBalanceTagInwardVisual', 'func': ':call emmet#balanceTag(2)<cr>'},
|
||||
\ {'mode': 'v', 'var': 'user_emmet_balancetagoutward_key', 'key': 'D', 'plug': 'EmmetBalanceTagOutwardVisual', 'func': ':call emmet#balanceTag(-2)<cr>'},
|
||||
\ {'mode': 'v', 'var': 'user_emmet_mergelines_key', 'key': 'm', 'plug': 'EmmetMergeLines', 'func': ':call emmet#mergeLines()<cr>'},
|
||||
\ {'mode': 'v', 'var': 'user_emmet_codepretty_key', 'key': 'c', 'plug': 'EmmetCodePretty', 'func': ':call emmet#codePretty()<cr>'},
|
||||
\]
|
||||
|
||||
if !hasmapto('<plug>'.item.plug, item.mode)
|
||||
exe item.mode . 'noremap <plug>' . item.plug . ' ' . item.func
|
||||
endif
|
||||
if !exists('g:' . item.var)
|
||||
endif
|
||||
if exists('g:' . item.var)
|
||||
let key = eval('g:' . item.var)
|
||||
else
|
||||
let key = g:user_emmet_leader_key . item.key
|
||||
endif
|
||||
if len(maparg(key, item.mode)) == 0
|
||||
exe item.mode . 'map <unique> ' . key . ' <plug>' . item.plug
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
|
||||
if exists('g:user_emmet_mode')
|
||||
let imode = matchstr(g:user_emmet_mode, '[ai]')
|
||||
let nmode = matchstr(g:user_emmet_mode, '[an]')
|
||||
let vmode = matchstr(g:user_emmet_mode, '[av]')
|
||||
|
||||
if !empty(imode)
|
||||
call s:install_plugin_i()
|
||||
endif
|
||||
|
||||
if !empty(nmode)
|
||||
call s:install_plugin_n()
|
||||
endif
|
||||
|
||||
if !empty(vmode)
|
||||
call s:install_plugin_v()
|
||||
endif
|
||||
else
|
||||
call s:install_plugin_i()
|
||||
call s:install_plugin_n()
|
||||
call s:install_plugin_v()
|
||||
endif
|
||||
|
||||
|
||||
delfunction s:install_plugin_i
|
||||
delfunction s:install_plugin_n
|
||||
delfunction s:install_plugin_v
|
||||
|
||||
command! -nargs=1 Emmet call emmet#expandAbbr(4, <q-args>)
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim:set et:
|
||||
@@ -1,215 +0,0 @@
|
||||
"=============================================================================
|
||||
" File: zencoding.vim
|
||||
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
||||
" Last Change: 17-Jun-2013.
|
||||
" Version: 0.75
|
||||
" 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/
|
||||
" Usage:
|
||||
"
|
||||
" This is vim script support expanding abbreviation like zen-coding.
|
||||
" ref: http://code.google.com/p/zen-coding/
|
||||
"
|
||||
" Type abbreviation
|
||||
" +-------------------------------------
|
||||
" | html:5_
|
||||
" +-------------------------------------
|
||||
" "_" is a cursor position. and type "<c-y>," (Ctrl+y and Comma)
|
||||
" NOTE: Don't worry about key map. you can change it easily.
|
||||
" +-------------------------------------
|
||||
" | <!DOCTYPE HTML>
|
||||
" | <html lang="en">
|
||||
" | <head>
|
||||
" | <title></title>
|
||||
" | <meta charset="UTF-8">
|
||||
" | </head>
|
||||
" | <body>
|
||||
" | _
|
||||
" | </body>
|
||||
" | </html>
|
||||
" +-------------------------------------
|
||||
" Type following
|
||||
" +-------------------------------------
|
||||
" | div#foo$*2>div.bar
|
||||
" +-------------------------------------
|
||||
" And type "<c-y>,"
|
||||
" +-------------------------------------
|
||||
" |<div id="foo1">
|
||||
" | <div class="bar">_</div>
|
||||
" |</div>
|
||||
" |<div id="foo2">
|
||||
" | <div class="bar"></div>
|
||||
" |</div>
|
||||
" +-------------------------------------
|
||||
"
|
||||
" Tips:
|
||||
"
|
||||
" You can customize behavior of expanding with overriding config.
|
||||
" This configuration will be marged at loading plugin.
|
||||
"
|
||||
" let g:user_zen_settings = {
|
||||
" \ 'indentation' : ' ',
|
||||
" \ 'perl' : {
|
||||
" \ 'aliases' : {
|
||||
" \ 'req' : 'require '
|
||||
" \ },
|
||||
" \ 'snippets' : {
|
||||
" \ 'use' : "use strict\nuse warnings\n\n",
|
||||
" \ 'warn' : "warn \"|\";",
|
||||
" \ }
|
||||
" \ }
|
||||
" \}
|
||||
"
|
||||
" You can set language attribute in html using 'zen_settings.lang'.
|
||||
"
|
||||
" GetLatestVimScripts: 2981 1 :AutoInstall: zencoding.vim
|
||||
" script type: plugin
|
||||
|
||||
if &cp || v:version < 702 || (exists('g:loaded_zencoding_vim') && g:loaded_zencoding_vim)
|
||||
finish
|
||||
endif
|
||||
let g:loaded_zencoding_vim = 1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
if !exists('g:zencoding_debug')
|
||||
let g:zencoding_debug = 0
|
||||
endif
|
||||
|
||||
if !exists('g:zencoding_curl_command')
|
||||
let g:zencoding_curl_command = 'curl -s -L -A Mozilla/5.0'
|
||||
endif
|
||||
|
||||
if exists('g:use_zen_complete_tag') && g:use_zen_complete_tag
|
||||
setlocal omnifunc=zencoding#CompleteTag
|
||||
endif
|
||||
|
||||
if !exists('g:user_zen_leader_key')
|
||||
let g:user_zen_leader_key = '<c-y>'
|
||||
endif
|
||||
|
||||
function! s:install_plugin_i()
|
||||
for item in [
|
||||
\ {'mode': 'i', 'var': 'user_zen_expandabbr_key', 'key': ',', 'plug': 'ZenCodingExpandAbbr', 'func': '<c-g>u<esc>:call zencoding#expandAbbr(0,"")<cr>a'},
|
||||
\ {'mode': 'i', 'var': 'user_zen_expandword_key', 'key': ';', 'plug': 'ZenCodingExpandWord', 'func': '<c-g>u<esc>:call zencoding#expandAbbr(1,"")<cr>a'},
|
||||
\ {'mode': 'i', 'var': 'user_zen_balancetaginward_key', 'key': 'd', 'plug': 'ZenCodingBalanceTagInwardInsert', 'func': '<esc>:call zencoding#balanceTag(1)<cr>'},
|
||||
\ {'mode': 'i', 'var': 'user_zen_balancetagoutward_key', 'key': 'D', 'plug': 'ZenCodingBalanceTagOutwardInsert', 'func': '<esc>:call zencoding#balanceTag(-1)<cr>'},
|
||||
\ {'mode': 'i', 'var': 'user_zen_next_key', 'key': 'n', 'plug': 'ZenCodingNext', 'func': '<esc>:call zencoding#moveNextPrev(0)<cr>'},
|
||||
\ {'mode': 'i', 'var': 'user_zen_prev_key', 'key': 'N', 'plug': 'ZenCodingPrev', 'func': '<esc>:call zencoding#moveNextPrev(1)<cr>'},
|
||||
\ {'mode': 'i', 'var': 'user_zen_imagesize_key', 'key': 'i', 'plug': 'ZenCodingImageSize', 'func': '<esc>:call zencoding#imageSize()<cr>a'},
|
||||
\ {'mode': 'i', 'var': 'user_zen_togglecomment_key', 'key': '/', 'plug': 'ZenCodingToggleComment', 'func': '<esc>:call zencoding#toggleComment()<cr>a'},
|
||||
\ {'mode': 'i', 'var': 'user_zen_splitjointag_key', 'key': 'j', 'plug': 'ZenCodingSplitJoinTagInsert', 'func': '<esc>:call zencoding#splitJoinTag()<cr>'},
|
||||
\ {'mode': 'i', 'var': 'user_zen_removetag_key', 'key': 'k', 'plug': 'ZenCodingRemoveTag', 'func': '<esc>:call zencoding#removeTag()<cr>a'},
|
||||
\ {'mode': 'i', 'var': 'user_zen_anchorizeurl_key', 'key': 'a', 'plug': 'ZenCodingAnchorizeURL', 'func': '<esc>:call zencoding#anchorizeURL(0)<cr>a'},
|
||||
\ {'mode': 'i', 'var': 'user_zen_anchorizesummary_key', 'key': 'A', 'plug': 'ZenCodingAnchorizeSummary', 'func': '<esc>:call zencoding#anchorizeURL(1)<cr>a'},
|
||||
\]
|
||||
|
||||
if !hasmapto('<plug>'.item.plug, item.mode)
|
||||
exe item.mode . 'noremap <plug>' . item.plug . ' ' . item.func
|
||||
endif
|
||||
if !exists('g:' . item.var)
|
||||
endif
|
||||
if exists('g:' . item.var)
|
||||
let key = eval('g:' . item.var)
|
||||
else
|
||||
let key = g:user_zen_leader_key . item.key
|
||||
endif
|
||||
if len(maparg(key, item.mode)) == 0
|
||||
exe item.mode . 'map <unique> ' . key . ' <plug>' . item.plug
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! s:install_plugin_n()
|
||||
for item in [
|
||||
\ {'mode': 'n', 'var': 'user_zen_expandabbr_key', 'key': ',', 'plug': 'ZenCodingExpandNormal', 'func': ':call zencoding#expandAbbr(3,"")<cr>'},
|
||||
\ {'mode': 'n', 'var': 'user_zen_expandword_key', 'key': ',', 'plug': 'ZenCodingExpandWord', 'func': ':call zencoding#expandAbbr(1,"")<cr>'},
|
||||
\ {'mode': 'n', 'var': 'user_zen_balancetaginward_key', 'key': 'd', 'plug': 'ZenCodingBalanceTagInwardNormal', 'func': ':call zencoding#balanceTag(1)<cr>'},
|
||||
\ {'mode': 'n', 'var': 'user_zen_balancetagoutward_key', 'key': 'D', 'plug': 'ZenCodingBalanceTagOutwardNormal', 'func': ':call zencoding#balanceTag(-1)<cr>'},
|
||||
\ {'mode': 'n', 'var': 'user_zen_next_key', 'key': 'n', 'plug': 'ZenCodingNext', 'func': ':call zencoding#moveNextPrev(0)<cr>'},
|
||||
\ {'mode': 'n', 'var': 'user_zen_prev_key', 'key': 'N', 'plug': 'ZenCodingPrev', 'func': ':call zencoding#moveNextPrev(1)<cr>'},
|
||||
\ {'mode': 'n', 'var': 'user_zen_imagesize_key', 'key': 'i', 'plug': 'ZenCodingImageSize', 'func': ':call zencoding#imageSize()<cr>'},
|
||||
\ {'mode': 'n', 'var': 'user_zen_togglecomment_key', 'key': '/', 'plug': 'ZenCodingToggleComment', 'func': ':call zencoding#toggleComment()<cr>'},
|
||||
\ {'mode': 'n', 'var': 'user_zen_splitjointag_key', 'key': 'j', 'plug': 'ZenCodingSplitJoinTagNormal', 'func': ':call zencoding#splitJoinTag()<cr>'},
|
||||
\ {'mode': 'n', 'var': 'user_zen_removetag_key', 'key': 'k', 'plug': 'ZenCodingRemoveTag', 'func': ':call zencoding#removeTag()<cr>'},
|
||||
\ {'mode': 'n', 'var': 'user_zen_anchorizeurl_key', 'key': 'a', 'plug': 'ZenCodingAnchorizeURL', 'func': ':call zencoding#anchorizeURL(0)<cr>'},
|
||||
\ {'mode': 'n', 'var': 'user_zen_anchorizesummary_key', 'key': 'A', 'plug': 'ZenCodingAnchorizeSummary', 'func': ':call zencoding#anchorizeURL(1)<cr>'},
|
||||
\]
|
||||
|
||||
if !hasmapto('<plug>'.item.plug, item.mode)
|
||||
exe item.mode . 'noremap <plug>' . item.plug . ' ' . item.func
|
||||
endif
|
||||
if !exists('g:' . item.var)
|
||||
endif
|
||||
if exists('g:' . item.var)
|
||||
let key = eval('g:' . item.var)
|
||||
else
|
||||
let key = g:user_zen_leader_key . item.key
|
||||
endif
|
||||
if len(maparg(key, item.mode)) == 0
|
||||
exe item.mode . 'map <unique> ' . key . ' <plug>' . item.plug
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! s:install_plugin_v()
|
||||
for item in [
|
||||
\ {'mode': 'v', 'var': 'user_zen_expandabbr_key', 'key': ',', 'plug': 'ZenCodingExpandVisual', 'func': ':call zencoding#expandAbbr(2,"")<cr>'},
|
||||
\ {'mode': 'v', 'var': 'user_zen_balancetaginward_key', 'key': 'd', 'plug': 'ZenCodingBalanceTagInwardVisual', 'func': ':call zencoding#balanceTag(2)<cr>'},
|
||||
\ {'mode': 'v', 'var': 'user_zen_balancetagoutward_key', 'key': 'D', 'plug': 'ZenCodingBalanceTagOutwardVisual', 'func': ':call zencoding#balanceTag(-2)<cr>'},
|
||||
\ {'mode': 'v', 'var': 'user_zen_mergelines_key', 'key': 'm', 'plug': 'ZenCodingMergeLines', 'func': ':call zencoding#mergeLines()<cr>'},
|
||||
\ {'mode': 'v', 'var': 'user_zen_codepretty_key', 'key': 'c', 'plug': 'ZenCodingCodePretty', 'func': ':call zencoding#codePretty()<cr>'},
|
||||
\]
|
||||
|
||||
if !hasmapto('<plug>'.item.plug, item.mode)
|
||||
exe item.mode . 'noremap <plug>' . item.plug . ' ' . item.func
|
||||
endif
|
||||
if !exists('g:' . item.var)
|
||||
endif
|
||||
if exists('g:' . item.var)
|
||||
let key = eval('g:' . item.var)
|
||||
else
|
||||
let key = g:user_zen_leader_key . item.key
|
||||
endif
|
||||
if len(maparg(key, item.mode)) == 0
|
||||
exe item.mode . 'map <unique> ' . key . ' <plug>' . item.plug
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
|
||||
if exists('g:user_zen_mode')
|
||||
let imode = matchstr(g:user_zen_mode, '[ai]')
|
||||
let nmode = matchstr(g:user_zen_mode, '[an]')
|
||||
let vmode = matchstr(g:user_zen_mode, '[av]')
|
||||
|
||||
if !empty(imode)
|
||||
call s:install_plugin_i()
|
||||
endif
|
||||
|
||||
if !empty(nmode)
|
||||
call s:install_plugin_n()
|
||||
endif
|
||||
|
||||
if !empty(vmode)
|
||||
call s:install_plugin_v()
|
||||
endif
|
||||
else
|
||||
call s:install_plugin_i()
|
||||
call s:install_plugin_n()
|
||||
call s:install_plugin_v()
|
||||
endif
|
||||
|
||||
|
||||
delfunction s:install_plugin_i
|
||||
delfunction s:install_plugin_n
|
||||
delfunction s:install_plugin_v
|
||||
|
||||
command! -nargs=1 Zen call zencoding#expandAbbr(4, <q-args>)
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim:set et:
|
||||
28
unittest.vim
28
unittest.vim
@@ -1,7 +1,7 @@
|
||||
let s:sfile = expand('<sfile>')
|
||||
|
||||
function! s:reload(d)
|
||||
exe "so" a:d."/plugin/zencoding.vim"
|
||||
exe "so" a:d."/plugin/emmet.vim"
|
||||
for f in split(globpath(a:d, 'autoload/**/*.vim'), "\n")
|
||||
silent! exe "so" f
|
||||
endfor
|
||||
@@ -117,7 +117,7 @@ function! s:test(...)
|
||||
call s:show_title(n+1, query)
|
||||
else
|
||||
call s:show_title(n+1, query)
|
||||
unlet! res | let res = zencoding#ExpandWord(query, testgroup.type, 0)
|
||||
unlet! res | let res = emmet#ExpandWord(query, testgroup.type, 0)
|
||||
endif
|
||||
if stridx(result, '$$$$') != -1
|
||||
if res ==# result
|
||||
@@ -140,9 +140,9 @@ endfunction
|
||||
|
||||
function! s:do_tests(...)
|
||||
try
|
||||
if exists('g:user_zen_settings')
|
||||
let s:old_user_zen_settings = g:user_zen_settings
|
||||
let g:user_zen_settings = { 'indentation': "\t" }
|
||||
if exists('g:user_emmet_settings')
|
||||
let s:old_user_emmet_settings = g:user_emmet_settings
|
||||
let g:user_emmet_settings = { 'indentation': "\t" }
|
||||
endif
|
||||
let oldmore = &more
|
||||
call s:reload(fnamemodify(s:sfile, ':h'))
|
||||
@@ -153,13 +153,13 @@ function! s:do_tests(...)
|
||||
echohl ErrorMsg | echomsg v:exception | echohl None
|
||||
finally
|
||||
let &more=oldmore
|
||||
if exists('g:user_zen_settings')
|
||||
let g:user_zen_settings = s:old_user_zen_settings
|
||||
if exists('g:user_emmet_settings')
|
||||
let g:user_emmet_settings = s:old_user_emmet_settings
|
||||
endif
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
function! g:zencoding_unittest_complete(arglead, cmdline, cmdpos)
|
||||
function! g:emmet_unittest_complete(arglead, cmdline, cmdpos)
|
||||
let args = split(a:cmdline, '\s\+', 1)
|
||||
let testgroups = eval(join(filter(split(substitute(join(readfile(s:sfile), "\n"), '.*\nfinish\n', '', ''), '\n', 1), "v:val !~ '^\"'")))
|
||||
try
|
||||
@@ -173,9 +173,9 @@ function! g:zencoding_unittest_complete(arglead, cmdline, cmdpos)
|
||||
return []
|
||||
endfunction
|
||||
|
||||
command! -nargs=* -complete=customlist,g:zencoding_unittest_complete ZenCodingUnitTest call s:do_tests(<f-args>)
|
||||
command! -nargs=* -complete=customlist,g:emmet_unittest_complete EmmetUnitTest call s:do_tests(<f-args>)
|
||||
if s:sfile == expand('%:p')
|
||||
ZenCodingUnitTest
|
||||
EmmetUnitTest
|
||||
endif
|
||||
|
||||
finish
|
||||
@@ -255,8 +255,8 @@ finish
|
||||
'result': "<a href=\"http://www.google.com/\">Google</a>\n",
|
||||
},
|
||||
{
|
||||
'query': "{ZenCoding}",
|
||||
'result': "ZenCoding",
|
||||
'query': "{Emmet}",
|
||||
'result': "Emmet",
|
||||
},
|
||||
{
|
||||
'query': "a+b",
|
||||
@@ -768,7 +768,7 @@ finish
|
||||
},
|
||||
{
|
||||
'query': "ap>wp",
|
||||
'result': "<xsl:apply-templates select=\"\" mode=\"\">\n\t<xsl:with-param name=\"\" select=\"\"></xsl:with-param>\n</xsl:apply-templates>\n",
|
||||
'result': "<xsl:apply-templates select=\"\" mode=\"\">\n <xsl:with-param name=\"\" select=\"\"></xsl:with-param>\n</xsl:apply-templates>\n",
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -782,7 +782,7 @@ finish
|
||||
'tests': [
|
||||
{
|
||||
'query': "xsd:w3c",
|
||||
'result': "<?xml version=\"1.0\"?>\n<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n\t<xsd:element name=\"\" type=\"\"/>\n</xsd:schema>",
|
||||
'result': "<?xml version=\"1.0\"?>\n<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n <xsd:element name=\"\" type=\"\"/>\n</xsd:schema>",
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user