forked from VimPlug/emmet-vim
fix toggleComment for css.
This commit is contained in:
@@ -63,13 +63,27 @@ endfunction
|
|||||||
function! zencoding#lang#css#toggleComment()
|
function! zencoding#lang#css#toggleComment()
|
||||||
let line = getline('.')
|
let line = getline('.')
|
||||||
let mx = '^\(\s*\)/\*\s*\(.*\)\s*\*/\s*$'
|
let mx = '^\(\s*\)/\*\s*\(.*\)\s*\*/\s*$'
|
||||||
if line =~ mx
|
if line =~ '{\s*$'
|
||||||
let space = substitute(matchstr(line, mx), mx, '\1', '')
|
let block = zencoding#util#searchRegion('/\*', '\*/\zs')
|
||||||
let line = substitute(matchstr(line, mx), mx, '\2', '')
|
if zencoding#util#regionIsValid(block)
|
||||||
let line = space . substitute(line, '^\s*\|\s*$', '\1', 'g')
|
let content = zencoding#util#getContent(block)
|
||||||
|
let content = substitute(content, '/\*\s\(.*\)\s\*/', '\1', '')
|
||||||
|
call zencoding#util#setContent(block, content)
|
||||||
|
else
|
||||||
|
let node = expand('<cword>')
|
||||||
|
if len(node)
|
||||||
|
exe "normal ciw\<c-r>='/* '.node.' */'\<cr>"
|
||||||
|
endif
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
let mx = '^\(\s*\)\(.*\)\s*$'
|
if line =~ mx
|
||||||
let line = substitute(line, mx, '\1/* \2 */', '')
|
let space = substitute(matchstr(line, mx), mx, '\1', '')
|
||||||
|
let line = substitute(matchstr(line, mx), mx, '\2', '')
|
||||||
|
let line = space . substitute(line, '^\s*\|\s*$', '\1', 'g')
|
||||||
|
else
|
||||||
|
let mx = '^\(\s*\)\(.*\)\s*$'
|
||||||
|
let line = substitute(line, mx, '\1/* \2 */', '')
|
||||||
|
endif
|
||||||
|
call setline('.', line)
|
||||||
endif
|
endif
|
||||||
call setline('.', line)
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
Reference in New Issue
Block a user