diff --git a/vim/bundle/stylus/changelog.md b/vim/bundle/stylus/changelog.md new file mode 100644 index 0000000..7ce3824 --- /dev/null +++ b/vim/bundle/stylus/changelog.md @@ -0,0 +1,11 @@ + +0.8.3 / 2011-09-26 +================== + + * Added missing background properties Fixes #5 + +0.8.2 / 2011-09-01 +================== + + * updated function list + * removed extra stylus from properties cluster diff --git a/vim/bundle/stylus/ftdetect/stylus.vim b/vim/bundle/stylus/ftdetect/stylus.vim new file mode 100644 index 0000000..49e04ec --- /dev/null +++ b/vim/bundle/stylus/ftdetect/stylus.vim @@ -0,0 +1,3 @@ +" Stylus +autocmd BufNewFile,BufReadPost *.styl set filetype=stylus +autocmd BufNewFile,BufReadPost *.stylus set filetype=stylus diff --git a/vim/bundle/stylus/ftplugin/stylus.vim b/vim/bundle/stylus/ftplugin/stylus.vim new file mode 100644 index 0000000..419f471 --- /dev/null +++ b/vim/bundle/stylus/ftplugin/stylus.vim @@ -0,0 +1,63 @@ +" Vim filetype plugin +" Language: Stylus +" Maintainer: Marc Harter +" Credits: Tim Pope + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +let s:save_cpo = &cpo +set cpo-=C + +" Define some defaults in case the included ftplugins don't set them. +let s:undo_ftplugin = "" +let s:browsefilter = "All Files (*.*)\t*.*\n" +let s:match_words = "" + +runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim +unlet! b:did_ftplugin + +" Override our defaults if these were set by an included ftplugin. +if exists("b:undo_ftplugin") + let s:undo_ftplugin = b:undo_ftplugin + unlet b:undo_ftplugin +endif +if exists("b:browsefilter") + let s:browsefilter = b:browsefilter + unlet b:browsefilter +endif +if exists("b:match_words") + let s:match_words = b:match_words + unlet b:match_words +endif + +" Change the browse dialog on Win32 to show mainly Styl-related files +if has("gui_win32") + let b:browsefilter="Stylus Files (*.styl)\t*.styl\n" . s:browsefilter +endif + +" Load the combined list of match_words for matchit.vim +if exists("loaded_matchit") + let b:match_words = s:match_words +endif + +setlocal comments= commentstring=//\ %s + +setlocal suffixesadd=.styl + +" Add '-' and '#' to the what makes up a keyword. +" This means that 'e' and 'w' work properly now, for properties +" and valid variable names. +setl iskeyword+=#,- + +let b:undo_ftplugin = "setl cms< com< " + \ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin + +let &cpo = s:save_cpo + +" Add a Stylus command (to see if it's valid) +command! Stylus !clear; cat % | stylus + +" vim:set sw=2: diff --git a/vim/bundle/stylus/indent/stylus.vim b/vim/bundle/stylus/indent/stylus.vim new file mode 100644 index 0000000..8707e61 --- /dev/null +++ b/vim/bundle/stylus/indent/stylus.vim @@ -0,0 +1,129 @@ +" Vim indent file +" Language: Stylus +" Maintainer: Marc Harter +" Last Change: 2010 May 21 +" Based On: sass.vim from Tim Pope +" +if exists("b:did_indent") + finish +endif +unlet! b:did_indent +let b:did_indent = 1 + +setlocal indentexpr=GetStylusIndent() +setlocal indentkeys=o,O,*,},],0),!^F +setlocal formatoptions+=r + +if exists("*GetStylusIndent") " only define once + finish +endif + +function s:prevnonblanknoncomment(lnum) + let lnum = a:lnum + while lnum > 1 + let lnum = prevnonblank(lnum) + let line = getline(lnum) + if line =~ '\*/' + while lnum > 1 && line !~ '/\*' + let lnum -= 1 + endwhile + if line =~ '^\s*/\*' + let lnum -= 1 + else + break + endif + else + break + endif + endwhile + return lnum +endfunction + +function s:count_braces(lnum, count_open) + let n_open = 0 + let n_close = 0 + let line = getline(a:lnum) + let pattern = '[{}]' + let i = match(line, pattern) + while i != -1 + if synIDattr(synID(a:lnum, i + 1, 0), 'name') !~ 'css\%(Comment\|StringQ\{1,2}\)' + if line[i] == '{' + let n_open += 1 + elseif line[i] == '}' + if n_open > 0 + let n_open -= 1 + else + let n_close += 1 + endif + endif + endif + let i = match(line, pattern, i + 1) + endwhile + return a:count_open ? n_open : n_close +endfunction + +" function CheckCSSIndent() +" let line = getline(v:lnum) +" if line =~ '^\s*\*' +" return cindent(v:lnum) +" endif +" +" let pnum = s:prevnonblanknoncomment(v:lnum - 1) +" if pnum == 0 +" return 0 +" endif +" +" return indent(pnum) + s:count_braces(pnum, 1) * &sw +" \ - s:count_braces(v:lnum, 0) * &sw +" endfunction + +function! GetStylusIndent() + let line = getline(v:lnum) + if line =~ '^\s*\*' + return cindent(v:lnum) + endif + + let pnum = s:prevnonblanknoncomment(v:lnum - 1) + if pnum == 0 + return 0 + endif + + let lnum = prevnonblank(v:lnum-1) + if lnum == 0 + return 0 + endif + + let pline = getline(pnum) + + if pline =~ '[}{]' + return indent(pnum) + s:count_braces(pnum, 1) * &sw - s:count_braces(v:lnum, 0) * &sw + endif + + let line = substitute(getline(lnum),'[\s()]\+$','','') " get last line strip ending whitespace + let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','') " get current line, trimmed + let lastcol = strlen(line) " get last col in prev line + let line = substitute(line,'^\s\+','','') " then remove preceeding whitespace + let indent = indent(lnum) " get indent on prev line + let cindent = indent(v:lnum) " get indent on current line + let increase = indent + &sw " increase indent by the shift width + if indent == indent(lnum) + let indent = cindent <= indent ? indent : increase + endif + + let group = synIDattr(synID(lnum,lastcol,1),'name') + + " for debugging only + echo group + + " if group !~? 'css.*' && line =~? ')\s*$' " match user functions + " return increase + if group =~? '\v^%(cssTagName|cssClassName|cssIdentifier|cssSelectorOp|cssSelectorOp2|cssBraces|cssAttributeSelector|cssPseudoClass|cssPseudoClassId|stylusId|stylusClass)$' + return increase + elseif (group == 'stylusUserFunction') && (indent(lnum) == '0') " mixin definition + return increase + else + return indent + endif +endfunction + +" vim:set sw=2; diff --git a/vim/bundle/stylus/readme.md b/vim/bundle/stylus/readme.md new file mode 100644 index 0000000..7a4a26b --- /dev/null +++ b/vim/bundle/stylus/readme.md @@ -0,0 +1,15 @@ +# stylus.vim +Syntax highlighting for [Stylus](http://learnboost.github.com/stylus/). + +CSS3/HTML5 bundled in and adapted from [css3.vim](http://www.vim.org/scripts/script.php?script_id=3042) by Hsiaoming Young + +## Installation + +### Manual install +Unzip into your `.vim` directory + +### Pathogen install +Clone this repo into your `.vim/bundle` directory + +## Creds +This is based on the excellent work from Tim Pope on sass.vim. diff --git a/vim/bundle/stylus/syntax/stylus.vim b/vim/bundle/stylus/syntax/stylus.vim new file mode 100644 index 0000000..930e0b9 --- /dev/null +++ b/vim/bundle/stylus/syntax/stylus.vim @@ -0,0 +1,372 @@ +" Vim syntax file +" Language: CSS3 +" Maintainer: Hsiaoming Yang +" URL: http://lepture.me/work/css3/ +" Created: Dec 14, 2011 +" Modified: Sep 4, 2012 + +" 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 region cssString start='"' end='"' contained +syn region cssString start="'" end="'" contained + +" HTML4 tags +syn keyword cssTagName abbr acronym address applet area base a b +syn keyword cssTagName basefont bdo big blockquote body button br +syn keyword cssTagName caption cite code col colgroup dd del +syn keyword cssTagName dfn dir div dl dt em fieldset 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 +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 "\*" +syn match cssTagName /\/ +syn match cssTagName /\/ +syn match cssTagName /\/ +" HTML5 tags +syn keyword cssTagName article aside audio bb canvas command datagrid +syn keyword cssTagName datalist details dialog embed figure footer figcaption +syn keyword cssTagName header hgroup keygen mark meter nav output +syn keyword cssTagName progress time rt rp section time video +syn match cssTagName /\/ +" class select +syn match cssSelector /\.[A-Za-z][A-Za-z0-9_-]\+/ +" id select +syn match cssSelector /#[A-Za-z][A-Za-z0-9_-]\+/ +syn region cssSelector start='\[' end='\]' contains=cssString + +syn region cssDefineBlock start="{" end="}" transparent contains=ALL + +syn keyword cssCommonVal inherit initial auto both normal hidden none medium contained + + +" Comment +syn keyword cssTodo FIXME TODO contained +syn region cssComment start="/\*" end="\*/" contains=cssTodo +syn match cssImportant "!\s*important\>" contained + +syn match cssValueInteger "[-+]\=\d\+" contained +syn match cssValueNumber "[-+]\=\d\+\(\.\d*\)\=" +syn match cssValueLength "[-+]\=\d\+\(\.\d*\)\=\(%\|mm\|cm\|in\|pt\|pc\|em\|ex\|px\|rem\|vh\|vw\|vm\|fr\|gr\)" contained +syn match cssValueAngle "[-+]\=\d\+\(\.\d*\)\=\(deg\|grad\|rad\|turn\)" contained +syn match cssValueTime "+\=\d\+\(\.\d*\)\=\(ms\|s\)" contained +syn match cssValueFrequency "+\=\d\+\(\.\d*\)\=\(Hz\|kHz\)" contained + + +" Properties http://www.w3.org/community/webed/wiki/CSS/Properties +" background http://www.w3.org/TR/css3-background/ +syn match cssBackgroundProp /\(background-\(color\|image\|repeat\|attachment\|position\)\|background\)/ contained +syn match cssBackgroundProp /background-\(origin\|\(repeat\|position\)-[xy]\|clip\|size\)/ contained +syn match cssBackgroundProp /object-\(fit\|position\)/ contained +" http://www.evotech.net/blog/2010/02/css3-properties-values-browser-support/ +syn keyword cssBackgroundVal tb lr rl snap cover contain widthLength heightLength contained +syn match cssBackgroundVal /\(scale-down\|from-image\)/ contained +syn match cssBackgroundVal /repeat-[xy]/ contained +syn match cssBackgroundVal /no-repeat/ contained +syn keyword cssBackgroundVal circle ellipse to at contained +syn match cssBackgroundVal /\(closest\|farthest\)-\(side\|corner\)/ contained + +syn region cssFuncVal start="\(url\|calc\|min\|max\|counter\|cycle(\)" end=")" oneline contained contains=cssString,cssValueLength,cssValueInteger,cssValueNumber,cssValueAngle,cssValueTime,cssValueFrequency +syn region cssFuncVal start="\(linear\|radial\|repeating-linear\|repeating-radial\)-gradient(" end=")" oneline contained contains=cssString,cssValueLength,cssValueInteger,cssValueNumber,cssValueAngle,cssValueTime,cssValueFrequency,cssVisualProp,cssColorVal + +syn match cssBorderProp /\(border-\(color\|style\|width\|radius\)\|border\)/ contained +syn match cssBorderProp /border-\(image-\(source\|slice\|width\|outset\|repeat\)\|image\)/ contained +syn match cssBorderProp /border-\(\(top\|right\|bottom\|left\)-\(color\|style\|width\)\|\(top\|right\|bottom\|left\)\)/ contained +syn match cssBorderProp /border-\(top\|bottom\)-\(left\|right\)-radius/ contained +syn keyword cssBorderVal dotted dashed solid double groove ridge inset outset contained +syn match cssBorderVal /\/ contained +syn match cssBorderVal /\/ contained +syn match cssBorderVal /\/ contained + +" Font +syn match cssFontProp /\(font-\(family\|style\|variant\|weight\|size-adjust\|size\|stretch\)\|font\)/ contained +syn match cssFontVal /\(sans-serif\|small-caps\)/ contained +syn match cssFontVal /\/ contained +syn keyword cssFontVal cursive fantasy monospace italic oblique serif contained +syn keyword cssFontVal bold bolder lighter larger smaller contained +syn keyword cssFontVal icon narrower wider contained + +" Color +syn match cssColorVal /transparent/ contained +syn match cssColorVal "#[0-9A-Fa-f]\{3\}\>" contained +syn match cssColorVal "#[0-9A-Fa-f]\{6\}\>" contained +syn match cssFuncVal /rgb(\(\d\{1,3\}\s*,\s*\)\{2\}\d\{1,3\})/ contained contains=cssString,cssValueLength,cssValueInteger,cssValueNumber,cssValueAngle,cssValueTime,cssValueFrequency +syn match cssFuncVal /rgba(\(\d\{1,3\}\s*,\s*\)\{3\}\(1\|0\(\.\d\+\)\?\))/ contained contains=cssString,cssValueLength,cssValueInteger,cssValueNumber,cssValueAngle,cssValueTime,cssValueFrequency +syn match cssFuncVal /hsl(\d\{1,3\}\s*,\s*\(100\|\d\{1,2\}\(\.\d\+\)\?\)%\s*,\s*\(100\|\d\{1,2\}\(\.\d\+\)\?\)%)/ contained contains=cssString,cssValueLength,cssValueInteger,cssValueNumber,cssValueAngle,cssValueTime,cssValueFrequency +syn match cssFuncVal /hsla(\d\{1,3\}\s*,\s*\(\(100\|\d\{1,2\}\(\.\d\+\)\?\)%\s*,\s*\)\{2\}\(1\|0\(\.\d\+\)\?\))/ contained contains=cssString,cssValueLength,cssValueInteger,cssValueNumber,cssValueAngle,cssValueTime,cssValueFrequency +syn keyword cssColorVal aliceblue antiquewhite aqua aquamarine azure contained +syn keyword cssColorVal beige bisque black blanchedalmond blue blueviolet brown burlywood contained +syn keyword cssColorVal cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan contained +syn match cssColorVal /dark\(blue\|cyan\|goldenrod\|gray\|green\|grey\|khaki\)/ contained +syn match cssColorVal /dark\(magenta\|olivegreen\|orange\|orchid\|red\|salmon\|seagreen\)/ contained +syn match cssColorVal /darkslate\(blue\|gray\|grey\)/ contained +syn match cssColorVal /dark\(turquoise\|violet\)/ contained +syn keyword cssColorVal deeppink deepskyblue dimgray dimgrey dodgerblue firebrick contained +syn keyword cssColorVal floralwhite forestgreen fuchsia gainsboro ghostwhite gold contained +syn keyword cssColorVal goldenrod gray green greenyellow grey honeydew hotpink contained +syn keyword cssColorVal indianred indigo ivory khaki lavender lavenderblush lawngreen contained +syn keyword cssColorVal lemonchiffon lime limegreen linen magenta maroon contained +syn match cssColorVal /light\(blue\|coral\|cyan\|goldenrodyellow\|gray\|green\)/ contained +syn match cssColorVal /light\(grey\|pink\|salmon\|seagreen\|skyblue\|yellow\)/ contained +syn match cssColorVal /light\(slategray\|slategrey\|steelblue\)/ contained +syn match cssColorVal /medium\(aquamarine\|blue\|orchid\|purple\|seagreen\)/ contained +syn match cssColorVal /medium\(slateblue\|springgreen\|turquoise\|violetred\)/ contained +syn keyword cssColorVal midnightblue mintcream mistyrose moccasin navajowhite contained +syn keyword cssColorVal navy oldlace olive olivedrab orange orangered orchid contained +syn match cssColorVal /pale\(goldenrod\|green\|turquoise\|violetred\)/ contained +syn keyword cssColorVal papayawhip peachpuff peru pink plum powderblue purple contained +syn keyword cssColorVal red rosybrown royalblue saddlebrown salmon sandybrown contained +syn keyword cssColorVal seagreen seashell sienna silver skyblue slateblue contained +syn keyword cssColorVal slategray slategrey snow springgreen steelblue tan contained +syn keyword cssColorVal teal thistle tomato turquoise violet wheat contained +syn keyword cssColorVal whitesmoke yellow yellowgreen contained +syn match cssColorVal "\" contained +syn keyword cssColorProp color opaticy contained +syn match cssColorProp /color-profile/ contained + +" Box +syn match cssBoxProp /\(\(margin\|padding\)-\(top\|right\|bottom\|left\)\|\(margin\|padding\)\)/ contained +syn match cssBoxProp /\(min\|max\)-\(width\|height\)/ contained +syn match cssBoxProp /box-\(align\|decoration-break\|direction\|flex-group\|flex\|lines\)/ contained +syn match cssBoxProp /box-\(ordinal-group\|orient\|pack\|shadow\|sizing\)/ contained +syn match cssBoxProp /\(outline-\(color\|offset\|style\|width\)\|outline\)/ contained +syn keyword cssBoxProp width height contained + +" Text +syn match cssTextProp /text-\(align-last\|align\|decoration\|emphasis\|height\|indent\|justify\|outline\|shadow\|transform\|wrap\|overflow\)\|text/ contained +syn match cssTextProp /\(line-stacking-\(ruby\|shift\|strategy\)\|line-stacking\|line-height\)/ contained +syn match cssTextProp /vertical-align/ contained +syn match cssTextProp /letter-spacing/ contained +syn match cssTextProp /white-\(space-collapse\|space\)/ contained +syn match cssTextProp /word-\(break\|spacing\|wrap\)/ contained +syn match cssTextProp "\" contained +syn match cssTextVal "\" contained +syn match cssTextVal "\" contained +syn match cssTextVal "\" contained +syn match cssTextVal /text-\(top\|bottom\)/ contained +syn keyword cssTextVal uppercase lowercase ellipsis middle contained + +" List +syn match cssListProp /\(list-style-\(type\|image\|position\)\|list-style\)/ contained +syn keyword cssListVal armenian circle disc georgian hebrew square contained +syn match cssListVal /cjk-ideographic/ contained +syn match cssListVal /\(decimal-leading-zero\|decimal\)/ contained +syn match cssListVal /\(\(hiragana\|katakana\)-iroha\|\(hiragana\|katakana\)\)/ contained +syn match cssListVal /\(lower\|upper\)-\(alpha\|latin\|roman\)/ contained +syn match cssListVal /lower-greek/ contained + +" Visual formatting +syn keyword cssVisualProp display position top right bottom left float clear clip contained +syn keyword cssVisualProp zoom visibility cursor direction outline resize contained +syn keyword cssVisualProp opacity contained +syn match cssVisualProp /z-index/ contained +syn match cssVisualProp /\(overflow-\(style\|[xy]\)\|overflow\)/ contained +syn keyword cssVisualVal inline block compact contained +syn match cssVisualVal '\' contained +syn match cssVisualVal /\(inline-\(block\|table\)\|list-item\|run-in\)/ contained +syn match cssVisualVal /table-\(row-group\|header-group\|footer-group\|row\|column-group\|column\|cell\|caption\)/ contained +syn match cssVisualVal /\-\(base-group\|text-group\|base\|text\)/ contained +syn keyword cssVisualVal static relative absolute fixed contained +syn keyword cssVisualVal ltr rtl embed bidi-override pre nowrap contained +syn keyword cssVisualVal crosshair help move pointer progress wait contained +syn keyword cssVisualVal e-resize n-resize ne-resize nw-resize s-resize se-resize sw-resize w-resize contained + +" Table +syn match cssTableProp /border-\(collapse\|spacing\)/ contained +syn match cssTableProp /\(table-layout\|caption-side\|empty-cells\)/ contained + +" Generated content +syn match cssCommonProp /counter-\(reset\|increment\)/ contained +syn keyword cssCommonProp content quotes contained + +" Print +syn match cssPrintProp /break-\(before\|after\|inside\)/ +syn match cssPrintProp /\(page-break-\(before\|after\|inside\)\|page-policy\)/ +syn keyword cssPrintProp orphans windows + +" special keywords +syn match cssSpecialProp /-\(webkit\|moz\|ms\|o\)-/ +syn match cssRuleProp /@\(media\|font-face\|charset\|import\|page\|namespace\)/ +" http://www.w3.org/TR/selectors/ +syn match cssPseudo /:\(link\|visited\|active\|hover\|focus\|before\|after\)/ +syn match cssPseudo /:\(target\|lang\|enabled\|disabled\|checked\|indeterminate\)/ +syn match cssPseudo /:\(root\|\(first\|last\|only\)-\(child\|of-type\)\|empty\)/ +syn match cssPseudo /:\(nth-last-\|nth-\)\(child\|of-type\)(\<\S\+\>)/ +syn match cssPseudo /:not(\<\S*\>)/ +syn match cssPseudo /:first-\(line\|letter\)/ +syn match cssPseudo /::\(first-\(line\|letter\)\|before\|after\|selection\)/ + +" CSS3 Advanced http://meiert.com/en/indices/css-properties/ +syn keyword cssAdvancedProp appearance azimuth binding bleed columns crop hyphens icon +syn keyword cssAdvancedProp phonemes resize richness size volumne +syn match cssAdvancedProp /\(animation-\(delay\|direction\|duration\|name\|iteration-count\|play-state\|timing-function\)\|animation\)/ +syn match cssAdvancedProp /alignment-\(adjust\|baseline\)/ +syn match cssAdvancedProp /\(backface-visibility\baseline-shift\)/ +syn match cssAdvancedProp /bookmark-\(label\|level\|state\|target\)/ +syn match cssAdvancedProp /column-\(count\|fill\|gap\|rule-\(color\|style\|width\)\|rule\|span\|width\)/ +syn match cssAdvancedProp /\(cue-\(after\|before\)\|cue\)/ +syn match cssAdvancedProp /dominant-baseline/ +syn match cssAdvancedProp /drop-initial-\(size\|value\|\(after\|before\)-\(adjust\|align\)\)/ +syn match cssAdvancedProp /\(fit-position\|fit\)/ +syn match cssAdvancedProp /\(float-offset\|hanging-punctuation\)/ +syn match cssAdvancedProp /grid-\(columns\|rows\)/ +syn match cssAdvancedProp /hyphenate-\(after\|before\|character\|lines\|resource\)/ +syn match cssAdvancedProp /image-\(orientation\|rendering\|resolution\)/ +syn match cssAdvancedProp /inline-box-align/ +syn match cssAdvancedProp /\(mark-\(after\|before\)\|mark\|marks\)/ +syn match cssAdvancedProp /marquee-\(direction\|loop\|play-count\|speed\|style\)/ +syn match cssAdvancedProp /move-to/ +syn match cssAdvancedProp /nav-\(down\|index\|left\|right\|up\)/ +syn match cssAdvancedProp /\(pause-\(after\|before\)\|pause\)/ +syn match cssAdvancedProp /\(perspective-origin\|perspective\)/ +syn match cssAdvancedProp /\(pitch-range\|pitch\)/ +syn match cssAdvancedProp /presentation-level/ +syn match cssAdvancedProp /punctuation-trim/ +syn match cssAdvancedProp /rendering-intent/ +syn match cssAdvancedProp /\(rest-\(after\|before\)\|rest\)/ +syn match cssAdvancedProp /\(rotation-point\|rotation\)/ +syn match cssAdvancedProp /ruby-\(align\|overhang\|position\|span\)/ +syn match cssAdvancedProp /\(target-\(name\|new\|position\)\|target\)/ +syn match cssAdvancedProp /\(transform-\(origin\|style\)\|transform\)/ +syn match cssAdvancedProp /\(transition-\(delay\|duration\|property\|timing-function\)\|transition\)/ +syn match cssAdvancedProp /voice-\(balance\|duration\|family\|pitch-range\|pitch\|rate\|stress\|volume\)/ + +syn match cssAdvancedVal /\(ease-\(in\|out\|in-out\)\|ease\)/ contained + +" CSS3 Advanced value +"syn match cssAdvancedVal + + +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 + else + command -nargs=+ HiLink hi def link + endif + + HiLink cssString String + HiLink cssComment Comment + HiLink cssTagName Statement + HiLink cssSelector Function + HiLink cssBackgroundProp StorageClass + HiLink cssTableProp StorageClass + HiLink cssBorderProp StorageClass + HiLink cssFontProp StorageClass + HiLink cssColorProp StorageClass + HiLink cssBoxProp StorageClass + HiLink cssTextProp StorageClass + HiLink cssListProp StorageClass + HiLink cssVisualProp StorageClass + HiLink cssAdvancedProp StorageClass + HiLink cssCommonProp StorageClass + HiLink cssSpecialProp Special + HiLink cssImportant Special + HiLink cssRuleProp PreProc + HiLink cssPseudo PreProc + + HiLink cssColorVal Constant + HiLink cssCommonVal Type + HiLink cssFontVal Type + HiLink cssListVal Type + HiLink cssTextVal Type + HiLink cssVisualVal Type + HiLink cssBorderVal Type + HiLink cssBackgroundVal Type + HiLink cssFuncVal Function + HiLink cssAdvancedVal Function + + HiLink cssValueLength Number + HiLink cssValueInteger Number + HiLink cssValueNumber Number + HiLink cssValueAngle Number + HiLink cssValueTime Number + HiLink cssValueFrequency Number + delcommand HiLink +endif + +" let b:current_syntax = "css" +" +if main_syntax == 'css' + unlet main_syntax +endif + +" Vim syntax file +" Language: Stylus +" Maintainer: Marc Harter +" Filenames: *.styl, *.stylus +" Based On: Tim Pope (sass.vim) + +syn case ignore +syn region cssInclude start="@import" end="\n" contains=cssComment,cssFuncVal,cssRuleProp + +syn cluster stylusCssSelectors contains=cssTagName,cssSelector,cssPseudo +syn cluster stylusCssValues contains=cssValueLength,cssValueInteger,cssValueNumber,cssValueAngle,cssValueTime,cssValueFrequency,cssColorVal,cssCommonVal,cssFontVal,cssListVal,cssTextVal,cssVisualVal,cssBorderVal,cssBackgroundVal,cssFuncVal,cssAdvancedVal +syn cluster stylusCssProperties contains=cssBackgroundProp,cssTableProp,cssBorderProp,cssFontProp,cssColorProp,cssBoxProp,cssTextProp,cssListProp,cssVisualProp,cssAdvancedProp,cssCommonProp,cssSpecialProp + +syn match stylusVariable "$\?[[:alnum:]_-]\+" +syn match stylusVariableAssignment "\%([[:alnum:]_-]\+\s*\)\@<==" nextgroup=stylusCssAttribute,stylusVariable skipwhite + +syn match stylusProperty "\%([{};]\s*\|^\)\@<=\%([[:alnum:]-]\|#{[^{}]*}\)\+:" contains=@stylusCssProperties,@stylusCssSelectors skipwhite nextgroup=stylusCssAttribute contained containedin=cssDefineBlock +syn match stylusProperty "^\s*\zs\s\%(\%([[:alnum:]-]\|#{[^{}]*}\)\+[ :]\|:[[:alnum:]-]\+\)"hs=s+1 contains=@stylusCssProperties,@stylusCssSelectors skipwhite nextgroup=stylusCssAttribute +syn match stylusProperty "^\s*\zs\s\%(:\=[[:alnum:]-]\+\s*=\)"hs=s+1 contains=@stylusCssProperties,@stylusCssSelectors skipwhite nextgroup=stylusCssAttribute + +syn match stylusCssAttribute +\%("\%([^"]\|\\"\)*"\|'\%([^']\|\\'\)*'\|#{[^{}]*}\|[^{};]\)*+ contained contains=@stylusCssValues,cssImportant,stylusFunction,stylusVariable,stylusControl,stylusUserFunction,stylusInterpolation,cssString,stylusComment,cssComment + +syn match stylusInterpolation %{[[:alnum:]_-]\+}% + +syn match stylusFunction "\<\%(red\|green\|blue\|alpha\|dark\|light\)\>(\@=" contained +syn match stylusFunction "\<\%(hue\|saturation\|lightness\|push\|unshift\|typeof\|unit\|match\)\>(\@=" contained +syn match stylusFunction "\<\%(hsla\|hsl\|rgba\|rgb\|lighten\|darken\)\>(\@=" contained +syn match stylusFunction "\<\%(abs\|ceil\|floor\|round\|min\|max\|even\|odd\|sum\|avg\|sin\|cos\|join\)\>(\@=" contained +syn match stylusFunction "\<\%(desaturate\|saturate\|invert\|unquote\|quote\|s\)\>(\@=" contained +syn match stylusFunction "\<\%(operate\|length\|warn\|error\|last\|p\|\)\>(\@=" contained +syn match stylusFunction "\<\%(opposite-position\|image-size\|add-property\)\>(\@=" contained + +syn keyword stylusVariable null true false arguments +syn keyword stylusControl if else unless for in return + +syn match stylusAmpersand "&" +syn match stylusClass "[[:alnum:]_-]\+" contained +syn match stylusClassChar "\.[[:alnum:]_-]\@=" nextgroup=stylusClass +syn match stylusEscape "^\s*\zs\\" +syn match stylusId "[[:alnum:]_-]\+" contained +syn match stylusIdChar "#[[:alnum:]_-]\@=" nextgroup=stylusId + +syn region stylusComment start="//" end="$" contains=cssTodo,@Spell fold + +hi def link stylusComment Comment +hi def link stylusVariable Identifier +hi def link stylusControl PreProc +hi def link stylusFunction Function +hi def link stylusInterpolation Delimiter + +hi def link stylusAmpersand Character +hi def link stylusClass Type +hi def link stylusClassChar Special +hi def link stylusEscape Special +hi def link stylusId Identifier +hi def link stylusIdChar Special + +let b:current_syntax = "stylus" + +" vim:set sw=2: diff --git a/vim/bundle/stylus/test.styl b/vim/bundle/stylus/test.styl new file mode 100644 index 0000000..8aef60b --- /dev/null +++ b/vim/bundle/stylus/test.styl @@ -0,0 +1,77 @@ +@import "nib" + +// comment test + +padding-overloaded = true; +padding = 2px; +primary-color = red; +$hello = world; + +if padding-overloaded + padding(x,y) + margin 15px + +border-radius() + -webkit-border-radius arguments // comment test + -moz-border-radius arguments //comment test + border-radius arguments + +#myid { + -moz-transform: scale(1.2); + font-family: arial; +} + +.a-class + border-radius border-radius() + -moz-transform scale(1.2) + +body a:hover + font 12px/1.4 "Lucida Grande", Arial, sans-serif + background black !important + text-shadow 2px 2px 2px #fff + td a:hover + font 12px + td + font 12px + +[name="myprop"] + background rgba(255,255,255,0.5) + +#container + border-radius 5px + color #000 + float left + display: block + background url('http://i.imgur.com/Q4RObrY.jpg') + +#myid + font 12px/1.4 "Lucida Grande", Arial, sans-serif + +h1 { + color: red; +} + +body a:hover + font 12px/1.4 "Lucida Grande", Arial, sans-serif + background black !important + background rgb(255,255,0) + border-top 1px solid rgb(255,255,0) + text-shadow 2px 2px #000 + color #ccc + +#butter.gump tr + border min(2px) + min-width min(2px) + color red(10) lighten(he) border-radius() image-size() + border-radius border-radius() + +form input { + padding: 5px; + border: 1px solid; + border-radius: 5px; +} + +vendor(prop, args) + {prop} args + -moz-{prop} args + -webkit-{prop} args