From 3d3ae065eb4de2a9d6f9541aa2867cfc2dadb813 Mon Sep 17 00:00:00 2001 From: mattn Date: Sun, 3 Jun 2012 01:21:25 +0900 Subject: [PATCH] add :Zen command. --- autoload/zencoding.vim | 7 ++++++- plugin/zencoding.vim | 14 ++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/autoload/zencoding.vim b/autoload/zencoding.vim index 0606868..b823314 100644 --- a/autoload/zencoding.vim +++ b/autoload/zencoding.vim @@ -236,7 +236,7 @@ function! zencoding#getFileType() return type endfunction -function! zencoding#expandAbbr(mode) range +function! zencoding#expandAbbr(mode, abbr) range let type = zencoding#getFileType() let expand = '' let filters = ['html'] @@ -311,6 +311,11 @@ function! zencoding#expandAbbr(mode) range let expand .= zencoding#toString(item, type, 0, filters) endfor endif + elseif a:mode == 4 + call setline('.', a:abbr) + normal! $ + call zencoding#expandAbbr(0, "") + return else let line = getline('.') if col('.') < len(line) diff --git a/plugin/zencoding.vim b/plugin/zencoding.vim index 788be4e..ec679a4 100644 --- a/plugin/zencoding.vim +++ b/plugin/zencoding.vim @@ -1,7 +1,7 @@ "============================================================================= " File: zencoding.vim " Author: Yasuhiro Matsumoto -" Last Change: 29-May-2012. +" Last Change: 03-Jun-2012. " Version: 0.72 " WebPage: http://github.com/mattn/zencoding-vim " Description: vim plugins for HTML and CSS hi-speed coding. @@ -92,11 +92,11 @@ endif function! s:install_plugin() for item in [ - \ {'mode': 'i', 'var': 'user_zen_expandabbr_key', 'key': ',', 'plug': 'ZenCodingExpandAbbr', 'func': 'u:call zencoding#expandAbbr(0)a'}, - \ {'mode': 'v', 'var': 'user_zen_expandabbr_key', 'key': ',', 'plug': 'ZenCodingExpandVisual', 'func': ':call zencoding#expandAbbr(2)'}, - \ {'mode': 'n', 'var': 'user_zen_expandabbr_key', 'key': ',', 'plug': 'ZenCodingExpandNormal', 'func': ':call zencoding#expandAbbr(3)'}, - \ {'mode': 'i', 'var': 'user_zen_expandword_key', 'key': ';', 'plug': 'ZenCodingExpandWord', 'func': 'u:call zencoding#expandAbbr(1)a'}, - \ {'mode': 'n', 'var': 'user_zen_expandword_key', 'key': ',', 'plug': 'ZenCodingExpandWord', 'func': ':call zencoding#expandAbbr(1)'}, + \ {'mode': 'i', 'var': 'user_zen_expandabbr_key', 'key': ',', 'plug': 'ZenCodingExpandAbbr', 'func': 'u:call zencoding#expandAbbr(0,"")a'}, + \ {'mode': 'v', 'var': 'user_zen_expandabbr_key', 'key': ',', 'plug': 'ZenCodingExpandVisual', 'func': ':call zencoding#expandAbbr(2,"")'}, + \ {'mode': 'n', 'var': 'user_zen_expandabbr_key', 'key': ',', 'plug': 'ZenCodingExpandNormal', 'func': ':call zencoding#expandAbbr(3,"")'}, + \ {'mode': 'i', 'var': 'user_zen_expandword_key', 'key': ';', 'plug': 'ZenCodingExpandWord', 'func': 'u:call zencoding#expandAbbr(1,"")a'}, + \ {'mode': 'n', 'var': 'user_zen_expandword_key', 'key': ',', 'plug': 'ZenCodingExpandWord', 'func': ':call zencoding#expandAbbr(1,"")'}, \ {'mode': 'i', 'var': 'user_zen_balancetaginward_key', 'key': 'd', 'plug': 'ZenCodingBalanceTagInwardInsert', 'func': ':call zencoding#balanceTag(1)'}, \ {'mode': 'n', 'var': 'user_zen_balancetaginward_key', 'key': 'd', 'plug': 'ZenCodingBalanceTagInwardNormal', 'func': ':call zencoding#balanceTag(1)'}, \ {'mode': 'v', 'var': 'user_zen_balancetaginward_key', 'key': 'd', 'plug': 'ZenCodingBalanceTagInwardVisual', 'func': ':call zencoding#balanceTag(2)'}, @@ -140,6 +140,8 @@ endfunction call s:install_plugin() delfunction s:install_plugin +command! -nargs=1 Zen call zencoding#expandAbbr(4, ) + let &cpo = s:save_cpo unlet s:save_cpo