forked from VimPlug/emmet-vim
Fix checking type for expanding abbreviation. Also move types htmldjango/drupal into default settings.
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: 07-Jan-2013.
|
" Last Change: 26-Mar-2013.
|
||||||
|
|
||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
@@ -50,6 +50,26 @@ function! zencoding#getIndentation(...)
|
|||||||
return indent
|
return indent
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! zencoding#getBaseType(type)
|
||||||
|
if !has_key(s:zen_settings, a:type)
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
if !has_key(s:zen_settings[a:type], 'extends')
|
||||||
|
return a:type
|
||||||
|
endif
|
||||||
|
let extends = s:zen_settings[a:type].extends
|
||||||
|
if type(extends) == 1
|
||||||
|
let tmp = split(extends, '\s*,\s*')
|
||||||
|
let ext = tmp[0]
|
||||||
|
else
|
||||||
|
let ext = extends[0]
|
||||||
|
endif
|
||||||
|
if a:type != ext
|
||||||
|
return zencoding#getBaseType(ext)
|
||||||
|
endif
|
||||||
|
return ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! zencoding#isExtends(type, extend)
|
function! zencoding#isExtends(type, extend)
|
||||||
if a:type == a:extend
|
if a:type == a:extend
|
||||||
return 1
|
return 1
|
||||||
@@ -238,9 +258,7 @@ endfunction
|
|||||||
|
|
||||||
function! zencoding#getFileType()
|
function! zencoding#getFileType()
|
||||||
let type = &ft
|
let type = &ft
|
||||||
if type == 'xslt' | let type = 'xsl' | endif
|
let type = zencoding#getBaseType(type)
|
||||||
if type == 'htmldjango' | let type = 'html' | endif
|
|
||||||
if type == 'html.django_template' | let type = 'html' | endif
|
|
||||||
if len(type) == 0 && zencoding#lang#exists(&ft)
|
if len(type) == 0 && zencoding#lang#exists(&ft)
|
||||||
let type = &ft
|
let type = &ft
|
||||||
endif
|
endif
|
||||||
@@ -1155,6 +1173,9 @@ let s:zen_settings = {
|
|||||||
\ 'less': {
|
\ 'less': {
|
||||||
\ 'extends': 'css',
|
\ 'extends': 'css',
|
||||||
\ },
|
\ },
|
||||||
|
\ 'css.drupal': {
|
||||||
|
\ 'extends': 'css',
|
||||||
|
\ },
|
||||||
\ 'html': {
|
\ 'html': {
|
||||||
\ 'snippets': {
|
\ 'snippets': {
|
||||||
\ 'cc:ie6': "<!--[if lte IE 6]>\n\t${child}|\n<![endif]-->",
|
\ 'cc:ie6': "<!--[if lte IE 6]>\n\t${child}|\n<![endif]-->",
|
||||||
@@ -1354,6 +1375,12 @@ let s:zen_settings = {
|
|||||||
\ 'inline_elements': 'a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var',
|
\ 'inline_elements': 'a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var',
|
||||||
\ 'empty_element_suffix': ' />'
|
\ 'empty_element_suffix': ' />'
|
||||||
\ },
|
\ },
|
||||||
|
\ 'htmldjango': {
|
||||||
|
\ 'extends': 'html',
|
||||||
|
\ },
|
||||||
|
\ 'html.django_template': {
|
||||||
|
\ 'extends': 'html',
|
||||||
|
\ },
|
||||||
\ 'xsl': {
|
\ 'xsl': {
|
||||||
\ 'extends': 'html',
|
\ 'extends': 'html',
|
||||||
\ 'default_attributes': {
|
\ 'default_attributes': {
|
||||||
@@ -1392,6 +1419,9 @@ let s:zen_settings = {
|
|||||||
\ 'choose': 'xsl:choose>xsl:when+xsl:otherwise'
|
\ 'choose': 'xsl:choose>xsl:when+xsl:otherwise'
|
||||||
\ }
|
\ }
|
||||||
\ },
|
\ },
|
||||||
|
\ 'xslt': {
|
||||||
|
\ 'extends': 'xsl',
|
||||||
|
\ },
|
||||||
\ 'haml': {
|
\ 'haml': {
|
||||||
\ 'indentation': ' ',
|
\ 'indentation': ' ',
|
||||||
\ 'extends': 'html',
|
\ 'extends': 'html',
|
||||||
|
|||||||
Reference in New Issue
Block a user