mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-06 10:44:24 +08:00
splitJoinTag for haml & slim.
This commit is contained in:
@@ -140,3 +140,7 @@ endfunction
|
||||
function! zencoding#lang#css#splitJoinTag()
|
||||
" nothing to do
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#css#removeTag()
|
||||
" nothing to do
|
||||
endfunction
|
||||
|
||||
@@ -198,6 +198,34 @@ function! zencoding#lang#haml#moveNextPrev(flag)
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#haml#splitJoinTag()
|
||||
let n = line('.')
|
||||
while n > 0
|
||||
if getline(n) =~ '^\s*\ze%[a-z]'
|
||||
let line = getline(n)
|
||||
call setline(n, matchstr(line, '^\s*%\w\+\s*{[^}]*}'))
|
||||
let sn = n
|
||||
let n += 1
|
||||
let ml = len(matchstr(getline(n), '^\s*%[a-z]'))
|
||||
if getline(n) =~ '^\s*|'
|
||||
while n < line('$')
|
||||
let l = len(matchstr(getline(n), '^\s*'))
|
||||
if l <= ml
|
||||
break
|
||||
endif
|
||||
exe n "delete"
|
||||
let n += 1
|
||||
endwhile
|
||||
call setpos('.', [0, sn, 1, 0])
|
||||
else
|
||||
let spaces = matchstr(getline(sn), '^\s*')
|
||||
call append(sn, spaces . ' | ')
|
||||
call setpos('.', [0, sn+1, 1, 0])
|
||||
startinsert!
|
||||
endif
|
||||
break
|
||||
endif
|
||||
let n -= 1
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#haml#removeTag()
|
||||
|
||||
@@ -187,7 +187,30 @@ function! zencoding#lang#slim#moveNextPrev(flag)
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#slim#splitJoinTag()
|
||||
" TODO
|
||||
let n = line('.')
|
||||
while n > 0
|
||||
if getline(n) =~ '^\s*\ze[a-z]'
|
||||
let sn = n
|
||||
let n += 1
|
||||
if getline(n) =~ '^\s*|'
|
||||
while n < line('$')
|
||||
if getline(n) !~ '^\s*|'
|
||||
break
|
||||
endif
|
||||
exe n "delete"
|
||||
let n += 1
|
||||
endwhile
|
||||
call setpos('.', [0, sn, 1, 0])
|
||||
else
|
||||
let spaces = matchstr(getline(sn), '^\s*')
|
||||
call append(sn, spaces . ' | ')
|
||||
call setpos('.', [0, sn+1, 1, 0])
|
||||
startinsert!
|
||||
endif
|
||||
break
|
||||
endif
|
||||
let n -= 1
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
function! zencoding#lang#slim#removeTag()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"=============================================================================
|
||||
" File: zencoding.vim
|
||||
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
||||
" Last Change: 03-Jun-2012.
|
||||
" Last Change: 04-Jun-2012.
|
||||
" Version: 0.72
|
||||
" WebPage: http://github.com/mattn/zencoding-vim
|
||||
" Description: vim plugins for HTML and CSS hi-speed coding.
|
||||
@@ -112,7 +112,7 @@ function! s:install_plugin()
|
||||
\ {'mode': 'i', 'var': 'user_zen_togglecomment_key', 'key': '/', 'plug': 'ZenCodingToggleComment', 'func': '<esc>:call zencoding#toggleComment()<cr>a'},
|
||||
\ {'mode': 'n', 'var': 'user_zen_togglecomment_key', 'key': '/', 'plug': 'ZenCodingToggleComment', 'func': ':call zencoding#toggleComment()<cr>'},
|
||||
\ {'mode': 'v', 'var': 'user_zen_mergelines_key', 'key': 'm', 'plug': 'ZenCodingMergeLines', 'func': ':call zencoding#mergeLines()<cr>'},
|
||||
\ {'mode': 'i', 'var': 'user_zen_splitjointag_key', 'key': 'j', 'plug': 'ZenCodingSplitJoinTagInsert', 'func': '<esc>:call zencoding#splitJoinTag()<cr>a'},
|
||||
\ {'mode': 'i', 'var': 'user_zen_splitjointag_key', 'key': 'j', 'plug': 'ZenCodingSplitJoinTagInsert', 'func': '<esc>:call zencoding#splitJoinTag()<cr>'},
|
||||
\ {'mode': 'n', 'var': 'user_zen_splitjointag_key', 'key': 'j', 'plug': 'ZenCodingSplitJoinTagNormal', 'func': ':call zencoding#splitJoinTag()<cr>'},
|
||||
\ {'mode': 'i', 'var': 'user_zen_removetag_key', 'key': 'k', 'plug': 'ZenCodingRemoveTag', 'func': '<esc>:call zencoding#removeTag()<cr>a'},
|
||||
\ {'mode': 'n', 'var': 'user_zen_removetag_key', 'key': 'k', 'plug': 'ZenCodingRemoveTag', 'func': ':call zencoding#removeTag()<cr>'},
|
||||
|
||||
Reference in New Issue
Block a user