toggleComment for slim

This commit is contained in:
mattn
2012-05-30 21:12:34 +09:00
parent 0330ce39b4
commit a1731c718d
2 changed files with 22 additions and 11 deletions

View File

@@ -218,6 +218,10 @@ function! zencoding#getFileType()
if type == 'htmldjango' | let type = 'html' | endif if type == 'htmldjango' | let type = 'html' | endif
if type == 'html.django_template' | let type = 'html' | endif if type == 'html.django_template' | let type = 'html' | endif
if type == 'scss' | let type = 'css' | endif if type == 'scss' | let type = 'css' | endif
if len(type) == 0 && len(globpath(&rtp, 'autoload/zencoding/lang/'.&ft.'.vim'))
let type = &ft
endif
if type == 'html'
if synIDattr(synID(line("."), col("."), 1), "name") =~ '^css' if synIDattr(synID(line("."), col("."), 1), "name") =~ '^css'
let type = 'css' let type = 'css'
endif endif
@@ -230,6 +234,7 @@ function! zencoding#getFileType()
if len(type) == 0 && synIDattr(synID(line("."), col("."), 1), "name") =~ '^xml' if len(type) == 0 && synIDattr(synID(line("."), col("."), 1), "name") =~ '^xml'
let type = 'xml' let type = 'xml'
endif endif
endif
if len(type) == 0 | let type = 'html' | endif if len(type) == 0 | let type = 'html' | endif
return type return type
endfunction endfunction

View File

@@ -105,5 +105,11 @@ function! zencoding#lang#slim#parseTag(tag)
endfunction endfunction
function! zencoding#lang#slim#toggleComment() function! zencoding#lang#slim#toggleComment()
" TODO let line = getline('.')
let space = matchstr(line, '^\s*')
if line =~ '^\s*/'
call setline('.', space . line[len(space)+1:])
elseif line =~ '^\s*[a-z]'
call setline('.', space . '/' . line[len(space):])
endif
endfunction endfunction