mirror of
https://github.com/gryf/.vim.git
synced 2025-12-17 11:30:29 +01:00
Update of lucius colorscheme, replaced javascript indenter with one created by Preston Koprivica, added mako syntax and indenter.
This commit is contained in:
1
.vimrc
1
.vimrc
@@ -89,6 +89,7 @@ autocmd BufWritePre *.css :call <SID>StripTrailingWhitespaces()
|
||||
autocmd BufWritePre *.xml :call <SID>StripTrailingWhitespaces()
|
||||
"set correct filetype for tmux
|
||||
autocmd BufRead *.tmux.conf set filetype=tmux
|
||||
autocmd BufRead *.mako set filetype=mako
|
||||
" }}}
|
||||
"TERMINAL: options for terminal emulators {{{
|
||||
if $TERM == 'rxvt-unicode-256color' || $TERM == 'xterm'
|
||||
|
||||
@@ -25,7 +25,7 @@ ScriptID SourceID Filename
|
||||
2855 12456 github.vim
|
||||
1143 11833 inkpot.vim
|
||||
2555 15432 jellybeans.vim
|
||||
2536 16179 lucius.vim
|
||||
2536 16288 lucius.vim
|
||||
3299 14475 sorcerer.vim
|
||||
1165 3741 tolerable.vim
|
||||
3309 15759 vydark
|
||||
@@ -38,12 +38,15 @@ ScriptID SourceID Filename
|
||||
435 12010 pythonhelper.vim
|
||||
2527 10034 jpythonfold.vim
|
||||
### indent
|
||||
1936 7708 javascript.vim
|
||||
2663 12560 mako.vim
|
||||
3081 15645 JavaScript indent
|
||||
# there is also python.vim, which is close to PEP8, but author of
|
||||
# changes doesn't put it on vim.org scripts. it can be (still) found on
|
||||
# http://monkey.org/~caz/python.vim
|
||||
### syntax
|
||||
790 14268 python.vim
|
||||
2651 10658 fitnesse.vim
|
||||
1858 9244 mako.vim
|
||||
2539 9949 css.vim
|
||||
### doc
|
||||
3277 14056 py2stdlib
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
" Lucius vim color file
|
||||
" Maintainer: Jonathan Filip <jfilip1024@gmail.com>
|
||||
" Version: 6.0
|
||||
" Version: 6.03
|
||||
|
||||
hi clear
|
||||
if exists("syntax_on")
|
||||
@@ -71,23 +71,23 @@ if g:lucius_style == "dark"
|
||||
|
||||
hi Comment guifg=#606060 guibg=NONE ctermfg=240 ctermbg=NONE gui=none cterm=none
|
||||
|
||||
hi Constant guifg=#b0d090 guibg=NONE ctermfg=150 ctermbg=NONE gui=none cterm=none
|
||||
hi BConstant guifg=#b0d090 guibg=NONE ctermfg=150 ctermbg=NONE gui=bold cterm=bold
|
||||
hi Constant guifg=#c0e0a0 guibg=NONE ctermfg=150 ctermbg=NONE gui=none cterm=none
|
||||
hi BConstant guifg=#c0e0a0 guibg=NONE ctermfg=150 ctermbg=NONE gui=bold cterm=bold
|
||||
|
||||
hi Identifier guifg=#90d0c0 guibg=NONE ctermfg=115 ctermbg=NONE gui=none cterm=none
|
||||
hi BIdentifier guifg=#90d0c0 guibg=NONE ctermfg=115 ctermbg=NONE gui=bold cterm=bold
|
||||
hi Identifier guifg=#a0e0d0 guibg=NONE ctermfg=115 ctermbg=NONE gui=none cterm=none
|
||||
hi BIdentifier guifg=#a0e0d0 guibg=NONE ctermfg=115 ctermbg=NONE gui=bold cterm=bold
|
||||
|
||||
hi Statement guifg=#70c0e0 guibg=NONE ctermfg=74 ctermbg=NONE gui=none cterm=none
|
||||
hi BStatement guifg=#70c0e0 guibg=NONE ctermfg=74 ctermbg=NONE gui=bold cterm=bold
|
||||
hi Statement guifg=#80d0f0 guibg=NONE ctermfg=74 ctermbg=NONE gui=none cterm=none
|
||||
hi BStatement guifg=#80d0f0 guibg=NONE ctermfg=74 ctermbg=NONE gui=bold cterm=bold
|
||||
|
||||
hi PreProc guifg=#e0e0b0 guibg=NONE ctermfg=187 ctermbg=NONE gui=none cterm=none
|
||||
hi BPreProc guifg=#e0e0b0 guibg=NONE ctermfg=187 ctermbg=NONE gui=bold cterm=bold
|
||||
hi PreProc guifg=#f0f0b0 guibg=NONE ctermfg=187 ctermbg=NONE gui=none cterm=none
|
||||
hi BPreProc guifg=#f0f0b0 guibg=NONE ctermfg=187 ctermbg=NONE gui=bold cterm=bold
|
||||
|
||||
hi Type guifg=#90c0d0 guibg=NONE ctermfg=116 ctermbg=NONE gui=none cterm=none
|
||||
hi BType guifg=#90c0d0 guibg=NONE ctermfg=116 ctermbg=NONE gui=bold cterm=bold
|
||||
hi Type guifg=#a0d0e0 guibg=NONE ctermfg=116 ctermbg=NONE gui=none cterm=none
|
||||
hi BType guifg=#a0d0e0 guibg=NONE ctermfg=116 ctermbg=NONE gui=bold cterm=bold
|
||||
|
||||
hi Special guifg=#b0a0c0 guibg=NONE ctermfg=182 ctermbg=NONE gui=none cterm=none
|
||||
hi BSpecial guifg=#b0a0c0 guibg=NONE ctermfg=182 ctermbg=NONE gui=bold cterm=bold
|
||||
hi Special guifg=#c0a0d0 guibg=NONE ctermfg=182 ctermbg=NONE gui=none cterm=none
|
||||
hi BSpecial guifg=#c0a0d0 guibg=NONE ctermfg=182 ctermbg=NONE gui=bold cterm=bold
|
||||
|
||||
" == Text Markup ==
|
||||
hi Underlined guifg=fg guibg=NONE ctermfg=fg ctermbg=NONE gui=underline cterm=underline
|
||||
@@ -129,10 +129,10 @@ if g:lucius_style == "dark"
|
||||
hi SpellLocal guisp=#ffa500 ctermfg=bg ctermbg=214 gui=undercurl cterm=undercurl
|
||||
|
||||
" == Diff ==
|
||||
hi DiffAdd guifg=fg guibg=#304030 ctermfg=fg ctermbg=22 gui=none cterm=none
|
||||
hi DiffChange guifg=fg guibg=#504030 ctermfg=fg ctermbg=58 gui=none cterm=none
|
||||
hi DiffDelete guifg=fg guibg=#403030 ctermfg=fg ctermbg=52 gui=none cterm=none
|
||||
hi DiffText guifg=#d0c060 guibg=#504030 ctermfg=220 ctermbg=58 gui=bold cterm=bold
|
||||
hi DiffAdd guifg=fg guibg=#405040 ctermfg=fg ctermbg=22 gui=none cterm=none
|
||||
hi DiffChange guifg=fg guibg=#605040 ctermfg=fg ctermbg=58 gui=none cterm=none
|
||||
hi DiffDelete guifg=fg guibg=#504040 ctermfg=fg ctermbg=52 gui=none cterm=none
|
||||
hi DiffText guifg=#d0c060 guibg=#605040 ctermfg=220 ctermbg=58 gui=bold cterm=bold
|
||||
|
||||
" == Misc ==
|
||||
hi Directory guifg=#c0e0b0 guibg=NONE ctermfg=151 ctermbg=NONE gui=none cterm=none
|
||||
@@ -155,23 +155,23 @@ elseif g:lucius_style == "light"
|
||||
|
||||
hi Comment guifg=#909090 guibg=NONE ctermfg=246 ctermbg=NONE gui=none cterm=none
|
||||
|
||||
hi Constant guifg=#007000 guibg=NONE ctermfg=22 ctermbg=NONE gui=none cterm=none
|
||||
hi BConstant guifg=#007000 guibg=NONE ctermfg=22 ctermbg=NONE gui=none cterm=bold
|
||||
hi Constant guifg=#008000 guibg=NONE ctermfg=22 ctermbg=NONE gui=none cterm=none
|
||||
hi BConstant guifg=#008000 guibg=NONE ctermfg=22 ctermbg=NONE gui=bold cterm=bold
|
||||
|
||||
hi Identifier guifg=#008080 guibg=NONE ctermfg=30 ctermbg=NONE gui=none cterm=none
|
||||
hi BIdentifier guifg=#008080 guibg=NONE ctermfg=30 ctermbg=NONE gui=none cterm=bold
|
||||
hi Identifier guifg=#009090 guibg=NONE ctermfg=30 ctermbg=NONE gui=none cterm=none
|
||||
hi BIdentifier guifg=#009090 guibg=NONE ctermfg=30 ctermbg=NONE gui=bold cterm=bold
|
||||
|
||||
hi Statement guifg=#0030b0 guibg=NONE ctermfg=19 ctermbg=NONE gui=none cterm=none
|
||||
hi BStatement guifg=#0030b0 guibg=NONE ctermfg=19 ctermbg=NONE gui=none cterm=bold
|
||||
hi Statement guifg=#0030c0 guibg=NONE ctermfg=19 ctermbg=NONE gui=none cterm=none
|
||||
hi BStatement guifg=#0030c0 guibg=NONE ctermfg=19 ctermbg=NONE gui=bold cterm=bold
|
||||
|
||||
hi PreProc guifg=#a06000 guibg=NONE ctermfg=130 ctermbg=NONE gui=none cterm=none
|
||||
hi BPreProc guifg=#a06000 guibg=NONE ctermfg=130 ctermbg=NONE gui=none cterm=bold
|
||||
hi BPreProc guifg=#a06000 guibg=NONE ctermfg=130 ctermbg=NONE gui=bold cterm=bold
|
||||
|
||||
hi Type guifg=#0070a0 guibg=NONE ctermfg=25 ctermbg=NONE gui=none cterm=none
|
||||
hi BType guifg=#0070a0 guibg=NONE ctermfg=25 ctermbg=NONE gui=none cterm=bold
|
||||
hi Type guifg=#0070b0 guibg=NONE ctermfg=25 ctermbg=NONE gui=none cterm=none
|
||||
hi BType guifg=#0070b0 guibg=NONE ctermfg=25 ctermbg=NONE gui=bold cterm=bold
|
||||
|
||||
hi Special guifg=#703080 guibg=NONE ctermfg=5 ctermbg=NONE gui=none cterm=none
|
||||
hi BSpecial guifg=#703080 guibg=NONE ctermfg=5 ctermbg=NONE gui=none cterm=bold
|
||||
hi Special guifg=#700090 guibg=NONE ctermfg=5 ctermbg=NONE gui=none cterm=none
|
||||
hi BSpecial guifg=#700090 guibg=NONE ctermfg=5 ctermbg=NONE gui=bold cterm=bold
|
||||
|
||||
" == Text Markup ==
|
||||
hi Underlined guifg=fg guibg=NONE ctermfg=fg ctermbg=NONE gui=underline cterm=underline
|
||||
@@ -180,7 +180,7 @@ elseif g:lucius_style == "light"
|
||||
hi MatchParen guifg=NONE guibg=#d0f080 ctermfg=NONE ctermbg=192 gui=none cterm=none
|
||||
hi NonText guifg=#b0c0d0 guibg=NONE ctermfg=146 ctermbg=NONE gui=none cterm=none
|
||||
hi SpecialKey guifg=#b0d0c0 guibg=NONE ctermfg=151 ctermbg=NONE gui=none cterm=none
|
||||
hi Title guifg=#0080e0 guibg=NONE ctermfg=26 ctermbg=NONE gui=bold cterm=bold
|
||||
hi Title guifg=#0060a0 guibg=NONE ctermfg=26 ctermbg=NONE gui=bold cterm=bold
|
||||
|
||||
" == Text Selection ==
|
||||
hi Cursor guifg=bg guibg=#505050 ctermfg=bg ctermbg=239 gui=none cterm=none
|
||||
@@ -213,10 +213,10 @@ elseif g:lucius_style == "light"
|
||||
hi SpellLocal guisp=#ffa500 ctermbg=221 gui=undercurl cterm=undercurl
|
||||
|
||||
" == Diff ==
|
||||
hi DiffAdd guifg=fg guibg=#d0e0d0 ctermfg=fg ctermbg=151: gui=none cterm=none
|
||||
hi DiffAdd guifg=fg guibg=#d0e0d0 ctermfg=fg ctermbg=151 gui=none cterm=none
|
||||
hi DiffChange guifg=fg guibg=#e0d6c0 ctermfg=fg ctermbg=187 gui=none cterm=none
|
||||
hi DiffDelete guifg=fg guibg=#f0d0d0 ctermfg=fg ctermbg=181 gui=none cterm=none
|
||||
hi DiffText guifg=#c06000 guibg=#e0d6c0 ctermfg=166 ctermbg=187 gui=none cterm=bold
|
||||
hi DiffText guifg=#d05000 guibg=#e0d6c0 ctermfg=160 ctermbg=187 gui=bold cterm=bold
|
||||
|
||||
" == Misc ==
|
||||
hi Directory guifg=#009040 guibg=NONE ctermfg=29 ctermbg=NONE gui=none cterm=none
|
||||
|
||||
254
indent/html.vim
Normal file
254
indent/html.vim
Normal file
@@ -0,0 +1,254 @@
|
||||
|
||||
" Description: html indenter
|
||||
" Author: Johannes Zellner <johannes@zellner.org>
|
||||
" Last Change: Mo, 05 Jun 2006 22:32:41 CEST
|
||||
" Restoring 'cpo' and 'ic' added by Bram 2006 May 5
|
||||
" Globals: g:html_indent_tags -- indenting tags
|
||||
" g:html_indent_strict -- inhibit 'O O' elements
|
||||
" g:html_indent_strict_table -- inhibit 'O -' elements
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
"if exists("b:did_indent")
|
||||
"finish
|
||||
"endif
|
||||
"let b:did_indent = 1
|
||||
|
||||
if exists("g:js_indent")
|
||||
so g:js_indent
|
||||
else
|
||||
ru! indent/javascript.vim
|
||||
endif
|
||||
|
||||
echo "Sourcing html indent"
|
||||
|
||||
|
||||
" [-- local settings (must come before aborting the script) --]
|
||||
setlocal indentexpr=HtmlIndentGetter(v:lnum)
|
||||
setlocal indentkeys=o,O,*<Return>,<>>,{,}
|
||||
|
||||
|
||||
if exists('g:html_indent_tags')
|
||||
unlet g:html_indent_tags
|
||||
endif
|
||||
|
||||
" [-- helper function to assemble tag list --]
|
||||
fun! <SID>HtmlIndentPush(tag)
|
||||
if exists('g:html_indent_tags')
|
||||
let g:html_indent_tags = g:html_indent_tags.'\|'.a:tag
|
||||
else
|
||||
let g:html_indent_tags = a:tag
|
||||
endif
|
||||
endfun
|
||||
|
||||
|
||||
" [-- <ELEMENT ? - - ...> --]
|
||||
call <SID>HtmlIndentPush('a')
|
||||
call <SID>HtmlIndentPush('abbr')
|
||||
call <SID>HtmlIndentPush('acronym')
|
||||
call <SID>HtmlIndentPush('address')
|
||||
call <SID>HtmlIndentPush('b')
|
||||
call <SID>HtmlIndentPush('bdo')
|
||||
call <SID>HtmlIndentPush('big')
|
||||
call <SID>HtmlIndentPush('blockquote')
|
||||
call <SID>HtmlIndentPush('button')
|
||||
call <SID>HtmlIndentPush('caption')
|
||||
call <SID>HtmlIndentPush('center')
|
||||
call <SID>HtmlIndentPush('cite')
|
||||
call <SID>HtmlIndentPush('code')
|
||||
call <SID>HtmlIndentPush('colgroup')
|
||||
call <SID>HtmlIndentPush('del')
|
||||
call <SID>HtmlIndentPush('dfn')
|
||||
call <SID>HtmlIndentPush('dir')
|
||||
call <SID>HtmlIndentPush('div')
|
||||
call <SID>HtmlIndentPush('dl')
|
||||
call <SID>HtmlIndentPush('em')
|
||||
call <SID>HtmlIndentPush('fieldset')
|
||||
call <SID>HtmlIndentPush('font')
|
||||
call <SID>HtmlIndentPush('form')
|
||||
call <SID>HtmlIndentPush('frameset')
|
||||
call <SID>HtmlIndentPush('h1')
|
||||
call <SID>HtmlIndentPush('h2')
|
||||
call <SID>HtmlIndentPush('h3')
|
||||
call <SID>HtmlIndentPush('h4')
|
||||
call <SID>HtmlIndentPush('h5')
|
||||
call <SID>HtmlIndentPush('h6')
|
||||
call <SID>HtmlIndentPush('i')
|
||||
call <SID>HtmlIndentPush('iframe')
|
||||
call <SID>HtmlIndentPush('ins')
|
||||
call <SID>HtmlIndentPush('kbd')
|
||||
call <SID>HtmlIndentPush('label')
|
||||
call <SID>HtmlIndentPush('legend')
|
||||
call <SID>HtmlIndentPush('map')
|
||||
call <SID>HtmlIndentPush('menu')
|
||||
call <SID>HtmlIndentPush('noframes')
|
||||
call <SID>HtmlIndentPush('noscript')
|
||||
call <SID>HtmlIndentPush('object')
|
||||
call <SID>HtmlIndentPush('ol')
|
||||
call <SID>HtmlIndentPush('optgroup')
|
||||
" call <SID>HtmlIndentPush('pre')
|
||||
call <SID>HtmlIndentPush('q')
|
||||
call <SID>HtmlIndentPush('s')
|
||||
call <SID>HtmlIndentPush('samp')
|
||||
call <SID>HtmlIndentPush('script')
|
||||
call <SID>HtmlIndentPush('select')
|
||||
call <SID>HtmlIndentPush('small')
|
||||
call <SID>HtmlIndentPush('span')
|
||||
call <SID>HtmlIndentPush('strong')
|
||||
call <SID>HtmlIndentPush('style')
|
||||
call <SID>HtmlIndentPush('sub')
|
||||
call <SID>HtmlIndentPush('sup')
|
||||
call <SID>HtmlIndentPush('table')
|
||||
call <SID>HtmlIndentPush('textarea')
|
||||
call <SID>HtmlIndentPush('title')
|
||||
call <SID>HtmlIndentPush('tt')
|
||||
call <SID>HtmlIndentPush('u')
|
||||
call <SID>HtmlIndentPush('ul')
|
||||
call <SID>HtmlIndentPush('var')
|
||||
|
||||
|
||||
" [-- <ELEMENT ? O O ...> --]
|
||||
if !exists('g:html_indent_strict')
|
||||
call <SID>HtmlIndentPush('body')
|
||||
call <SID>HtmlIndentPush('head')
|
||||
call <SID>HtmlIndentPush('html')
|
||||
call <SID>HtmlIndentPush('tbody')
|
||||
endif
|
||||
|
||||
|
||||
" [-- <ELEMENT ? O - ...> --]
|
||||
if !exists('g:html_indent_strict_table')
|
||||
call <SID>HtmlIndentPush('th')
|
||||
call <SID>HtmlIndentPush('td')
|
||||
call <SID>HtmlIndentPush('tr')
|
||||
call <SID>HtmlIndentPush('tfoot')
|
||||
call <SID>HtmlIndentPush('thead')
|
||||
endif
|
||||
|
||||
delfun <SID>HtmlIndentPush
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo-=C
|
||||
|
||||
" [-- count indent-increasing tags of line a:lnum --]
|
||||
fun! <SID>HtmlIndentOpen(lnum, pattern)
|
||||
let s = substitute('x'.getline(a:lnum),
|
||||
\ '.\{-}\(\(<\)\('.a:pattern.'\)\>\)', "\1", 'g')
|
||||
let s = substitute(s, "[^\1].*$", '', '')
|
||||
return strlen(s)
|
||||
endfun
|
||||
|
||||
" [-- count indent-decreasing tags of line a:lnum --]
|
||||
fun! <SID>HtmlIndentClose(lnum, pattern)
|
||||
let s = substitute('x'.getline(a:lnum),
|
||||
\ '.\{-}\(\(<\)/\('.a:pattern.'\)\>>\)', "\1", 'g')
|
||||
let s = substitute(s, "[^\1].*$", '', '')
|
||||
return strlen(s)
|
||||
endfun
|
||||
|
||||
" [-- count indent-increasing '{' of (java|css) line a:lnum --]
|
||||
fun! <SID>HtmlIndentOpenAlt(lnum)
|
||||
return strlen(substitute(getline(a:lnum), '[^{]\+', '', 'g'))
|
||||
endfun
|
||||
|
||||
" [-- count indent-decreasing '}' of (java|css) line a:lnum --]
|
||||
fun! <SID>HtmlIndentCloseAlt(lnum)
|
||||
return strlen(substitute(getline(a:lnum), '[^}]\+', '', 'g'))
|
||||
endfun
|
||||
|
||||
" [-- return the sum of indents respecting the syntax of a:lnum --]
|
||||
fun! <SID>HtmlIndentSum(lnum, style)
|
||||
if a:style == match(getline(a:lnum), '^\s*</')
|
||||
if a:style == match(getline(a:lnum), '^\s*</\<\('.g:html_indent_tags.'\)\>')
|
||||
let open = <SID>HtmlIndentOpen(a:lnum, g:html_indent_tags)
|
||||
let close = <SID>HtmlIndentClose(a:lnum, g:html_indent_tags)
|
||||
if 0 != open || 0 != close
|
||||
return open - close
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
if '' != &syntax &&
|
||||
\ synIDattr(synID(a:lnum, 1, 1), 'name') =~ '\(css\|java\).*' &&
|
||||
\ synIDattr(synID(a:lnum, strlen(getline(a:lnum)), 1), 'name')
|
||||
\ =~ '\(css\|java\).*'
|
||||
if a:style == match(getline(a:lnum), '^\s*}')
|
||||
return <SID>HtmlIndentOpenAlt(a:lnum) - <SID>HtmlIndentCloseAlt(a:lnum)
|
||||
endif
|
||||
endif
|
||||
return 0
|
||||
endfun
|
||||
|
||||
fun! HtmlIndentGetter(lnum)
|
||||
|
||||
echo "Grabbing html indent for line: " . a:lnum
|
||||
" Find a non-empty line above the current line.
|
||||
let lnum = prevnonblank(a:lnum - 1)
|
||||
|
||||
" Hit the start of the file, use zero indent.
|
||||
if lnum == 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
let restore_ic = &ic
|
||||
setlocal ic " ignore case
|
||||
|
||||
" [-- special handling for <pre>: no indenting --]
|
||||
if getline(a:lnum) =~ '\c</pre>'
|
||||
\ || 0 < searchpair('\c<pre>', '', '\c</pre>', 'nWb')
|
||||
\ || 0 < searchpair('\c<pre>', '', '\c</pre>', 'nW')
|
||||
" we're in a line with </pre> or inside <pre> ... </pre>
|
||||
if restore_ic == 0
|
||||
setlocal noic
|
||||
endif
|
||||
return -1
|
||||
endif
|
||||
|
||||
" [-- special handling for <javascript>: use cindent --]
|
||||
let js = '<script.*type\s*=.*javascript'
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" by Tye Zdrojewski <zdro@yahoo.com>, 05 Jun 2006
|
||||
" ZDR: This needs to be an AND (we are 'after the start of the pair' AND
|
||||
" we are 'before the end of the pair'). Otherwise, indentation
|
||||
" before the start of the script block will be affected; the end of
|
||||
" the pair will still match if we are before the beginning of the
|
||||
" pair.
|
||||
"
|
||||
if 0 < searchpair(js, '', '</script>', 'nWb')
|
||||
\ && 0 < searchpair(js, '', '</script>', 'nW')
|
||||
" we're inside javascript
|
||||
|
||||
if getline(lnum) !~ js && getline(a:lnum) !~ '</script>'
|
||||
if restore_ic == 0
|
||||
setlocal noic
|
||||
endif
|
||||
return GetJsIndent(a:lnum)
|
||||
endif
|
||||
endif
|
||||
|
||||
if getline(lnum) =~ '\c</pre>'
|
||||
" line before the current line a:lnum contains
|
||||
" a closing </pre>. --> search for line before
|
||||
" starting <pre> to restore the indent.
|
||||
let preline = prevnonblank(search('\c<pre>', 'bW') - 1)
|
||||
if preline > 0
|
||||
if restore_ic == 0
|
||||
setlocal noic
|
||||
endif
|
||||
return indent(preline)
|
||||
endif
|
||||
endif
|
||||
|
||||
let ind = <SID>HtmlIndentSum(lnum, -1)
|
||||
let ind = ind + <SID>HtmlIndentSum(a:lnum, 0)
|
||||
|
||||
if restore_ic == 0
|
||||
setlocal noic
|
||||
endif
|
||||
|
||||
return indent(lnum) + (&sw * ind)
|
||||
endfun
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" [-- EOF <runtime>/indent/html.vim --]
|
||||
@@ -1,83 +1,407 @@
|
||||
" Vim indent file
|
||||
" Language: JavaScript
|
||||
" Author: Ryan (ryanthe) Fabella <ryanthe at gmail dot com>
|
||||
" URL: -
|
||||
" Last Change: 2007 september 25
|
||||
" Vim indent file Language: JavaScript
|
||||
" Author: Preston Koprivica (pkopriv2@gmail.com)
|
||||
" URL:
|
||||
" Last Change: April 30, 2010
|
||||
|
||||
" 0. Standard Stuff
|
||||
" =================
|
||||
|
||||
" Only load one indent script per buffer
|
||||
if exists('b:did_indent')
|
||||
finish
|
||||
endif
|
||||
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal indentexpr=GetJsIndent()
|
||||
setlocal indentkeys=0{,0},0),:,!^F,o,O,e,*<Return>,=*/
|
||||
" Clean CR when the file is in Unix format
|
||||
if &fileformat == "unix"
|
||||
silent! %s/\r$//g
|
||||
" Set the global log variable 1 = logging enabled, 0 = logging disabled
|
||||
if !exists("g:js_indent_log")
|
||||
let g:js_indent_log = 0
|
||||
endif
|
||||
" Only define the functions once per Vim session.
|
||||
if exists("*GetJsIndent")
|
||||
finish
|
||||
|
||||
setlocal indentexpr=GetJsIndent(v:lnum)
|
||||
setlocal indentkeys=
|
||||
|
||||
|
||||
setlocal cindent
|
||||
setlocal autoindent
|
||||
|
||||
|
||||
" 1. Variables
|
||||
" ============
|
||||
|
||||
" Inline comments (for anchoring other statements)
|
||||
let s:js_mid_line_comment = '\s*\(\/\*.*\*\/\)*\s*'
|
||||
let s:js_end_line_comment = s:js_mid_line_comment . '\s*\(//.*\)*'
|
||||
let s:js_line_comment = s:js_end_line_comment
|
||||
|
||||
" Comment/String Syntax Key
|
||||
let s:syn_comment = '\(Comment\|String\|Regexp\)'
|
||||
|
||||
|
||||
" 2. Aux. Functions
|
||||
" =================
|
||||
|
||||
" = Method: IsInComment
|
||||
"
|
||||
" Determines whether the specified position is contained in a comment. "Note:
|
||||
" This depends on a
|
||||
function! s:IsInComment(lnum, cnum)
|
||||
return synIDattr(synID(a:lnum, a:cnum, 1), 'name') =~? s:syn_comment
|
||||
endfunction
|
||||
|
||||
|
||||
" = Method: IsComment
|
||||
"
|
||||
" Determines whether a line is a comment or not.
|
||||
function! s:IsComment(lnum)
|
||||
let line = getline(a:lnum)
|
||||
|
||||
return s:IsInComment(a:lnum, 1) && s:IsInComment(a:lnum, strlen(line)) "Doesn't absolutely work. Only Probably!
|
||||
endfunction
|
||||
|
||||
|
||||
" = Method: GetNonCommentLine
|
||||
"
|
||||
" Grabs the nearest non-commented line
|
||||
function! s:GetNonCommentLine(lnum)
|
||||
let lnum = prevnonblank(a:lnum)
|
||||
|
||||
while lnum > 0
|
||||
if s:IsComment(lnum)
|
||||
let lnum = prevnonblank(lnum - 1)
|
||||
else
|
||||
return lnum
|
||||
endif
|
||||
function! GetJsIndent()
|
||||
let pnum = prevnonblank(v:lnum - 1)
|
||||
endwhile
|
||||
|
||||
return lnum
|
||||
endfunction
|
||||
|
||||
" = Method: SearchForPair
|
||||
"
|
||||
" Returns the beginning tag of a given pair starting from the given line.
|
||||
function! s:SearchForPair(lnum, beg, end)
|
||||
" Save the cursor position.
|
||||
let curpos = getpos(".")
|
||||
|
||||
" Set the cursor position to the beginning of the line (default
|
||||
" behavior when using ==)
|
||||
call cursor(a:lnum, 0)
|
||||
|
||||
" Search for the opening tag
|
||||
let mnum = searchpair(a:beg, '', a:end, 'bW',
|
||||
\ 'synIDattr(synID(line("."), col("."), 0), "name") =~? s:syn_comment' )
|
||||
|
||||
"Restore the cursor position
|
||||
call cursor(curpos)
|
||||
|
||||
" Finally, return the matched line number
|
||||
return mnum
|
||||
endfunction
|
||||
|
||||
|
||||
" Object Helpers
|
||||
" ==============
|
||||
let s:object_beg = '{[^}]*' . s:js_end_line_comment . '$'
|
||||
let s:object_end = '^' . s:js_mid_line_comment . '}[;,]\='
|
||||
|
||||
|
||||
function! s:IsObjectBeg(line)
|
||||
return a:line =~ s:object_beg
|
||||
endfunction
|
||||
|
||||
function! s:IsObjectEnd(line)
|
||||
return a:line =~ s:object_end
|
||||
endfunction
|
||||
|
||||
function! s:GetObjectBeg(lnum)
|
||||
return s:SearchForPair(a:lnum, '{', '}')
|
||||
endfunction
|
||||
|
||||
|
||||
" Array Helpers
|
||||
" ==============
|
||||
let s:array_beg = '\[[^\]]*' . s:js_end_line_comment . '$'
|
||||
let s:array_end = '^' . s:js_mid_line_comment . '[^\[]*\][;,]*' . s:js_end_line_comment . '$'
|
||||
|
||||
|
||||
function! s:IsArrayBeg(line)
|
||||
return a:line =~ s:array_beg
|
||||
endfunction
|
||||
|
||||
function! s:IsArrayEnd(line)
|
||||
return a:line =~ s:array_end
|
||||
endfunction
|
||||
|
||||
function! s:GetArrayBeg(lnum)
|
||||
return s:SearchForPair(a:lnum, '\[', '\]')
|
||||
endfunction
|
||||
|
||||
|
||||
" MultiLine Declaration/Invocation Helpers
|
||||
" ========================================
|
||||
let s:paren_beg = '([^)]*' . s:js_end_line_comment . '$'
|
||||
let s:paren_end = '^' . s:js_mid_line_comment . '[^(]*)[;,]*'
|
||||
|
||||
function! s:IsParenBeg(line)
|
||||
return a:line =~ s:paren_beg
|
||||
endfunction
|
||||
|
||||
function! s:IsParenEnd(line)
|
||||
return a:line =~ s:paren_end
|
||||
endfunction
|
||||
|
||||
function! s:GetParenBeg(lnum)
|
||||
return s:SearchForPair(a:lnum, '(', ')')
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
" Continuation Helpers
|
||||
" ====================
|
||||
let s:continuation = '\(+\|\\\)\{1}' . s:js_line_comment . '$'
|
||||
|
||||
function! s:IsContinuationLine(line)
|
||||
return a:line =~ s:continuation
|
||||
endfunction
|
||||
|
||||
function! s:GetContinuationBegin(lnum)
|
||||
let cur = a:lnum
|
||||
|
||||
while s:IsContinuationLine(getline(cur))
|
||||
let cur -= 1
|
||||
endwhile
|
||||
|
||||
return cur + 1
|
||||
endfunction
|
||||
|
||||
|
||||
" Switch Helpers
|
||||
" ==============
|
||||
let s:switch_beg_next_line = 'switch\s*(.*)\s*' . s:js_mid_line_comment . s:js_end_line_comment . '$'
|
||||
let s:switch_beg_same_line = 'switch\s*(.*)\s*' . s:js_mid_line_comment . '{\s*' . s:js_line_comment . '$'
|
||||
let s:switch_mid = '^.*\(case.*\|default\)\s*:\s*'
|
||||
|
||||
function! s:IsSwitchBeginNextLine(line)
|
||||
return a:line =~ s:switch_beg_next_line
|
||||
endfunction
|
||||
|
||||
function! s:IsSwitchBeginSameLine(line)
|
||||
return a:line =~ s:switch_beg_same_line
|
||||
endfunction
|
||||
|
||||
function! s:IsSwitchMid(line)
|
||||
return a:line =~ s:switch_mid
|
||||
endfunction
|
||||
|
||||
|
||||
" Control Helpers
|
||||
" ===============
|
||||
let s:cntrl_beg_keys = '\(\(\(if\|for\|with\|while\)\s*(.*)\)\|\(try\|do\)\)\s*'
|
||||
let s:cntrl_mid_keys = '\(\(\(else\s*if\|catch\)\s*(.*)\)\|\(finally\|else\)\)\s*'
|
||||
|
||||
let s:cntrl_beg = s:cntrl_beg_keys . s:js_end_line_comment . '$'
|
||||
let s:cntrl_mid = s:cntrl_mid_keys . s:js_end_line_comment . '$'
|
||||
|
||||
let s:cntrl_end = '\(while\s*(.*)\)\s*;\=\s*' . s:js_end_line_comment . '$'
|
||||
|
||||
function! s:IsControlBeg(line)
|
||||
return a:line =~ s:cntrl_beg
|
||||
endfunction
|
||||
|
||||
function! s:IsControlMid(line)
|
||||
return a:line =~ s:cntrl_mid
|
||||
endfunction
|
||||
|
||||
function! s:IsControlMidStrict(line)
|
||||
return a:line =~ s:cntrl_mid
|
||||
endfunction
|
||||
|
||||
function! s:IsControlEnd(line)
|
||||
return a:line =~ s:cntrl_end
|
||||
endfunction
|
||||
|
||||
" = Method: Log
|
||||
"
|
||||
" Logs a message to the stdout.
|
||||
function! s:Log(msg)
|
||||
if g:js_indent_log
|
||||
echo "LOG: " . a:msg
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
" 3. Indenter
|
||||
" ===========
|
||||
function! GetJsIndent(lnum)
|
||||
" Grab the first non-comment line prior to this line
|
||||
let pnum = s:GetNonCommentLine(a:lnum-1)
|
||||
|
||||
" First line, start at indent = 0
|
||||
if pnum == 0
|
||||
call s:Log("No, noncomment lines prior to the current line.")
|
||||
return 0
|
||||
endif
|
||||
let line = getline(v:lnum)
|
||||
|
||||
" Grab the second non-comment line prior to this line
|
||||
let ppnum = s:GetNonCommentLine(pnum-1)
|
||||
|
||||
call s:Log("Line: " . a:lnum)
|
||||
call s:Log("PLine: " . pnum)
|
||||
call s:Log("PPLine: " . ppnum)
|
||||
|
||||
" Grab the lines themselves.
|
||||
let line = getline(a:lnum)
|
||||
let pline = getline(pnum)
|
||||
let ppline = getline(ppnum)
|
||||
|
||||
" Determine the current level of indentation
|
||||
let ind = indent(pnum)
|
||||
|
||||
if pline =~ '{\s*$\|[\s*$\|(\s*$'
|
||||
let ind = ind + &sw
|
||||
|
||||
" Handle: Object Closers (ie })
|
||||
" =============================
|
||||
if s:IsObjectEnd(line) && !s:IsComment(a:lnum)
|
||||
call s:Log("Line matched object end")
|
||||
|
||||
let obeg = s:GetObjectBeg(a:lnum)
|
||||
let oind = indent(obeg)
|
||||
let oline = getline(obeg)
|
||||
|
||||
call s:Log("The object beg was found at: " . obeg)
|
||||
return oind
|
||||
endif
|
||||
|
||||
if pline =~ ';\s*$' && line =~ '^\s*}'
|
||||
let ind = ind - &sw
|
||||
if s:IsObjectBeg(pline)
|
||||
call s:Log("Pline matched object beg")
|
||||
return ind + &sw
|
||||
endif
|
||||
|
||||
if pline =~ '\s*]\s*$' && line =~ '^\s*),\s*$'
|
||||
let ind = ind - &sw
|
||||
|
||||
" Handle: Array Closer (ie ])
|
||||
" ============================
|
||||
if s:IsArrayEnd(line) && !s:IsComment(a:lnum)
|
||||
call s:Log("Line matched array end")
|
||||
|
||||
let abeg = s:GetArrayBeg(a:lnum)
|
||||
let aind = indent(abeg)
|
||||
|
||||
call s:Log("The array beg was found at: " . abeg)
|
||||
return aind
|
||||
endif
|
||||
|
||||
if pline =~ '\s*]\s*$' && line =~ '^\s*}\s*$'
|
||||
let ind = ind - &sw
|
||||
if s:IsArrayBeg(pline)
|
||||
call s:Log("Pline matched array beg")
|
||||
return ind + &sw
|
||||
endif
|
||||
|
||||
if line =~ '^\s*});\s*$\|^\s*);\s*$' && pline !~ ';\s*$'
|
||||
let ind = ind - &sw
|
||||
" Handle: Parens
|
||||
" ==============
|
||||
if s:IsParenEnd(line) && !s:IsComment(a:lnum)
|
||||
call s:Log("Line matched paren end")
|
||||
|
||||
let abeg = s:GetParenBeg(a:lnum)
|
||||
let aind = indent(abeg)
|
||||
|
||||
call s:Log("The paren beg was found at: " . abeg)
|
||||
return aind
|
||||
endif
|
||||
|
||||
if line =~ '^\s*})' && pline =~ '\s*,\s*$'
|
||||
let ind = ind - &sw
|
||||
if s:IsParenBeg(pline)
|
||||
call s:Log("Pline matched paren beg")
|
||||
return ind + &sw
|
||||
endif
|
||||
|
||||
if line =~ '^\s*}();\s*$' && pline =~ '^\s*}\s*$'
|
||||
let ind = ind - &sw
|
||||
|
||||
" Handle: Continuation Lines.
|
||||
" ========================================================
|
||||
if s:IsContinuationLine(pline)
|
||||
call s:Log('Pline is a continuation line.')
|
||||
|
||||
let cbeg = s:GetContinuationBegin(pnum)
|
||||
let cind = indent(cbeg)
|
||||
|
||||
call s:Log('The continuation block begin found at: ' . cbeg)
|
||||
return cind + &sw
|
||||
endif
|
||||
|
||||
if line =~ '^\s*}),\s*$'
|
||||
let ind = ind - &sw
|
||||
if s:IsContinuationLine(ppline)
|
||||
call s:Log('PPline was a continuation line but pline wasnt.')
|
||||
return ind - &sw
|
||||
endif
|
||||
|
||||
if pline =~ '^\s*}\s*$' && line =~ '),\s*$'
|
||||
let ind = ind - &sw
|
||||
" Handle: Switch Control Blocks
|
||||
" =============================
|
||||
if s:IsSwitchMid(pline)
|
||||
call s:Log("PLine matched switch cntrl mid")
|
||||
if s:IsSwitchMid(line) || s:IsObjectEnd(line)
|
||||
call s:Log("Line matched a cntrl mid")
|
||||
return ind
|
||||
else
|
||||
call s:Log("Line didnt match a cntrl mid")
|
||||
return ind + &sw
|
||||
endif
|
||||
endif
|
||||
|
||||
if pline =~ '^\s*for\s*' && line =~ ')\s*$'
|
||||
let ind = ind + &sw
|
||||
if s:IsSwitchMid(line)
|
||||
call s:Log("Line matched switch cntrl mid")
|
||||
return ind - &sw
|
||||
endif
|
||||
|
||||
if line =~ '^\s*}\s*$\|^\s*]\s*$\|\s*},\|\s*]);\s*\|\s*}]\s*$\|\s*};\s*$\|\s*})$\|\s*}).el$' && pline !~ '\s*;\s*$\|\s*]\s*$' && line !~ '^\s*{' && line !~ '\s*{\s*}\s*'
|
||||
let ind = ind - &sw
|
||||
|
||||
" Handle: Single Line Control Blocks
|
||||
" ==================================
|
||||
if s:IsControlBeg(pline)
|
||||
call s:Log("Pline matched control beginning")
|
||||
|
||||
if s:IsControlMid(line)
|
||||
call s:Log("Line matched a control mid")
|
||||
return ind
|
||||
elseif line =~ '^\s*{\s*$'
|
||||
call s:Log("Line matched an object beg")
|
||||
return ind
|
||||
else
|
||||
return ind + &sw
|
||||
endif
|
||||
|
||||
if pline =~ '^\s*/\*'
|
||||
let ind = ind + 1
|
||||
endif
|
||||
|
||||
if pline =~ '\*/$'
|
||||
let ind = ind - 1
|
||||
if s:IsControlMid(pline)
|
||||
call s:Log("Pline matched a control mid")
|
||||
|
||||
if s:IsControlMid(line)
|
||||
call s:Log("Line matched a control mid")
|
||||
return ind
|
||||
elseif s:IsObjectBeg(line)
|
||||
call s:Log("Line matched an object beg")
|
||||
return ind
|
||||
else
|
||||
call s:Log("Line didn't match a control mid or object beg."
|
||||
return ind + &sw
|
||||
endif
|
||||
endif
|
||||
|
||||
if s:IsControlMid(line)
|
||||
call s:Log("Line matched a control mid.")
|
||||
|
||||
if s:IsControlEnd(pline) || s:IsObjectEnd(pline)
|
||||
call s:Log("PLine matched control end")
|
||||
return ind
|
||||
else
|
||||
call s:Log("Pline didn't match object end")
|
||||
return ind - &sw
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
if ( s:IsControlBeg(ppline) || s:IsControlMid(ppline) ) &&
|
||||
\ !s:IsObjectBeg(pline) && !s:IsObjectEnd(pline)
|
||||
call s:Log("PPLine matched single line control beg or mid")
|
||||
return ind - &sw
|
||||
endif
|
||||
|
||||
" Handle: No matches
|
||||
" ==================
|
||||
"call s:Log("Line didn't match anything. Retaining indent")
|
||||
return ind
|
||||
endfunction
|
||||
|
||||
353
indent/mako.vim
Normal file
353
indent/mako.vim
Normal file
@@ -0,0 +1,353 @@
|
||||
" Vim indent file
|
||||
" Language: Mako
|
||||
" Author: Scott Torborg <storborg@mit.edu>
|
||||
" Version: 0.4
|
||||
" License: Do What The Fuck You Want To Public License (WTFPL)
|
||||
"
|
||||
" ---------------------------------------------------------------------------
|
||||
"
|
||||
" DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
" Version 2, December 2004
|
||||
"
|
||||
" Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
"
|
||||
" Everyone is permitted to copy and distribute verbatim or modified
|
||||
" copies of this license document, and changing it is allowed as long
|
||||
" as the name is changed.
|
||||
"
|
||||
" DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
" TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
"
|
||||
" 0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||
"
|
||||
" ---------------------------------------------------------------------------
|
||||
"
|
||||
" This script does more useful indenting for Mako HTML templates. It indents
|
||||
" inside of control blocks, defs, etc. Note that this indenting style will
|
||||
" sacrifice readability of the output text for the sake of readability of the
|
||||
" template.
|
||||
"
|
||||
" We'll use HTML indenting globally, python inside <% %> blocks. Inspired by
|
||||
" the excellent PHP + HTML indentation files such as php.vim by Pim Snel.
|
||||
"
|
||||
" Changelog:
|
||||
" 0.4 - 5 March 2010
|
||||
" - Added license information
|
||||
" 0.3 - 15 September 2009
|
||||
" - Added explicit indenting for ## comments, fixed unindenting count,
|
||||
" thanks to Mike Lewis (@MikeRLewis) for this
|
||||
" 0.2 - 15 June 2009
|
||||
" - Fixed issue where opening and closing mako tags on the same line
|
||||
" would cause incorrect indenting
|
||||
" 0.1 - 06 June 2009
|
||||
" - Initial public release of mako indent file
|
||||
|
||||
let sw=2 " default shiftwidth of 2 spaces
|
||||
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal nosmartindent
|
||||
setlocal noautoindent
|
||||
setlocal nocindent
|
||||
setlocal nolisp
|
||||
|
||||
setlocal indentexpr=GetMakoIndent()
|
||||
setlocal indentkeys+=*<Return>,<>>,<bs>,end,:
|
||||
|
||||
" Only define the function once.
|
||||
if exists("*GetMakoIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
if exists('g:html_indent_tags')
|
||||
unlet g:html_indent_tags
|
||||
endif
|
||||
|
||||
function IsInsidePythonBlock(startline)
|
||||
" Loop until we get a line that's either <% or %>
|
||||
let lnum = a:startline
|
||||
while getline(lnum) !~ '\(%>\|<%\)$' && lnum > 0
|
||||
let lnum = lnum - 1
|
||||
endwhile
|
||||
|
||||
" lnum points to the last control. If it's a <% then we're inside an
|
||||
" embedded python block, otherwise we're not.
|
||||
return getline(lnum) =~ '<%$'
|
||||
endfunction
|
||||
|
||||
function GetMakoIndent()
|
||||
" Find a non-empty line above the current line
|
||||
let lnum = prevnonblank(v:lnum - 1)
|
||||
|
||||
" Hit the start of the file, use zero indent.
|
||||
if lnum == 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
let line = getline(lnum) " last line
|
||||
let cline = getline(v:lnum) " current line
|
||||
let pline = getline(lnum - 1) " previous to last line
|
||||
let ind = indent(lnum)
|
||||
if line =~ '^\s*##'
|
||||
return indent(lnum)
|
||||
end
|
||||
|
||||
let restore_ic=&ic
|
||||
let &ic=1 " ignore case
|
||||
|
||||
let ind = <SID>HtmlIndentSum(lnum, -1)
|
||||
let ind = <SID>HtmlIndentSum(lnum, -1)
|
||||
let ind = ind + <SID>HtmlIndentSum(v:lnum, 0)
|
||||
|
||||
let &ic=restore_ic
|
||||
|
||||
let ind = indent(lnum) + (&sw * ind)
|
||||
|
||||
" Indent after %anything: or <%anything NOT ending in />
|
||||
if line =~ '^\s*%.*:\s*$'
|
||||
let ind = ind + &sw
|
||||
endif
|
||||
|
||||
" Unindent before %end* or </%anything
|
||||
if cline =~ '^\s*%\s*end'
|
||||
let ind = ind - &sw
|
||||
endif
|
||||
"
|
||||
" Unindent before %else, %except, and %elif
|
||||
if cline =~ '^\s*%\s*else' || cline =~ '^\s*%\s*except' || cline =~ '^\s*%\s*elif'
|
||||
let ind = ind - &sw
|
||||
endif
|
||||
|
||||
" Indent at the beginning of a python control block
|
||||
if line =~ '<%$'
|
||||
let ind = ind + &sw
|
||||
endif
|
||||
"
|
||||
" Unindent at the end of the python block.
|
||||
if cline =~ '^\s*%>$'
|
||||
let scanlnum = lnum
|
||||
" Scan backwards until we find the beginning of this python block.
|
||||
while getline(scanlnum) !~ '<%$' && scanlnum > 0
|
||||
let scanlnum = scanlnum - 1
|
||||
endwhile
|
||||
let ind = indent(scanlnum)
|
||||
endif
|
||||
|
||||
" If we're inside a python block and the previous line ends in a colon,
|
||||
" indent.
|
||||
if IsInsidePythonBlock(lnum - 1)
|
||||
" Indent after :
|
||||
if line =~ '\:$'
|
||||
let ind = ind + &sw
|
||||
endif
|
||||
endif
|
||||
|
||||
return ind
|
||||
endfunction
|
||||
|
||||
|
||||
" [-- helper function to assemble tag list --]
|
||||
fun! <SID>HtmlIndentPush(tag)
|
||||
if exists('g:html_indent_tags')
|
||||
let g:html_indent_tags = g:html_indent_tags.'\|'.a:tag
|
||||
else
|
||||
let g:html_indent_tags = a:tag
|
||||
endif
|
||||
endfun
|
||||
|
||||
fun! <SID>MakoIndentPush(tag)
|
||||
if exists('g:mako_indent_tags')
|
||||
let g:mako_indent_tags = g:mako_indent_tags.'\|'.a:tag
|
||||
else
|
||||
let g:mako_indent_tags = a:tag
|
||||
endif
|
||||
endfun
|
||||
|
||||
" [-- <ELEMENT ? - - ...> --]
|
||||
call <SID>HtmlIndentPush('a')
|
||||
call <SID>HtmlIndentPush('abbr')
|
||||
call <SID>HtmlIndentPush('acronym')
|
||||
call <SID>HtmlIndentPush('address')
|
||||
call <SID>HtmlIndentPush('b')
|
||||
call <SID>HtmlIndentPush('bdo')
|
||||
call <SID>HtmlIndentPush('big')
|
||||
call <SID>HtmlIndentPush('blockquote')
|
||||
call <SID>HtmlIndentPush('button')
|
||||
call <SID>HtmlIndentPush('caption')
|
||||
call <SID>HtmlIndentPush('center')
|
||||
call <SID>HtmlIndentPush('cite')
|
||||
call <SID>HtmlIndentPush('code')
|
||||
call <SID>HtmlIndentPush('colgroup')
|
||||
call <SID>HtmlIndentPush('del')
|
||||
call <SID>HtmlIndentPush('dfn')
|
||||
call <SID>HtmlIndentPush('dir')
|
||||
call <SID>HtmlIndentPush('div')
|
||||
call <SID>HtmlIndentPush('dl')
|
||||
call <SID>HtmlIndentPush('em')
|
||||
call <SID>HtmlIndentPush('fieldset')
|
||||
call <SID>HtmlIndentPush('font')
|
||||
call <SID>HtmlIndentPush('form')
|
||||
call <SID>HtmlIndentPush('frameset')
|
||||
call <SID>HtmlIndentPush('h1')
|
||||
call <SID>HtmlIndentPush('h2')
|
||||
call <SID>HtmlIndentPush('h3')
|
||||
call <SID>HtmlIndentPush('h4')
|
||||
call <SID>HtmlIndentPush('h5')
|
||||
call <SID>HtmlIndentPush('h6')
|
||||
call <SID>HtmlIndentPush('i')
|
||||
call <SID>HtmlIndentPush('iframe')
|
||||
call <SID>HtmlIndentPush('ins')
|
||||
call <SID>HtmlIndentPush('kbd')
|
||||
call <SID>HtmlIndentPush('label')
|
||||
call <SID>HtmlIndentPush('legend')
|
||||
call <SID>HtmlIndentPush('map')
|
||||
call <SID>HtmlIndentPush('menu')
|
||||
call <SID>HtmlIndentPush('noframes')
|
||||
call <SID>HtmlIndentPush('noscript')
|
||||
call <SID>HtmlIndentPush('object')
|
||||
call <SID>HtmlIndentPush('ol')
|
||||
call <SID>HtmlIndentPush('optgroup')
|
||||
call <SID>HtmlIndentPush('pre')
|
||||
call <SID>HtmlIndentPush('q')
|
||||
call <SID>HtmlIndentPush('s')
|
||||
call <SID>HtmlIndentPush('samp')
|
||||
call <SID>HtmlIndentPush('script')
|
||||
call <SID>HtmlIndentPush('select')
|
||||
call <SID>HtmlIndentPush('small')
|
||||
call <SID>HtmlIndentPush('span')
|
||||
call <SID>HtmlIndentPush('strong')
|
||||
call <SID>HtmlIndentPush('style')
|
||||
call <SID>HtmlIndentPush('sub')
|
||||
call <SID>HtmlIndentPush('sup')
|
||||
call <SID>HtmlIndentPush('table')
|
||||
call <SID>HtmlIndentPush('textarea')
|
||||
call <SID>HtmlIndentPush('title')
|
||||
call <SID>HtmlIndentPush('tt')
|
||||
call <SID>HtmlIndentPush('u')
|
||||
call <SID>HtmlIndentPush('ul')
|
||||
call <SID>HtmlIndentPush('var')
|
||||
|
||||
" For some reason the default HTML indentation script doesn't consider these
|
||||
" elements to be worthy of indentation.
|
||||
call <SID>HtmlIndentPush('p')
|
||||
call <SID>HtmlIndentPush('dt')
|
||||
call <SID>HtmlIndentPush('dd')
|
||||
|
||||
|
||||
" [-- <ELEMENT ? O O ...> --]
|
||||
if !exists('g:html_indent_strict')
|
||||
call <SID>HtmlIndentPush('body')
|
||||
call <SID>HtmlIndentPush('head')
|
||||
call <SID>HtmlIndentPush('html')
|
||||
call <SID>HtmlIndentPush('tbody')
|
||||
endif
|
||||
|
||||
|
||||
" [-- <ELEMENT ? O - ...> --]
|
||||
if !exists('g:html_indent_strict_table')
|
||||
call <SID>HtmlIndentPush('th')
|
||||
call <SID>HtmlIndentPush('td')
|
||||
call <SID>HtmlIndentPush('tr')
|
||||
call <SID>HtmlIndentPush('tfoot')
|
||||
call <SID>HtmlIndentPush('thead')
|
||||
endif
|
||||
|
||||
" [-- <Mako Elements> --]
|
||||
call <SID>MakoIndentPush('%def')
|
||||
call <SID>MakoIndentPush('%call')
|
||||
call <SID>MakoIndentPush('%doc')
|
||||
call <SID>MakoIndentPush('%text')
|
||||
call <SID>MakoIndentPush('%.\+:.\+')
|
||||
|
||||
delfun <SID>HtmlIndentPush
|
||||
delfun <SID>MakoIndentPush
|
||||
|
||||
set cpo-=C
|
||||
|
||||
" [-- get number of regex matches in a string --]
|
||||
fun! <SID>MatchCount(expr, pat)
|
||||
let mpos = 0
|
||||
let mcount = 0
|
||||
let expr = a:expr
|
||||
while (mpos > -1)
|
||||
let mend = matchend(expr, a:pat)
|
||||
if mend > -1
|
||||
let mcount = mcount + 1
|
||||
endif
|
||||
if mend == mpos
|
||||
let mpos = mpos + 1
|
||||
else
|
||||
let mpos = mend
|
||||
endif
|
||||
let expr = strpart(expr, mpos)
|
||||
endwhile
|
||||
return mcount
|
||||
endfun
|
||||
|
||||
" [-- count indent-increasing tags of line a:lnum --]
|
||||
fun! <SID>HtmlIndentOpen(lnum)
|
||||
let s = substitute('x'.getline(a:lnum),
|
||||
\ '.\{-}\(\(<\)\('.g:html_indent_tags.'\)\>\)', "\1", 'g')
|
||||
let s = substitute(s, "[^\1].*$", '', '')
|
||||
return strlen(s)
|
||||
endfun
|
||||
|
||||
" [-- count indent-decreasing tags of line a:lnum --]
|
||||
fun! <SID>HtmlIndentClose(lnum)
|
||||
let s = substitute('x'.getline(a:lnum),
|
||||
\ '.\{-}\(\(<\)/\('.g:html_indent_tags.'\)\>>\)', "\1", 'g')
|
||||
let s = substitute(s, "[^\1].*$", '', '')
|
||||
return strlen(s)
|
||||
endfun
|
||||
|
||||
" [-- count indent-increasing mako tags of line a:lnum --]
|
||||
fun! <SID>MakoIndentOpen(lnum)
|
||||
let s = substitute('x'.getline(a:lnum),
|
||||
\ '.\{-}\(\(<\)\('.g:mako_indent_tags.'\)\>\)', "\1", 'g')
|
||||
let s = substitute(s, "[^\1].*$", '', '')
|
||||
return strlen(s)
|
||||
endfun
|
||||
|
||||
" [-- count indent-decreasing mako tags of line a:lnum --]
|
||||
fun! <SID>MakoIndentClose(lnum)
|
||||
let mcount = <SID>MatchCount(getline(a:lnum), '</\('.g:mako_indent_tags.'\)>')
|
||||
let mcount = mcount + <SID>MatchCount(getline(a:lnum), '<\('.g:mako_indent_tags.'\)[^>]*/>')
|
||||
return mcount
|
||||
endfun
|
||||
|
||||
" [-- count indent-increasing '{' of (java|css) line a:lnum --]
|
||||
fun! <SID>HtmlIndentOpenAlt(lnum)
|
||||
return strlen(substitute(getline(a:lnum), '[^{]\+', '', 'g'))
|
||||
endfun
|
||||
|
||||
" [-- count indent-decreasing '}' of (java|css) line a:lnum --]
|
||||
fun! <SID>HtmlIndentCloseAlt(lnum)
|
||||
return strlen(substitute(getline(a:lnum), '[^}]\+', '', 'g'))
|
||||
endfun
|
||||
|
||||
" [-- return the sum of indents respecting the syntax of a:lnum --]
|
||||
fun! <SID>HtmlIndentSum(lnum, style)
|
||||
let open = <SID>HtmlIndentOpen(a:lnum) + <SID>MakoIndentOpen(a:lnum)
|
||||
let close = <SID>HtmlIndentClose(a:lnum) + <SID>MakoIndentClose(a:lnum)
|
||||
if a:style == match(getline(a:lnum), '^\s*</')
|
||||
if a:style == match(getline(a:lnum), '^\s*</\('.g:html_indent_tags.'\|'.g:mako_indent_tags.'\)')
|
||||
if 0 != open || 0 != close
|
||||
return open - close
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
if '' != &syntax &&
|
||||
\ synIDattr(synID(a:lnum, 1, 1), 'name') =~ '\(css\|java\).*' &&
|
||||
\ synIDattr(synID(a:lnum, strlen(getline(a:lnum)) - 1, 1), 'name')
|
||||
\ =~ '\(css\|java\).*'
|
||||
if a:style == match(getline(a:lnum), '^\s*}')
|
||||
return <SID>HtmlIndentOpenAlt(a:lnum) - <SID>HtmlIndentCloseAlt(a:lnum)
|
||||
endif
|
||||
endif
|
||||
return 0
|
||||
endfun
|
||||
|
||||
" vim: set ts=4 sw=4:
|
||||
599
syntax/css.vim
Normal file
599
syntax/css.vim
Normal file
@@ -0,0 +1,599 @@
|
||||
" Vim syntax file
|
||||
" Language: Cascading Style Sheets
|
||||
" Maintainer: Claudio Fleiner <claudio@fleiner.com>
|
||||
" URL: http://www.fleiner.com/vim/syntax/css.vim
|
||||
" Last Change: 2007 Nov 06
|
||||
" CSS2 by Nikolai Weibull
|
||||
" Full CSS2, HTML4 support by Yeti
|
||||
" <20><>bg<62><67><EFBFBD><EFBFBD>6λ<36><CEBB>ʮ<EFBFBD><CAAE><EFBFBD><EFBFBD><EFBFBD>ƴ<EFBFBD><C6B4><EFBFBD>
|
||||
function! s:FGforBG(bg)
|
||||
" takes a 6hex color code and returns a matching color that is visible
|
||||
" substitute ɾ<><C9BE><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>#
|
||||
let pure = substitute(a:bg,'^#','','')
|
||||
" <20><>λȡ<CEBB><C8A1>RGB
|
||||
let r = eval('0x'.pure[0].pure[1])
|
||||
let g = eval('0x'.pure[2].pure[3])
|
||||
let b = eval('0x'.pure[4].pure[5])
|
||||
if r*30 + g*59 + b*11 > 12000
|
||||
return '#000000'
|
||||
else
|
||||
return '#ffffff'
|
||||
end
|
||||
endfunction
|
||||
|
||||
function! s:SetMatcher(clr,pat)
|
||||
let group = 'cssColor'.substitute(a:clr,'^#','','')
|
||||
" Redirect messages to a variable
|
||||
redir => s:currentmatch
|
||||
silent! exe 'syn list '.group
|
||||
" End redirecting messages
|
||||
redir END
|
||||
" !~ regexp doesn't match
|
||||
if s:currentmatch !~ a:pat.'\/'
|
||||
exe 'syn match '.group.' /'.a:pat.'\>/ contained'
|
||||
exe 'syn cluster cssColors add='.group
|
||||
if has('gui_running')
|
||||
exe 'hi '.group.' guifg='.s:FGforBG(a:clr)
|
||||
exe 'hi '.group.' guibg='.a:clr
|
||||
elseif &t_Co == 256
|
||||
exe 'hi '.group.' ctermfg='.s:Rgb2xterm(s:FGforBG(a:clr))
|
||||
exe 'hi '.group.' ctermbg='.s:Rgb2xterm(a:clr)
|
||||
endif
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
endfunction
|
||||
|
||||
"" the 6 value iterations in the xterm color cube
|
||||
let s:valuerange = [ 0x00, 0x5F, 0x87, 0xAF, 0xD7, 0xFF ]
|
||||
"
|
||||
"" 16 basic colors
|
||||
let s:basic16 = [ [ 0x00, 0x00, 0x00 ], [ 0xCD, 0x00, 0x00 ], [ 0x00, 0xCD, 0x00 ], [ 0xCD, 0xCD, 0x00 ], [ 0x00, 0x00, 0xEE ], [ 0xCD, 0x00, 0xCD ], [ 0x00, 0xCD, 0xCD ], [ 0xE5, 0xE5, 0xE5 ], [ 0x7F, 0x7F, 0x7F ], [ 0xFF, 0x00, 0x00 ], [ 0x00, 0xFF, 0x00 ], [ 0xFF, 0xFF, 0x00 ], [ 0x5C, 0x5C, 0xFF ], [ 0xFF, 0x00, 0xFF ], [ 0x00, 0xFF, 0xFF ], [ 0xFF, 0xFF, 0xFF ] ]
|
||||
:
|
||||
function! s:Xterm2rgb(color)
|
||||
" 16 basic colors
|
||||
let r=0
|
||||
let g=0
|
||||
let b=0
|
||||
if a:color<16
|
||||
let r = s:basic16[a:color][0]
|
||||
let g = s:basic16[a:color][1]
|
||||
let b = s:basic16[a:color][2]
|
||||
endif
|
||||
|
||||
" color cube color
|
||||
if a:color>=16 && a:color<=232
|
||||
let color=a:color-16
|
||||
let r = s:valuerange[(color/36)%6]
|
||||
let g = s:valuerange[(color/6)%6]
|
||||
let b = s:valuerange[color%6]
|
||||
endif
|
||||
|
||||
" gray tone
|
||||
if a:color>=233 && a:color<=253
|
||||
let r=8+(a:color-232)*0x0a
|
||||
let g=r
|
||||
let b=r
|
||||
endif
|
||||
let rgb=[r,g,b]
|
||||
return rgb
|
||||
endfunction
|
||||
|
||||
function! s:pow(x, n)
|
||||
let x = a:x
|
||||
for i in range(a:n-1)
|
||||
let x = x*a:x
|
||||
return x
|
||||
endfunction
|
||||
|
||||
let s:colortable=[]
|
||||
for c in range(0, 254)
|
||||
let color = s:Xterm2rgb(c)
|
||||
call add(s:colortable, color)
|
||||
endfor
|
||||
|
||||
" selects the nearest xterm color for a rgb value like #FF0000
|
||||
function! s:Rgb2xterm(color)
|
||||
let best_match=0
|
||||
let smallest_distance = 10000000000
|
||||
let r = eval('0x'.a:color[1].a:color[2])
|
||||
let g = eval('0x'.a:color[3].a:color[4])
|
||||
let b = eval('0x'.a:color[5].a:color[6])
|
||||
for c in range(0,254)
|
||||
let d = s:pow(s:colortable[c][0]-r,2) + s:pow(s:colortable[c][1]-g,2) + s:pow(s:colortable[c][2]-b,2)
|
||||
if d<smallest_distance
|
||||
let smallest_distance = d
|
||||
let best_match = c
|
||||
endif
|
||||
endfor
|
||||
return best_match
|
||||
endfunction
|
||||
|
||||
function! s:SetNamedColor(clr,name)
|
||||
let group = 'cssColor'.substitute(a:clr,'^#','','')
|
||||
exe 'syn keyword '.group.' '.a:name.' contained'
|
||||
exe 'syn cluster cssColors add='.group
|
||||
if has('gui_running')
|
||||
exe 'hi '.group.' guifg='.s:FGforBG(a:clr)
|
||||
exe 'hi '.group.' guibg='.a:clr
|
||||
elseif &t_Co == 256
|
||||
exe 'hi '.group.' ctermfg='.s:Rgb2xterm(s:FGforBG(a:clr))
|
||||
exe 'hi '.group.' ctermbg='.s:Rgb2xterm(a:clr)
|
||||
endif
|
||||
return 23
|
||||
endfunction
|
||||
|
||||
function! s:PreviewCSSColorInLine(where)
|
||||
" TODO use cssColor matchdata
|
||||
let foundcolor = matchstr( getline(a:where), '#[0-9A-Fa-f]\{3,6\}\>' )
|
||||
let color = ''
|
||||
if foundcolor != ''
|
||||
if foundcolor =~ '#\x\{6}$'
|
||||
let color = foundcolor
|
||||
elseif foundcolor =~ '#\x\{3}$'
|
||||
let color = substitute(foundcolor, '\(\x\)\(\x\)\(\x\)', '\1\1\2\2\3\3', '')
|
||||
else
|
||||
let color = ''
|
||||
endif
|
||||
if color != ''
|
||||
return s:SetMatcher(color,foundcolor)
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" For version 5.x: Clear all syntax items
|
||||
" For version 6.x: Quit when a syntax file was already loaded
|
||||
if !exists("main_syntax")
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
let main_syntax = 'css'
|
||||
endif
|
||||
|
||||
syn case ignore
|
||||
|
||||
syn keyword cssTagName abbr acronym address applet area a b base
|
||||
syn keyword cssTagName basefont bdo big blockquote body br button
|
||||
syn keyword cssTagName caption center cite code col colgroup dd del
|
||||
syn keyword cssTagName dfn dir div dl dt em fieldset font form frame
|
||||
syn keyword cssTagName frameset h1 h2 h3 h4 h5 h6 head hr html img i
|
||||
syn keyword cssTagName iframe img input ins isindex kbd label legend li
|
||||
syn keyword cssTagName link map menu meta noframes noscript ol optgroup
|
||||
syn keyword cssTagName option p param pre q s samp script select small
|
||||
syn keyword cssTagName span strike strong style sub sup tbody td
|
||||
syn keyword cssTagName textarea tfoot th thead title tr tt ul u var
|
||||
syn match cssTagName "\<table\>"
|
||||
syn match cssTagName "\*"
|
||||
|
||||
syn match cssTagName "@page\>" nextgroup=cssDefinition
|
||||
|
||||
syn match cssSelectorOp "[+>.]"
|
||||
syn match cssSelectorOp2 "[~|]\?=" contained
|
||||
syn region cssAttributeSelector matchgroup=cssSelectorOp start="\[" end="]" transparent contains=cssUnicodeEscape,cssSelectorOp2,cssStringQ,cssStringQQ
|
||||
|
||||
try
|
||||
syn match cssIdentifier "#[A-Za-z<>-<2D>_@][A-Za-z<>-<2D>0-9_@-]*"
|
||||
catch /^.*/
|
||||
syn match cssIdentifier "#[A-Za-z_@][A-Za-z0-9_@-]*"
|
||||
endtry
|
||||
|
||||
|
||||
syn match cssMedia "@media\>" nextgroup=cssMediaType skipwhite skipnl
|
||||
syn keyword cssMediaType contained screen print aural braile embosed handheld projection ty tv all nextgroup=cssMediaComma,cssMediaBlock skipwhite skipnl
|
||||
syn match cssMediaComma "," nextgroup=cssMediaType skipwhite skipnl
|
||||
syn region cssMediaBlock transparent matchgroup=cssBraces start='{' end='}' contains=cssTagName,cssError,cssComment,cssDefinition,cssURL,cssUnicodeEscape,cssIdentifier
|
||||
|
||||
syn match cssValueInteger contained "[-+]\=\d\+"
|
||||
syn match cssValueNumber contained "[-+]\=\d\+\(\.\d*\)\="
|
||||
syn match cssValueLength contained "[-+]\=\d\+\(\.\d*\)\=\(%\|mm\|cm\|in\|pt\|pc\|em\|ex\|px\)"
|
||||
syn match cssValueAngle contained "[-+]\=\d\+\(\.\d*\)\=\(deg\|grad\|rad\)"
|
||||
syn match cssValueTime contained "+\=\d\+\(\.\d*\)\=\(ms\|s\)"
|
||||
syn match cssValueFrequency contained "+\=\d\+\(\.\d*\)\=\(Hz\|kHz\)"
|
||||
|
||||
syn match cssFontDescriptor "@font-face\>" nextgroup=cssFontDescriptorBlock skipwhite skipnl
|
||||
syn region cssFontDescriptorBlock contained transparent matchgroup=cssBraces start="{" end="}" contains=cssComment,cssError,cssUnicodeEscape,cssFontProp,cssFontAttr,cssCommonAttr,cssStringQ,cssStringQQ,cssFontDescriptorProp,cssValue.*,cssFontDescriptorFunction,cssUnicodeRange,cssFontDescriptorAttr
|
||||
syn match cssFontDescriptorProp contained "\<\(unicode-range\|unit-per-em\|panose-1\|cap-height\|x-height\|definition-src\)\>"
|
||||
syn keyword cssFontDescriptorProp contained src stemv stemh slope ascent descent widths bbox baseline centerline mathline topline
|
||||
syn keyword cssFontDescriptorAttr contained all
|
||||
syn region cssFontDescriptorFunction contained matchgroup=cssFunctionName start="\<\(uri\|url\|local\|format\)\s*(" end=")" contains=cssStringQ,cssStringQQ oneline keepend
|
||||
syn match cssUnicodeRange contained "U+[0-9A-Fa-f?]\+"
|
||||
syn match cssUnicodeRange contained "U+\x\+-\x\+"
|
||||
|
||||
syn keyword cssColor contained aqua black blue fuchsia gray green lime maroon navy olive purple red silver teal yellow
|
||||
" FIXME: These are actually case-insentivie too, but (a) specs recommend using
|
||||
" mixed-case (b) it's hard to highlight the word `Background' correctly in
|
||||
" all situations
|
||||
syn case match
|
||||
syn keyword cssColor contained ActiveBorder ActiveCaption AppWorkspace ButtonFace ButtonHighlight ButtonShadow ButtonText CaptionText GrayText Highlight HighlightText InactiveBorder InactiveCaption InactiveCaptionText InfoBackground InfoText Menu MenuText Scrollbar ThreeDDarkShadow ThreeDFace ThreeDHighlight ThreeDLightShadow ThreeDShadow Window WindowFrame WindowText Background
|
||||
syn case ignore
|
||||
syn match cssColor contained "\<transparent\>"
|
||||
syn match cssColor contained "\<white\>"
|
||||
syn match cssColor contained "#[0-9A-Fa-f]\{3\}\>"
|
||||
syn match cssColor contained "#[0-9A-Fa-f]\{6\}\>"
|
||||
"syn match cssColor contained "\<rgb\s*(\s*\d\+\(\.\d*\)\=%\=\s*,\s*\d\+\(\.\d*\)\=%\=\s*,\s*\d\+\(\.\d*\)\=%\=\s*)"
|
||||
syn region cssURL contained matchgroup=cssFunctionName start="\<url\s*(" end=")" oneline keepend
|
||||
syn region cssFunction contained matchgroup=cssFunctionName start="\<\(rgb\|clip\|attr\|counter\|rect\)\s*(" end=")" oneline keepend
|
||||
|
||||
syn match cssImportant contained "!\s*important\>"
|
||||
|
||||
syn keyword cssCommonAttr contained auto none inherit
|
||||
syn keyword cssCommonAttr contained top bottom
|
||||
syn keyword cssCommonAttr contained medium normal
|
||||
|
||||
syn match cssFontProp contained "\<font\>\(-\(family\|style\|variant\|weight\|size\(-adjust\)\=\|stretch\)\>\)\="
|
||||
syn match cssFontAttr contained "\<\(sans-\)\=\<serif\>"
|
||||
syn match cssFontAttr contained "\<small\>\(-\(caps\|caption\)\>\)\="
|
||||
syn match cssFontAttr contained "\<x\{1,2\}-\(large\|small\)\>"
|
||||
syn match cssFontAttr contained "\<message-box\>"
|
||||
syn match cssFontAttr contained "\<status-bar\>"
|
||||
syn match cssFontAttr contained "\<\(\(ultra\|extra\|semi\|status-bar\)-\)\=\(condensed\|expanded\)\>"
|
||||
syn keyword cssFontAttr contained cursive fantasy monospace italic oblique
|
||||
syn keyword cssFontAttr contained bold bolder lighter larger smaller
|
||||
syn keyword cssFontAttr contained icon menu
|
||||
syn match cssFontAttr contained "\<caption\>"
|
||||
syn keyword cssFontAttr contained large smaller larger
|
||||
syn keyword cssFontAttr contained narrower wider
|
||||
|
||||
syn keyword cssColorProp contained color
|
||||
syn match cssColorProp contained "\<background\(-\(color\|image\|attachment\|position\)\)\="
|
||||
syn keyword cssColorAttr contained center scroll fixed
|
||||
syn match cssColorAttr contained "\<repeat\(-[xy]\)\=\>"
|
||||
syn match cssColorAttr contained "\<no-repeat\>"
|
||||
|
||||
syn match cssTextProp "\<\(\(word\|letter\)-spacing\|text\(-\(decoration\|transform\|align\|index\|shadow\)\)\=\|vertical-align\|unicode-bidi\|line-height\)\>"
|
||||
syn match cssTextAttr contained "\<line-through\>"
|
||||
syn match cssTextAttr contained "\<text-indent\>"
|
||||
syn match cssTextAttr contained "\<\(text-\)\=\(top\|bottom\)\>"
|
||||
syn keyword cssTextAttr contained underline overline blink sub super middle
|
||||
syn keyword cssTextAttr contained capitalize uppercase lowercase center justify baseline sub super
|
||||
|
||||
syn match cssBoxProp contained "\<\(margin\|padding\|border\)\(-\(top\|right\|bottom\|left\)\)\=\>"
|
||||
syn match cssBoxProp contained "\<border-\(\(\(top\|right\|bottom\|left\)-\)\=\(width\|color\|style\)\)\=\>"
|
||||
syn match cssBoxProp contained "\<\(width\|z-index\)\>"
|
||||
syn match cssBoxProp contained "\<\(min\|max\)-\(width\|height\)\>"
|
||||
syn keyword cssBoxProp contained width height float clear overflow clip visibility
|
||||
syn keyword cssBoxAttr contained thin thick both
|
||||
syn keyword cssBoxAttr contained dotted dashed solid double groove ridge inset outset
|
||||
syn keyword cssBoxAttr contained hidden visible scroll collapse
|
||||
|
||||
syn keyword cssGeneratedContentProp contained content quotes
|
||||
syn match cssGeneratedContentProp contained "\<counter-\(reset\|increment\)\>"
|
||||
syn match cssGeneratedContentProp contained "\<list-style\(-\(type\|position\|image\)\)\=\>"
|
||||
syn match cssGeneratedContentAttr contained "\<\(no-\)\=\(open\|close\)-quote\>"
|
||||
syn match cssAuralAttr contained "\<lower\>"
|
||||
syn match cssGeneratedContentAttr contained "\<\(lower\|upper\)-\(roman\|alpha\|greek\|latin\)\>"
|
||||
syn match cssGeneratedContentAttr contained "\<\(hiragana\|katakana\)\(-iroha\)\=\>"
|
||||
syn match cssGeneratedContentAttr contained "\<\(decimal\(-leading-zero\)\=\|cjk-ideographic\)\>"
|
||||
syn keyword cssGeneratedContentAttr contained disc circle square hebrew armenian georgian
|
||||
syn keyword cssGeneratedContentAttr contained inside outside
|
||||
|
||||
syn match cssPagingProp contained "\<page\(-break-\(before\|after\|inside\)\)\=\>"
|
||||
syn keyword cssPagingProp contained size marks inside orphans widows
|
||||
syn keyword cssPagingAttr contained landscape portrait crop cross always avoid
|
||||
|
||||
syn keyword cssUIProp contained cursor
|
||||
syn match cssUIProp contained "\<outline\(-\(width\|style\|color\)\)\=\>"
|
||||
syn match cssUIAttr contained "\<[ns]\=[ew]\=-resize\>"
|
||||
syn keyword cssUIAttr contained default crosshair pointer move wait help
|
||||
syn keyword cssUIAttr contained thin thick
|
||||
syn keyword cssUIAttr contained dotted dashed solid double groove ridge inset outset
|
||||
syn keyword cssUIAttr contained invert
|
||||
|
||||
syn match cssRenderAttr contained "\<marker\>"
|
||||
syn match cssRenderProp contained "\<\(display\|marker-offset\|unicode-bidi\|white-space\|list-item\|run-in\|inline-table\)\>"
|
||||
syn keyword cssRenderProp contained position top bottom direction
|
||||
syn match cssRenderProp contained "\<\(left\|right\)\>"
|
||||
syn keyword cssRenderAttr contained block inline compact
|
||||
syn match cssRenderAttr contained "\<table\(-\(row-gorup\|\(header\|footer\)-group\|row\|column\(-group\)\=\|cell\|caption\)\)\=\>"
|
||||
syn keyword cssRenderAttr contained static relative absolute fixed
|
||||
syn keyword cssRenderAttr contained ltr rtl embed bidi-override pre nowrap
|
||||
syn match cssRenderAttr contained "\<bidi-override\>"
|
||||
|
||||
|
||||
syn match cssAuralProp contained "\<\(pause\|cue\)\(-\(before\|after\)\)\=\>"
|
||||
syn match cssAuralProp contained "\<\(play-during\|speech-rate\|voice-family\|pitch\(-range\)\=\|speak\(-\(punctuation\|numerals\)\)\=\)\>"
|
||||
syn keyword cssAuralProp contained volume during azimuth elevation stress richness
|
||||
syn match cssAuralAttr contained "\<\(x-\)\=\(soft\|loud\)\>"
|
||||
syn keyword cssAuralAttr contained silent
|
||||
syn match cssAuralAttr contained "\<spell-out\>"
|
||||
syn keyword cssAuralAttr contained non mix
|
||||
syn match cssAuralAttr contained "\<\(left\|right\)-side\>"
|
||||
syn match cssAuralAttr contained "\<\(far\|center\)-\(left\|center\|right\)\>"
|
||||
syn keyword cssAuralAttr contained leftwards rightwards behind
|
||||
syn keyword cssAuralAttr contained below level above higher
|
||||
syn match cssAuralAttr contained "\<\(x-\)\=\(slow\|fast\)\>"
|
||||
syn keyword cssAuralAttr contained faster slower
|
||||
syn keyword cssAuralAttr contained male female child code digits continuous
|
||||
|
||||
syn match cssTableProp contained "\<\(caption-side\|table-layout\|border-collapse\|border-spacing\|empty-cells\|speak-header\)\>"
|
||||
syn keyword cssTableAttr contained fixed collapse separate show hide once always
|
||||
|
||||
" FIXME: This allows cssMediaBlock before the semicolon, which is wrong.
|
||||
syn region cssInclude start="@import" end=";" contains=cssComment,cssURL,cssUnicodeEscape,cssMediaType
|
||||
syn match cssBraces contained "[{}]"
|
||||
syn match cssError contained "{@<>"
|
||||
syn region cssDefinition transparent matchgroup=cssBraces start='{' end='}' contains=css.*Attr,css.*Prop,cssComment,cssValue.*,cssColor,cssURL,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape
|
||||
syn match cssBraceError "}"
|
||||
|
||||
syn match cssPseudoClass ":\S*" contains=cssPseudoClassId,cssUnicodeEscape
|
||||
syn keyword cssPseudoClassId contained link visited active hover focus before after left right
|
||||
syn match cssPseudoClassId contained "\<first\(-\(line\|letter\|child\)\)\=\>"
|
||||
syn region cssPseudoClassLang matchgroup=cssPseudoClassId start=":lang(" end=")" oneline
|
||||
|
||||
syn region cssComment start="/\*" end="\*/" contains=@Spell
|
||||
|
||||
syn match cssUnicodeEscape "\\\x\{1,6}\s\?"
|
||||
syn match cssSpecialCharQQ +\\"+ contained
|
||||
syn match cssSpecialCharQ +\\'+ contained
|
||||
syn region cssStringQQ start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=cssUnicodeEscape,cssSpecialCharQQ
|
||||
syn region cssStringQ start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=cssUnicodeEscape,cssSpecialCharQ
|
||||
syn match cssClassName "\.[A-Za-z][A-Za-z0-9_-]\+"
|
||||
|
||||
if main_syntax == "css"
|
||||
syn sync minlines=10
|
||||
endif
|
||||
|
||||
" Define the default highlighting.
|
||||
" For version 5.7 and earlier: only when not done already
|
||||
" For version 5.8 and later: only when an item doesn't have highlighting yet
|
||||
if version >= 508 || !exists("did_css_syn_inits")
|
||||
if version < 508
|
||||
let did_css_syn_inits = 1
|
||||
command -nargs=+ HiLink hi link <args>
|
||||
else
|
||||
command -nargs=+ HiLink hi def link <args>
|
||||
endif
|
||||
|
||||
HiLink cssComment Comment
|
||||
HiLink cssTagName Statement
|
||||
HiLink cssSelectorOp Special
|
||||
HiLink cssSelectorOp2 Special
|
||||
HiLink cssFontProp StorageClass
|
||||
HiLink cssColorProp StorageClass
|
||||
HiLink cssTextProp StorageClass
|
||||
HiLink cssBoxProp StorageClass
|
||||
HiLink cssRenderProp StorageClass
|
||||
HiLink cssAuralProp StorageClass
|
||||
HiLink cssRenderProp StorageClass
|
||||
HiLink cssGeneratedContentProp StorageClass
|
||||
HiLink cssPagingProp StorageClass
|
||||
HiLink cssTableProp StorageClass
|
||||
HiLink cssUIProp StorageClass
|
||||
HiLink cssFontAttr Type
|
||||
HiLink cssColorAttr Type
|
||||
HiLink cssTextAttr Type
|
||||
HiLink cssBoxAttr Type
|
||||
HiLink cssRenderAttr Type
|
||||
HiLink cssAuralAttr Type
|
||||
HiLink cssGeneratedContentAttr Type
|
||||
HiLink cssPagingAttr Type
|
||||
HiLink cssTableAttr Type
|
||||
HiLink cssUIAttr Type
|
||||
HiLink cssCommonAttr Type
|
||||
HiLink cssPseudoClassId PreProc
|
||||
HiLink cssPseudoClassLang Constant
|
||||
HiLink cssValueLength Number
|
||||
HiLink cssValueInteger Number
|
||||
HiLink cssValueNumber Number
|
||||
HiLink cssValueAngle Number
|
||||
HiLink cssValueTime Number
|
||||
HiLink cssValueFrequency Number
|
||||
HiLink cssFunction Constant
|
||||
HiLink cssURL String
|
||||
HiLink cssFunctionName Function
|
||||
HiLink cssColor Constant
|
||||
HiLink cssIdentifier Function
|
||||
HiLink cssInclude Include
|
||||
HiLink cssImportant Special
|
||||
HiLink cssBraces Function
|
||||
HiLink cssBraceError Error
|
||||
HiLink cssError Error
|
||||
HiLink cssInclude Include
|
||||
HiLink cssUnicodeEscape Special
|
||||
HiLink cssStringQQ String
|
||||
HiLink cssStringQ String
|
||||
HiLink cssMedia Special
|
||||
HiLink cssMediaType Special
|
||||
HiLink cssMediaComma Normal
|
||||
HiLink cssFontDescriptor Special
|
||||
HiLink cssFontDescriptorFunction Constant
|
||||
HiLink cssFontDescriptorProp StorageClass
|
||||
HiLink cssFontDescriptorAttr Type
|
||||
HiLink cssUnicodeRange Constant
|
||||
HiLink cssClassName Function
|
||||
delcommand HiLink
|
||||
endif
|
||||
|
||||
" <20><><EFBFBD>ǵ<EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>DZ<EFBFBD><C7B1><EFBFBD><EFBFBD><EFBFBD>256ɫ<36>£<EFBFBD><C2A3><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>:set t_Co=256
|
||||
if has("gui_running") || &t_Co==256
|
||||
" HACK modify cssDefinition to add @cssColors to its contains
|
||||
redir => s:olddef
|
||||
silent! syn list cssDefinition
|
||||
redir END
|
||||
if s:olddef != ''
|
||||
let s:b = strridx(s:olddef,'matchgroup')
|
||||
if s:b != -1
|
||||
exe 'syn region cssDefinition '.strpart(s:olddef,s:b).',@cssColors'
|
||||
endif
|
||||
endif
|
||||
|
||||
" w3c Colors
|
||||
let i = s:SetNamedColor('#800000', 'maroon')
|
||||
let i = s:SetNamedColor('#ff0000', 'red')
|
||||
let i = s:SetNamedColor('#ffA500', 'orange')
|
||||
let i = s:SetNamedColor('#ffff00', 'yellow')
|
||||
let i = s:SetNamedColor('#808000', 'olive')
|
||||
let i = s:SetNamedColor('#800080', 'purple')
|
||||
let i = s:SetNamedColor('#ff00ff', 'fuchsia')
|
||||
let i = s:SetNamedColor('#ffffff', 'white')
|
||||
let i = s:SetNamedColor('#00ff00', 'lime')
|
||||
let i = s:SetNamedColor('#008000', 'green')
|
||||
let i = s:SetNamedColor('#000080', 'navy')
|
||||
let i = s:SetNamedColor('#0000ff', 'blue')
|
||||
let i = s:SetNamedColor('#00ffff', 'aqua')
|
||||
let i = s:SetNamedColor('#008080', 'teal')
|
||||
let i = s:SetNamedColor('#000000', 'black')
|
||||
let i = s:SetNamedColor('#c0c0c0', 'silver')
|
||||
let i = s:SetNamedColor('#808080', 'gray')
|
||||
|
||||
" extra colors
|
||||
let i = s:SetNamedColor('#F0F8FF','AliceBlue')
|
||||
let i = s:SetNamedColor('#FAEBD7','AntiqueWhite')
|
||||
let i = s:SetNamedColor('#7FFFD4','Aquamarine')
|
||||
let i = s:SetNamedColor('#F0FFFF','Azure')
|
||||
let i = s:SetNamedColor('#F5F5DC','Beige')
|
||||
let i = s:SetNamedColor('#FFE4C4','Bisque')
|
||||
let i = s:SetNamedColor('#FFEBCD','BlanchedAlmond')
|
||||
let i = s:SetNamedColor('#8A2BE2','BlueViolet')
|
||||
let i = s:SetNamedColor('#A52A2A','Brown')
|
||||
let i = s:SetNamedColor('#DEB887','BurlyWood')
|
||||
let i = s:SetNamedColor('#5F9EA0','CadetBlue')
|
||||
let i = s:SetNamedColor('#7FFF00','Chartreuse')
|
||||
let i = s:SetNamedColor('#D2691E','Chocolate')
|
||||
let i = s:SetNamedColor('#FF7F50','Coral')
|
||||
let i = s:SetNamedColor('#6495ED','CornflowerBlue')
|
||||
let i = s:SetNamedColor('#FFF8DC','Cornsilk')
|
||||
let i = s:SetNamedColor('#DC143C','Crimson')
|
||||
let i = s:SetNamedColor('#00FFFF','Cyan')
|
||||
let i = s:SetNamedColor('#00008B','DarkBlue')
|
||||
let i = s:SetNamedColor('#008B8B','DarkCyan')
|
||||
let i = s:SetNamedColor('#B8860B','DarkGoldenRod')
|
||||
let i = s:SetNamedColor('#A9A9A9','DarkGray')
|
||||
let i = s:SetNamedColor('#A9A9A9','DarkGrey')
|
||||
let i = s:SetNamedColor('#006400','DarkGreen')
|
||||
let i = s:SetNamedColor('#BDB76B','DarkKhaki')
|
||||
let i = s:SetNamedColor('#8B008B','DarkMagenta')
|
||||
let i = s:SetNamedColor('#556B2F','DarkOliveGreen')
|
||||
let i = s:SetNamedColor('#FF8C00','Darkorange')
|
||||
let i = s:SetNamedColor('#9932CC','DarkOrchid')
|
||||
let i = s:SetNamedColor('#8B0000','DarkRed')
|
||||
let i = s:SetNamedColor('#E9967A','DarkSalmon')
|
||||
let i = s:SetNamedColor('#8FBC8F','DarkSeaGreen')
|
||||
let i = s:SetNamedColor('#483D8B','DarkSlateBlue')
|
||||
let i = s:SetNamedColor('#2F4F4F','DarkSlateGray')
|
||||
let i = s:SetNamedColor('#2F4F4F','DarkSlateGrey')
|
||||
let i = s:SetNamedColor('#00CED1','DarkTurquoise')
|
||||
let i = s:SetNamedColor('#9400D3','DarkViolet')
|
||||
let i = s:SetNamedColor('#FF1493','DeepPink')
|
||||
let i = s:SetNamedColor('#00BFFF','DeepSkyBlue')
|
||||
let i = s:SetNamedColor('#696969','DimGray')
|
||||
let i = s:SetNamedColor('#696969','DimGrey')
|
||||
let i = s:SetNamedColor('#1E90FF','DodgerBlue')
|
||||
let i = s:SetNamedColor('#B22222','FireBrick')
|
||||
let i = s:SetNamedColor('#FFFAF0','FloralWhite')
|
||||
let i = s:SetNamedColor('#228B22','ForestGreen')
|
||||
let i = s:SetNamedColor('#DCDCDC','Gainsboro')
|
||||
let i = s:SetNamedColor('#F8F8FF','GhostWhite')
|
||||
let i = s:SetNamedColor('#FFD700','Gold')
|
||||
let i = s:SetNamedColor('#DAA520','GoldenRod')
|
||||
let i = s:SetNamedColor('#808080','Grey')
|
||||
let i = s:SetNamedColor('#ADFF2F','GreenYellow')
|
||||
let i = s:SetNamedColor('#F0FFF0','HoneyDew')
|
||||
let i = s:SetNamedColor('#FF69B4','HotPink')
|
||||
let i = s:SetNamedColor('#CD5C5C','IndianRed')
|
||||
let i = s:SetNamedColor('#4B0082','Indigo')
|
||||
let i = s:SetNamedColor('#FFFFF0','Ivory')
|
||||
let i = s:SetNamedColor('#F0E68C','Khaki')
|
||||
let i = s:SetNamedColor('#E6E6FA','Lavender')
|
||||
let i = s:SetNamedColor('#FFF0F5','LavenderBlush')
|
||||
let i = s:SetNamedColor('#7CFC00','LawnGreen')
|
||||
let i = s:SetNamedColor('#FFFACD','LemonChiffon')
|
||||
let i = s:SetNamedColor('#ADD8E6','LightBlue')
|
||||
let i = s:SetNamedColor('#F08080','LightCoral')
|
||||
let i = s:SetNamedColor('#E0FFFF','LightCyan')
|
||||
let i = s:SetNamedColor('#FAFAD2','LightGoldenRodYellow')
|
||||
let i = s:SetNamedColor('#D3D3D3','LightGray')
|
||||
let i = s:SetNamedColor('#D3D3D3','LightGrey')
|
||||
let i = s:SetNamedColor('#90EE90','LightGreen')
|
||||
let i = s:SetNamedColor('#FFB6C1','LightPink')
|
||||
let i = s:SetNamedColor('#FFA07A','LightSalmon')
|
||||
let i = s:SetNamedColor('#20B2AA','LightSeaGreen')
|
||||
let i = s:SetNamedColor('#87CEFA','LightSkyBlue')
|
||||
let i = s:SetNamedColor('#778899','LightSlateGray')
|
||||
let i = s:SetNamedColor('#778899','LightSlateGrey')
|
||||
let i = s:SetNamedColor('#B0C4DE','LightSteelBlue')
|
||||
let i = s:SetNamedColor('#FFFFE0','LightYellow')
|
||||
let i = s:SetNamedColor('#32CD32','LimeGreen')
|
||||
let i = s:SetNamedColor('#FAF0E6','Linen')
|
||||
let i = s:SetNamedColor('#FF00FF','Magenta')
|
||||
let i = s:SetNamedColor('#66CDAA','MediumAquaMarine')
|
||||
let i = s:SetNamedColor('#0000CD','MediumBlue')
|
||||
let i = s:SetNamedColor('#BA55D3','MediumOrchid')
|
||||
let i = s:SetNamedColor('#9370D8','MediumPurple')
|
||||
let i = s:SetNamedColor('#3CB371','MediumSeaGreen')
|
||||
let i = s:SetNamedColor('#7B68EE','MediumSlateBlue')
|
||||
let i = s:SetNamedColor('#00FA9A','MediumSpringGreen')
|
||||
let i = s:SetNamedColor('#48D1CC','MediumTurquoise')
|
||||
let i = s:SetNamedColor('#C71585','MediumVioletRed')
|
||||
let i = s:SetNamedColor('#191970','MidnightBlue')
|
||||
let i = s:SetNamedColor('#F5FFFA','MintCream')
|
||||
let i = s:SetNamedColor('#FFE4E1','MistyRose')
|
||||
let i = s:SetNamedColor('#FFE4B5','Moccasin')
|
||||
let i = s:SetNamedColor('#FFDEAD','NavajoWhite')
|
||||
let i = s:SetNamedColor('#FDF5E6','OldLace')
|
||||
let i = s:SetNamedColor('#6B8E23','OliveDrab')
|
||||
let i = s:SetNamedColor('#FF4500','OrangeRed')
|
||||
let i = s:SetNamedColor('#DA70D6','Orchid')
|
||||
let i = s:SetNamedColor('#EEE8AA','PaleGoldenRod')
|
||||
let i = s:SetNamedColor('#98FB98','PaleGreen')
|
||||
let i = s:SetNamedColor('#AFEEEE','PaleTurquoise')
|
||||
let i = s:SetNamedColor('#D87093','PaleVioletRed')
|
||||
let i = s:SetNamedColor('#FFEFD5','PapayaWhip')
|
||||
let i = s:SetNamedColor('#FFDAB9','PeachPuff')
|
||||
let i = s:SetNamedColor('#CD853F','Peru')
|
||||
let i = s:SetNamedColor('#FFC0CB','Pink')
|
||||
let i = s:SetNamedColor('#DDA0DD','Plum')
|
||||
let i = s:SetNamedColor('#B0E0E6','PowderBlue')
|
||||
let i = s:SetNamedColor('#BC8F8F','RosyBrown')
|
||||
let i = s:SetNamedColor('#4169E1','RoyalBlue')
|
||||
let i = s:SetNamedColor('#8B4513','SaddleBrown')
|
||||
let i = s:SetNamedColor('#FA8072','Salmon')
|
||||
let i = s:SetNamedColor('#F4A460','SandyBrown')
|
||||
let i = s:SetNamedColor('#2E8B57','SeaGreen')
|
||||
let i = s:SetNamedColor('#FFF5EE','SeaShell')
|
||||
let i = s:SetNamedColor('#A0522D','Sienna')
|
||||
let i = s:SetNamedColor('#87CEEB','SkyBlue')
|
||||
let i = s:SetNamedColor('#6A5ACD','SlateBlue')
|
||||
let i = s:SetNamedColor('#708090','SlateGray')
|
||||
let i = s:SetNamedColor('#708090','SlateGrey')
|
||||
let i = s:SetNamedColor('#FFFAFA','Snow')
|
||||
let i = s:SetNamedColor('#00FF7F','SpringGreen')
|
||||
let i = s:SetNamedColor('#4682B4','SteelBlue')
|
||||
let i = s:SetNamedColor('#D2B48C','Tan')
|
||||
let i = s:SetNamedColor('#D8BFD8','Thistle')
|
||||
let i = s:SetNamedColor('#FF6347','Tomato')
|
||||
let i = s:SetNamedColor('#40E0D0','Turquoise')
|
||||
let i = s:SetNamedColor('#EE82EE','Violet')
|
||||
let i = s:SetNamedColor('#F5DEB3','Wheat')
|
||||
let i = s:SetNamedColor('#F5F5F5','WhiteSmoke')
|
||||
let i = s:SetNamedColor('#9ACD32','YellowGreen')
|
||||
|
||||
|
||||
|
||||
let i = 1
|
||||
while i <= line("$")
|
||||
call s:PreviewCSSColorInLine(i)
|
||||
let i = i+1
|
||||
endwhile
|
||||
unlet i
|
||||
|
||||
autocmd CursorHold * silent call s:PreviewCSSColorInLine('.')
|
||||
autocmd CursorHoldI * silent call s:PreviewCSSColorInLine('.')
|
||||
set ut=100
|
||||
endif " has("gui_running")
|
||||
|
||||
let b:current_syntax = "css"
|
||||
|
||||
if main_syntax == 'css'
|
||||
unlet main_syntax
|
||||
endif
|
||||
|
||||
" vim: ts=8
|
||||
|
||||
86
syntax/mako.vim
Normal file
86
syntax/mako.vim
Normal file
@@ -0,0 +1,86 @@
|
||||
" Vim syntax file
|
||||
" Language: Mako
|
||||
" Maintainer: Armin Ronacher <armin.ronacher@active-4.com>
|
||||
" URL: http://lucumr.pocoo.org/
|
||||
" Last Change: 2008 September 12
|
||||
" Version: 0.6.1
|
||||
"
|
||||
" Thanks to Brine Rue <brian@lolapps.com> who noticed a bug in the
|
||||
" delimiter handling.
|
||||
"
|
||||
" Known Limitations
|
||||
" the <%text> block does not have correct attributes
|
||||
|
||||
" For version 5.x: Clear all syntax items
|
||||
" For version 6.x: Quit when a syntax file was already loaded
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists("main_syntax")
|
||||
let main_syntax = "html"
|
||||
endif
|
||||
|
||||
"Source the html syntax file
|
||||
ru! syntax/html.vim
|
||||
unlet b:current_syntax
|
||||
|
||||
"Put the python syntax file in @pythonTop
|
||||
syn include @pythonTop syntax/python.vim
|
||||
|
||||
" End keywords
|
||||
syn keyword makoEnd contained endfor endwhile endif endtry enddef
|
||||
|
||||
" Block rules
|
||||
syn region makoLine matchgroup=makoDelim start=#^\s*%# end=#$# keepend contains=@pythonTop,makoEnd
|
||||
syn region makoBlock matchgroup=makoDelim start=#<%!\?# end=#%># keepend contains=@pythonTop,makoEnd
|
||||
|
||||
" Variables
|
||||
syn region makoNested start="{" end="}" transparent display contained contains=makoNested,@pythonTop
|
||||
syn region makoVariable matchgroup=makoDelim start=#\${# end=#}# contains=makoNested,@pythonTop
|
||||
|
||||
" Comments
|
||||
syn region makoComment start="^\s*##" end="$"
|
||||
syn region makoDocComment matchgroup=makoDelim start="<%doc>" end="</%doc>" keepend
|
||||
|
||||
" Literal Blocks
|
||||
syn region makoText matchgroup=makoDelim start="<%text[^>]*>" end="</%text>"
|
||||
|
||||
" Attribute Sublexing
|
||||
syn match makoAttributeKey containedin=makoTag contained "[a-zA-Z_][a-zA-Z0-9_]*="
|
||||
syn region makoAttributeValue containedin=makoTag contained start=/"/ skip=/\\"/ end=/"/
|
||||
syn region makoAttributeValue containedin=MakoTag contained start=/'/ skip=/\\'/ end=/'/
|
||||
|
||||
" Tags
|
||||
syn region makoTag matchgroup=makoDelim start="<%\(def\|call\|page\|include\|namespace\|inherit\)\>" end="/\?>"
|
||||
syn match makoDelim "</%\(def\|call\|namespace\)>"
|
||||
|
||||
" Newline Escapes
|
||||
syn match makoEscape /\\$/
|
||||
|
||||
" Default highlighting links
|
||||
if version >= 508 || !exists("did_mako_syn_inits")
|
||||
if version < 508
|
||||
let did_mako_syn_inits = 1
|
||||
com -nargs=+ HiLink hi link <args>
|
||||
else
|
||||
com -nargs=+ HiLink hi def link <args>
|
||||
endif
|
||||
|
||||
HiLink makoDocComment makoComment
|
||||
HiLink makoDefEnd makoDelim
|
||||
|
||||
HiLink makoAttributeKey Type
|
||||
HiLink makoAttributeValue String
|
||||
HiLink makoText Normal
|
||||
HiLink makoDelim Preproc
|
||||
HiLink makoEnd Keyword
|
||||
HiLink makoComment Comment
|
||||
HiLink makoEscape Special
|
||||
|
||||
delc HiLink
|
||||
endif
|
||||
|
||||
let b:current_syntax = "eruby"
|
||||
Reference in New Issue
Block a user