From 9a4412e8167aa1cf4e033b96e81e9aa809c27d5d Mon Sep 17 00:00:00 2001 From: mattn Date: Fri, 12 Mar 2010 09:42:45 +0900 Subject: [PATCH 1/6] accept extends type from zen_settings. --- zencoding.vim | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/zencoding.vim b/zencoding.vim index 6d34289..6cc8444 100644 --- a/zencoding.vim +++ b/zencoding.vim @@ -1,7 +1,7 @@ "============================================================================= " File: zencoding.vim " Author: Yasuhiro Matsumoto -" Last Change: 11-Mar-2010. +" Last Change: 12-Mar-2010. " Version: 0.31 " WebPage: http://github.com/mattn/zencoding-vim " Description: vim plugins for HTML and CSS hi-speed coding. @@ -1153,9 +1153,9 @@ function! s:zen_toString(...) if len(tmp) let str .= '{' . tmp . ' }' endif - if stridx(','.s:zen_settings['html'].empty_elements.',', ','.current.name.',') != -1 && len(current.value) == 0 + if stridx(','.s:zen_settings.html.empty_elements.',', ','.current.name.',') != -1 && len(current.value) == 0 let str .= "/" - elseif stridx(','.s:zen_settings['html'].block_elements.',', ','.current.name.',') != -1 && (len(current.child) == 0 && len(current.value) == 0) + elseif stridx(','.s:zen_settings.html.block_elements.',', ','.current.name.',') != -1 && (len(current.child) == 0 && len(current.value) == 0) let str .= '<' endif @@ -1228,6 +1228,9 @@ function! s:zen_getFileType() if synIDattr(synID(line("."), col("."), 1), "name") =~ '^xml' let type = 'xml' endif + if has_key(s:zen_settings, type) && has_key(s:zen_settings[type], 'extends') + let type = s:zen_settings[type].extends + endif if len(type) == 0 | let type = 'html' | endif if type == 'xhtml' | let type = 'html' | endif return type @@ -1385,7 +1388,7 @@ function! s:zen_imageSize() return endif let current = s:zen_parseTag(content) - let fn = current.attr['src'] + let fn = current.attr.src if fn !~ '^\(/\|http\)' let fn = simplify(expand('%:h') . '/' . fn) endif @@ -1418,8 +1421,8 @@ EOF if w == -1 && h == -1 return endif - let current.attr['width'] = w - let current.attr['height'] = h + let current.attr.width = w + let current.attr.height = h let html = s:zen_toString(current, 'html', 1) call s:change_content(img_region, html) endfunction @@ -1650,7 +1653,7 @@ function! s:zen_anchorizeURL(flag) if a:flag == 0 let a = s:zen_parseTag('') - let a.attr['href'] = url + let a.attr.href = url let a.value = '{' . title . '}' let expand = s:zen_toString(a, 'html', 0, '') let expand = substitute(expand, '\${cursor}', '', 'g') @@ -1661,7 +1664,7 @@ function! s:zen_anchorizeURL(flag) let blockquote = s:zen_parseTag('
') let a = s:zen_parseTag('') - let a.attr['href'] = url + let a.attr.href = url let a.value = '{' . title . '}' call add(blockquote.child, a) call add(blockquote.child, s:zen_parseTag('
')) From c047dba32bf8a5dd21dca134c2f6e39ff86cbee0 Mon Sep 17 00:00:00 2001 From: mattn Date: Fri, 12 Mar 2010 09:48:20 +0900 Subject: [PATCH 2/6] add doc that 2 ways to enable zencoding.vim for other languages you using. --- TUTORIAL | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/TUTORIAL b/TUTORIAL index e9e12b5..fd534e7 100644 --- a/TUTORIAL +++ b/TUTORIAL @@ -176,3 +176,29 @@ Tutorial of zencoding.vim
--------------------- +14. Enable zencoding.vim for language you using. + + There are two ways to enable zencoding.vim for language you using. + + 1. Enable with filetype. + --------------------- + # mkdir $HOME/.vim/ftplugin/php + # cp zencoding.vim $HOME/.vim/ftplugin/php/. + --------------------- + + 2. Enable with zen_settings. + --------------------- + # cp zencoding.vim $HOME/.vim/. + # cat >> ~/.vimrc + let g:user_zen_settings = { + \ 'php' : { + \ 'extends' : 'html', + \ }, + \ 'xml' : { + \ 'extends' : 'html', + \ }, + \ 'haml' : { + \ 'extends' : 'html', + \ }, + \} + --------------------- From 6712c04459072750e89010b5992798227f070906 Mon Sep 17 00:00:00 2001 From: mattn Date: Fri, 12 Mar 2010 11:58:49 +0900 Subject: [PATCH 3/6] ins --- zencoding.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/zencoding.vim b/zencoding.vim index 6cc8444..50fe48b 100644 --- a/zencoding.vim +++ b/zencoding.vim @@ -664,6 +664,7 @@ let s:zen_settings = { \ 'bdo:r': {'dir': 'rtl'}, \ 'bdo:l': {'dir': 'ltr'}, \ 'del': {'datetime': '${datetime}'}, +\ 'ins': {'datetime': '${datetime}'}, \ 'link:css': [{'rel': 'stylesheet'}, {'type': 'text/css'}, {'href': '|style.css'}, {'media': 'all'}], \ 'link:print': [{'rel': 'stylesheet'}, {'type': 'text/css'}, {'href': '|print.css'}, {'media': 'print'}], \ 'link:favicon': [{'rel': 'shortcut icon'}, {'type': 'image/x-icon'}, {'href': '|favicon.ico'}], From d9976b5d564240bc3838979e0a48438134f15bd5 Mon Sep 17 00:00:00 2001 From: mattn Date: Fri, 12 Mar 2010 12:01:27 +0900 Subject: [PATCH 4/6] fixed indent. --- zencoding.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zencoding.vim b/zencoding.vim index 50fe48b..b3af934 100644 --- a/zencoding.vim +++ b/zencoding.vim @@ -1332,7 +1332,7 @@ function! s:zen_expandAbbr(mode) range endif if line[:-len(part)-1] =~ '^\s\+$' let size = (len(line) - len(part)) / len(s:zen_settings.indentation) - let indent = line[:-len(part)-1] . repeat(s:zen_settings.indentation, size) + let indent = repeat(s:zen_settings.indentation, size) else let indent = '' endif From 1de3fbe918f9113ecc58ece9d5783c4ff547c3b8 Mon Sep 17 00:00:00 2001 From: mattn Date: Fri, 12 Mar 2010 12:03:42 +0900 Subject: [PATCH 5/6] version++ --- zencoding.vim | 2 +- zencoding.vim.vimup | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/zencoding.vim b/zencoding.vim index b3af934..fd9faee 100644 --- a/zencoding.vim +++ b/zencoding.vim @@ -2,7 +2,7 @@ " File: zencoding.vim " Author: Yasuhiro Matsumoto " Last Change: 12-Mar-2010. -" Version: 0.31 +" Version: 0.32 " 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/ diff --git a/zencoding.vim.vimup b/zencoding.vim.vimup index 6196253..e43d38b 100644 --- a/zencoding.vim.vimup +++ b/zencoding.vim.vimup @@ -2,7 +2,7 @@ script_name: ZenCoding.vim script_id: '2981' script_type: utility script_package: zencoding.vim -script_version: '0.31' +script_version: '0.32' required_vim_version: '7.0' summary: vim plugins for HTML and CSS hi-speed coding. @@ -81,6 +81,8 @@ install_details: | copy zencoding.vim to your plugin directory. versions: +- '0.32': | + This is an upgrade for ZenCoding.vim: fixed indentation. supported extends so that you can enable zencoding for php/xhtml/haml other's section 14 in http://github.com/mattn/zencoding-vim/raw/master/TUTORIAL - '0.31': | This is an upgrade for ZenCoding.vim: fixed indentation and $$$ problem. fixed about missing support multiple classes. - '0.30': | From 7e33ea1a7e92260a46d8fee3ab869e3fe7135e76 Mon Sep 17 00:00:00 2001 From: mattn Date: Fri, 12 Mar 2010 19:16:57 +0900 Subject: [PATCH 6/6] enable inline javascript. --- zencoding.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zencoding.vim b/zencoding.vim index fd9faee..d69dfbe 100644 --- a/zencoding.vim +++ b/zencoding.vim @@ -1229,6 +1229,9 @@ function! s:zen_getFileType() if synIDattr(synID(line("."), col("."), 1), "name") =~ '^xml' let type = 'xml' endif + if synIDattr(synID(line("."), col("."), 1), "name") =~ '^javaScript' + let type = 'javascript' + endif if has_key(s:zen_settings, type) && has_key(s:zen_settings[type], 'extends') let type = s:zen_settings[type].extends endif