diff --git a/TUTORIAL b/TUTORIAL
index 66b0860..ad46041 100644
--- a/TUTORIAL
+++ b/TUTORIAL
@@ -83,7 +83,7 @@ Tutorial of zencoding.vim
---------------------
- and type 'J'
+ and type 'm'
---------------------
diff --git a/autoload/zencoding.vim b/autoload/zencoding.vim
index 5e9376b..682b57d 100644
--- a/autoload/zencoding.vim
+++ b/autoload/zencoding.vim
@@ -1,7 +1,7 @@
"=============================================================================
" zencoding.vim
" Author: Yasuhiro Matsumoto
-" Last Change: 11-Jan-2012.
+" Last Change: 17-Jan-2012.
let s:save_cpo = &cpo
set cpo&vim
@@ -999,6 +999,13 @@ function! zencoding#splitJoinTag()
endwhile
endfunction
+function! zencoding#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 curpos = getpos('.')
while 1
diff --git a/doc/zencoding.txt b/doc/zencoding.txt
index e3f767a..7b00dca 100644
--- a/doc/zencoding.txt
+++ b/doc/zencoding.txt
@@ -195,7 +195,8 @@ You should copy this section and create new buffer, paste and write as
<
- If you select part of line include and type |J|, it will be following.
+ If you select part of line include and type |m|, it will be
+ following.
>
diff --git a/plugin/zencoding.vim b/plugin/zencoding.vim
index 13d28b7..45d9289 100644
--- a/plugin/zencoding.vim
+++ b/plugin/zencoding.vim
@@ -1,7 +1,7 @@
"=============================================================================
" File: zencoding.vim
" Author: Yasuhiro Matsumoto
-" Last Change: 22-Nov-2011.
+" Last Change: 17-Jan-2012.
" Version: 0.58
" WebPage: http://github.com/mattn/zencoding-vim
" Description: vim plugins for HTML and CSS hi-speed coding.
@@ -111,6 +111,7 @@ function! s:install_plugin()
\ {'mode': 'n', 'var': 'user_zen_imagesize_key', 'key': 'i', 'plug': 'ZenCodingImageSize', 'func': ':call zencoding#imageSize()'},
\ {'mode': 'i', 'var': 'user_zen_togglecomment_key', 'key': '/', 'plug': 'ZenCodingToggleComment', 'func': ':call zencoding#toggleComment()a'},
\ {'mode': 'n', 'var': 'user_zen_togglecomment_key', 'key': '/', 'plug': 'ZenCodingToggleComment', 'func': ':call zencoding#toggleComment()'},
+ \ {'mode': 'v', 'var': 'user_zen_mergelines_key', 'key': 'm', 'plug': 'ZenCodingMergeLines', 'func': ':call zencoding#mergeLines()'},
\ {'mode': 'i', 'var': 'user_zen_splitjointag_key', 'key': 'j', 'plug': 'ZenCodingSplitJoinTagInsert', 'func': ':call zencoding#splitJoinTag()a'},
\ {'mode': 'n', 'var': 'user_zen_splitjointag_key', 'key': 'j', 'plug': 'ZenCodingSplitJoinTagNormal', 'func': ':call zencoding#splitJoinTag()'},
\ {'mode': 'i', 'var': 'user_zen_removetag_key', 'key': 'k', 'plug': 'ZenCodingRemoveTag', 'func': ':call zencoding#removeTag()a'},
@@ -125,10 +126,14 @@ function! s:install_plugin()
exe item.mode . 'noremap ' . item.plug . ' ' . item.func
endif
if !exists('g:' . item.var)
- exe 'let g:' . item.var . " = '" . g:user_zen_leader_key . item.key . "'"
endif
- if len(maparg(eval('g:' . item.var), item.mode)) == 0
- exe item.mode . 'map ' . eval('g:' . item.var) . ' ' . item.plug
+ 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 ' . key . ' ' . item.plug
endif
endfor
endfunction