forked from VimPlug/emmet-vim
new feature, add code pretty.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
"=============================================================================
|
"=============================================================================
|
||||||
" zencoding.vim
|
" zencoding.vim
|
||||||
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
||||||
" Last Change: 04-Jun-2012.
|
" Last Change: 07-Jun-2012.
|
||||||
|
|
||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
@@ -520,6 +520,27 @@ function! zencoding#anchorizeURL(flag)
|
|||||||
call zencoding#util#setContent(block, expand)
|
call zencoding#util#setContent(block, expand)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! zencoding#codePretty() range
|
||||||
|
let type = input('FileType: ', '', 'filetype')
|
||||||
|
if len(type) == 0
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
let block = zencoding#util#getVisualBlock()
|
||||||
|
let content = zencoding#util#getContent(block)
|
||||||
|
silent! 1new
|
||||||
|
let &l:filetype = type
|
||||||
|
call setline(1, split(content, "\n"))
|
||||||
|
let old_lazyredraw = &lazyredraw
|
||||||
|
set lazyredraw
|
||||||
|
silent! TOhtml
|
||||||
|
let &lazyredraw = old_lazyredraw
|
||||||
|
let content = join(getline(1, '$'), "\n")
|
||||||
|
silent! bw!
|
||||||
|
silent! bw!
|
||||||
|
let content = matchstr(content, '<body[^>]*>[\s\n]*\zs.*\ze</body>')
|
||||||
|
call zencoding#util#setContent(block, content)
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! zencoding#ExpandWord(abbr, type, orig)
|
function! zencoding#ExpandWord(abbr, type, orig)
|
||||||
let mx = '|\(\%(html\|haml\|slim\|e\|c\|fc\|xsl\|t\)\s*,\{0,1}\s*\)*$'
|
let mx = '|\(\%(html\|haml\|slim\|e\|c\|fc\|xsl\|t\)\s*,\{0,1}\s*\)*$'
|
||||||
let str = a:abbr
|
let str = a:abbr
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"=============================================================================
|
"=============================================================================
|
||||||
" File: zencoding.vim
|
" File: zencoding.vim
|
||||||
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
||||||
" Last Change: 04-Jun-2012.
|
" Last Change: 07-Jun-2012.
|
||||||
" Version: 0.72
|
" Version: 0.72
|
||||||
" WebPage: http://github.com/mattn/zencoding-vim
|
" WebPage: http://github.com/mattn/zencoding-vim
|
||||||
" Description: vim plugins for HTML and CSS hi-speed coding.
|
" Description: vim plugins for HTML and CSS hi-speed coding.
|
||||||
@@ -120,6 +120,7 @@ function! s:install_plugin()
|
|||||||
\ {'mode': 'n', 'var': 'user_zen_anchorizeurl_key', 'key': 'a', 'plug': 'ZenCodingAnchorizeURL', 'func': ':call zencoding#anchorizeURL(0)<cr>'},
|
\ {'mode': 'n', 'var': 'user_zen_anchorizeurl_key', 'key': 'a', 'plug': 'ZenCodingAnchorizeURL', 'func': ':call zencoding#anchorizeURL(0)<cr>'},
|
||||||
\ {'mode': 'i', 'var': 'user_zen_anchorizesummary_key', 'key': 'A', 'plug': 'ZenCodingAnchorizeSummary', 'func': '<esc>:call zencoding#anchorizeURL(1)<cr>a'},
|
\ {'mode': 'i', 'var': 'user_zen_anchorizesummary_key', 'key': 'A', 'plug': 'ZenCodingAnchorizeSummary', 'func': '<esc>:call zencoding#anchorizeURL(1)<cr>a'},
|
||||||
\ {'mode': 'n', 'var': 'user_zen_anchorizesummary_key', 'key': 'A', 'plug': 'ZenCodingAnchorizeSummary', 'func': ':call zencoding#anchorizeURL(1)<cr>'},
|
\ {'mode': 'n', 'var': 'user_zen_anchorizesummary_key', 'key': 'A', 'plug': 'ZenCodingAnchorizeSummary', 'func': ':call zencoding#anchorizeURL(1)<cr>'},
|
||||||
|
\ {'mode': 'v', 'var': 'user_zen_codepretty_key', 'key': 'c', 'plug': 'ZenCodingCodePretty', 'func': ':call zencoding#codePretty()<cr>'},
|
||||||
\]
|
\]
|
||||||
|
|
||||||
if !hasmapto('<plug>'.item.plug, item.mode)
|
if !hasmapto('<plug>'.item.plug, item.mode)
|
||||||
|
|||||||
Reference in New Issue
Block a user