Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: BrunoGrasselli/vim_files
base: 4e28ac0c0b
...
head fork: BrunoGrasselli/vim_files
compare: 4c222310b6
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
View
1  README.md
@@ -10,3 +10,4 @@ Plugins:
* snipmate
* surround
* syntastic
+* web-indent
View
254 bundle/web-indent/indent/html.vim
@@ -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 --]
View
407 bundle/web-indent/indent/javascript.vim
@@ -0,0 +1,407 @@
+" 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
+
+" Set the global log variable 1 = logging enabled, 0 = logging disabled
+if !exists("g:js_indent_log")
+ let g:js_indent_log = 0
+endif
+
+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
+ 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
+
+ " 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)
+
+
+ " 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 s:IsObjectBeg(pline)
+ call s:Log("Pline matched object beg")
+ return ind + &sw
+ endif
+
+
+ " 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 s:IsArrayBeg(pline)
+ call s:Log("Pline matched array beg")
+ return ind + &sw
+ endif
+
+ " 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 s:IsParenBeg(pline)
+ call s:Log("Pline matched paren beg")
+ return ind + &sw
+ endif
+
+
+ " 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 s:IsContinuationLine(ppline)
+ call s:Log('PPline was a continuation line but pline wasnt.')
+ return ind - &sw
+ endif
+
+ " 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 s:IsSwitchMid(line)
+ call s:Log("Line matched switch cntrl mid")
+ return ind - &sw
+ endif
+
+
+ " 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
+
+ endif
+
+ 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
View
399 bundle/web-indent/test.html
@@ -0,0 +1,399 @@
+<!-- SAMPLE HTML WITH EMBEDDED JS -->
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
+
+ <title>Test</title>
+ </head>
+ <body>
+ <script type="text/javascript" charset="utf-8">
+ var x = 1 + 1; // 0
+
+ // = Case: Arithmetic (2)
+ var x = 1 + // 0
+ 1; // 1
+
+ // = Case: Arithmetic (3)
+ var x = 1 + // 0
+ 1 + // 1
+ 1; // 1
+
+ // = Case: Object (1)
+ var x = { // 0
+ // comment // 1
+ y : y, // 1
+ z : z // 1
+ } // 0
+
+ // = Case: Object (2)
+ var x = { // 0
+ // comment // 1
+ y : { // 1
+ z: z, // 2
+ w: w // 2
+ }, // 1
+ t: t // 1
+ } // 0
+
+
+ // Case: Function (1)
+ function $blah() { // 0
+ x; // 1
+ y; // 1
+ } // 0
+
+ // Case: Function (2)
+ var $blah = function() { // 0
+ x; // 1
+ y; // 1
+ } // 0
+
+ // Case: Function(3)
+ var x = { // 0
+ $blah: function() { // 1
+ y; // 2
+ } // 1
+ } // 0
+
+ // Case: Function(4)
+ function $blah( // 0
+ x, // 1
+ y, // 1
+ z ) { // 1
+ } // 0
+
+ // Case: Function (5)
+ function $blah( // 0
+ x, // 1
+ y, // 1
+ z ) { // 1
+ x; // 1
+ } // 0
+
+
+
+ // = Case: if (1)
+ if ( x ) { // 0
+ x; // 1
+ } // 0
+
+ // = Case: if (2)
+ if(x) // 0
+ x; // 1
+ y; // 0
+
+ // = Case: if (3)
+ if(x) // 0
+ { // 0
+ x; // 1
+ } // 0
+
+ // = Case: if (4)
+ if( x == y && // 0
+ y == z || // 1
+ z == w) { // 1
+ x; // 1
+ } // 0
+
+ // = Case: if (4a)
+ if( x == y && // 0
+ y == z || // 1
+ z == w) // 1
+ { // 0
+ x; // 1
+ } // 0
+
+
+ // = Case: if (5)
+ if(x) // 0
+ // comment // 1
+ y; // 1
+ x; // 0
+
+
+
+ // = Case: if else (1)
+ if ( x ) { // 0
+ x; // 1
+ } else { // 0
+ y; // 1
+ } // 0
+
+ // = Case: if else (2)
+ if ( x ) // 0
+ x; // 1
+ else // 0
+ y; // 1
+
+ // = Case: if else(3)
+ if(x) // 0
+ { // 0
+ x; // 1
+ } // 0
+ else // 0
+ { // 0
+ y; // 1
+ } // 0
+
+ // = Case: if elseif else (1)
+ if ( x ) { // 0
+ x; // 1
+ } else if ( y ) { // 0
+ y; // 1
+ } else { // 0
+ z; // 1
+ } // 0
+
+ // = Case: if elseif else (2)
+ if ( x ) // 0
+ x; // 1
+ else if ( y ) // 0
+ y; // 1
+ else // 0
+ z; // 1
+
+ // = Case: if elseif else (3)
+ if(x) // 0
+ { // 0
+ x; // 1
+ } // 0
+ else if(y) // 0
+ { // 0
+ y; // 1
+ } // 0
+ else // 0
+ { // 0
+ z; // 1
+ } // 0
+
+ // = Case: for (1)
+ for (var i = 0; i < blah.length; i++) { // 0
+ blah[i]; // 1
+ }; // 0
+
+ // = Case: for (2)
+ for (var i = 0; i < blah.length; i++) // 0
+ blah[i]; // 1
+ x; // 0
+
+ // = Case: switch
+ switch(x) { // 0
+ case "y": // 0
+ y; // 1
+ break; // 1
+
+ case "z": // 0
+ z; // 1
+ break; // 1
+
+ default: // 0
+ w; // 1
+ break; // 1
+ }
+
+ // = Case: try (1)
+ try { // 0
+ x; // 1
+ } // 0
+
+ // = Case: try (2)
+ try // 0
+ x; // 1
+ y; // 0
+
+ // = Case: try (3)
+ try // 0
+ { // 0
+ x; // 1
+ } // 0
+
+ // = Case: try catch (1)
+ try { // 0
+ x; // 1
+ } catch(e) { // 0
+ y; // 1
+ } // 0
+
+ // Case: try catch (2)
+ try // 0
+ { // 0
+ x; // 1
+ } // 0
+ catch(e) // 0
+ { // 0
+ y; // 1
+ } // 0
+
+ // Case: try catch (3)
+ try // 0
+ x; // 1
+ catch(e) // 0
+ y; // 1
+
+
+ // Case: try catch finally (1)
+ try { // 0
+ x; // 1
+ y; // 1
+ } catch(e) { // 0
+ x; // 1
+ y; // 1
+ } finally { // 0
+ x; // 1
+ y; // 1
+ }
+
+ // = Case: try catch finally (2)
+ try // 0
+ x; // 1
+ catch(e) // 0
+ y; // 1
+ finally // 0
+ z; // 1
+
+ // = Case: try catch finally (3)
+ try // 0
+ // comment // 1
+ x; // 1
+ catch(e) // 0
+ // comment // 1
+ y; // 1
+ finally // 1
+ // comment // 1
+ z; // 1
+
+ // = Case: Anonymous Function (1)
+ (function(x) { // 0
+ x; // 1
+ y; // 1
+ })(x); // 0
+
+ // = Case: Anonymous Function (2)
+ (function(x) // 0
+ { // 0
+ x; // 1
+ y; // 1
+ })(x); // 0
+
+ // = Case: Anonymous Function (2)
+ (function(x) // 0
+ { // 1
+ x; // 1
+ y; // 1
+ } // 0
+ )(x); // 0
+
+ // = Case: Anonymous Function (1)
+ (function(x) { // 0
+ x; // 1
+ y; // 1
+ } // 0
+ )(x); // 0
+
+
+ // = Case: COMPLEX
+ (function(window, undefined) { // 0
+ // = Class: Test // 1
+ // // 1
+ // = Description: This is a // 1
+ // test class. // 1
+ // // 1
+ var Test = new Class({ // 1
+ initialize: function() { // 2
+ this.test = test; // 3
+ }, // 2
+
+ // = Method: test // 2
+ // // 2
+ // = Description: // 2
+ // // 2
+ test: function(blah) { // 2
+ if(blah) { // 3
+ return "blah"; // 4
+ } else if(blah === undefined) // 3
+ return "blahblah"; // 4
+ else { // 3
+ // another comment. // 4
+ return "blahblahblah"; // 4
+ } // 3
+
+ var x = { // 3
+ y: function() { // 4
+ for (var i = 0; i < blah.length; i++) { // 5
+ blah[i]; // 6
+ }; // 5
+ } // 4
+ }; // 3
+
+ return new function() { // 3
+ }; // 3
+ }, // 2
+
+ // = Method: blah // 2
+ // // 2
+ // = Description: description // 2
+ // // 2
+ blah: function(haha) { // 2
+ return this.test; // 3
+ } // 2
+ }); // 1
+ })(this); // 0
+
+
+ // Case: SKELETON CODE
+ (function(window, undefined) {
+ // = Class: Test
+ //
+ // = Description:
+ //
+ var Test = new Class({
+
+ });
+
+ // = Class: Test2
+ // = Extends: Test
+ //
+ // = Description:
+ //
+ var Test2 = new Class({
+ initialize: function() {
+ },
+
+ // = Method: blah
+ //
+ // = Description: description
+ //
+ contrls: function() {
+ while(true) {
+ }
+
+ do {
+ } while(true);
+
+ with(x) {
+ }
+
+ if (true) {
+ } else if(true) {
+ } else {
+ }
+
+ for (var i = 0; i < blah.length; i++) {
+ }
+
+ switch(true) {
+ case 'case1': break;
+ case 'case2': break;
+ default:
+ }
+
+ try {
+ } catch (e) {
+ } finally {
+ }
+ }
+ });
+ })(this);
+ </script>
+ </body>
+</html>
View
211 colors/molokai.vim
@@ -0,0 +1,211 @@
+" Vim color file
+"
+" Author: Tomas Restrepo <tomas@winterdom.com>
+"
+" Note: Based on the monokai theme for textmate
+" by Wimer Hazenberg and its darker variant
+" by Hamish Stuart Macpherson
+"
+
+hi clear
+
+set background=dark
+if version > 580
+ " no guarantees for version 5.8 and below, but this makes it stop
+ " complaining
+ hi clear
+ if exists("syntax_on")
+ syntax reset
+ endif
+endif
+let g:colors_name="molokai"
+
+if exists("g:molokai_original")
+ let s:molokai_original = g:molokai_original
+else
+ let s:molokai_original = 0
+endif
+
+
+hi Boolean guifg=#AE81FF
+hi Character guifg=#E6DB74
+hi Number guifg=#AE81FF
+hi String guifg=#E6DB74
+hi Conditional guifg=#F92672 gui=bold
+hi Constant guifg=#AE81FF gui=bold
+hi Cursor guifg=#000000 guibg=#F8F8F0
+hi Debug guifg=#BCA3A3 gui=bold
+hi Define guifg=#66D9EF
+hi Delimiter guifg=#8F8F8F
+hi DiffAdd guibg=#13354A
+hi DiffChange guifg=#89807D guibg=#4C4745
+hi DiffDelete guifg=#960050 guibg=#1E0010
+hi DiffText guibg=#4C4745 gui=italic,bold
+
+hi Directory guifg=#A6E22E gui=bold
+hi Error guifg=#960050 guibg=#1E0010
+hi ErrorMsg guifg=#F92672 guibg=#232526 gui=bold
+hi Exception guifg=#A6E22E gui=bold
+hi Float guifg=#AE81FF
+hi FoldColumn guifg=#465457 guibg=#000000
+hi Folded guifg=#465457 guibg=#000000
+hi Function guifg=#A6E22E
+hi Identifier guifg=#FD971F
+hi Ignore guifg=#808080 guibg=bg
+hi IncSearch guifg=#C4BE89 guibg=#000000
+
+hi Keyword guifg=#F92672 gui=bold
+hi Label guifg=#E6DB74 gui=none
+hi Macro guifg=#C4BE89 gui=italic
+hi SpecialKey guifg=#66D9EF gui=italic
+
+hi MatchParen guifg=#000000 guibg=#FD971F gui=bold
+hi ModeMsg guifg=#E6DB74
+hi MoreMsg guifg=#E6DB74
+hi Operator guifg=#F92672
+
+" complete menu
+hi Pmenu guifg=#66D9EF guibg=#000000
+hi PmenuSel guibg=#808080
+hi PmenuSbar guibg=#080808
+hi PmenuThumb guifg=#66D9EF
+
+hi PreCondit guifg=#A6E22E gui=bold
+hi PreProc guifg=#A6E22E
+hi Question guifg=#66D9EF
+hi Repeat guifg=#F92672 gui=bold
+hi Search guifg=#FFFFFF guibg=#455354
+" marks column
+hi SignColumn guifg=#A6E22E guibg=#232526
+hi SpecialChar guifg=#F92672 gui=bold
+hi SpecialComment guifg=#465457 gui=bold
+hi Special guifg=#66D9EF guibg=bg gui=italic
+hi SpecialKey guifg=#888A85 gui=italic
+if has("spell")
+ hi SpellBad guisp=#FF0000 gui=undercurl
+ hi SpellCap guisp=#7070F0 gui=undercurl
+ hi SpellLocal guisp=#70F0F0 gui=undercurl
+ hi SpellRare guisp=#FFFFFF gui=undercurl
+endif
+hi Statement guifg=#F92672 gui=bold
+hi StatusLine guifg=#455354 guibg=fg
+hi StatusLineNC guifg=#808080 guibg=#080808
+hi StorageClass guifg=#FD971F gui=italic
+hi Structure guifg=#66D9EF
+hi Tag guifg=#F92672 gui=italic
+hi Title guifg=#ef5939
+hi Todo guifg=#FFFFFF guibg=bg gui=bold
+
+hi Typedef guifg=#66D9EF
+hi Type guifg=#66D9EF gui=none
+hi Underlined guifg=#808080 gui=underline
+
+hi VertSplit guifg=#808080 guibg=#080808 gui=bold
+hi VisualNOS guibg=#403D3D
+hi Visual guibg=#403D3D
+hi WarningMsg guifg=#FFFFFF guibg=#333333 gui=bold
+hi WildMenu guifg=#66D9EF guibg=#000000
+
+if s:molokai_original == 1
+ hi Normal guifg=#F8F8F2 guibg=#272822
+ hi Comment guifg=#75715E
+ hi CursorLine guibg=#3E3D32
+ hi CursorColumn guibg=#3E3D32
+ hi LineNr guifg=#BCBCBC guibg=#3B3A32
+ hi NonText guifg=#BCBCBC guibg=#3B3A32
+else
+ hi Normal guifg=#F8F8F2 guibg=#1B1D1E
+ hi Comment guifg=#465457
+ hi CursorLine guibg=#293739
+ hi CursorColumn guibg=#293739
+ hi LineNr guifg=#BCBCBC guibg=#232526
+ hi NonText guifg=#BCBCBC guibg=#232526
+end
+
+"
+" Support for 256-color terminal
+"
+if &t_Co > 255
+ hi Boolean ctermfg=135
+ hi Character ctermfg=144
+ hi Number ctermfg=135
+ hi String ctermfg=144
+ hi Conditional ctermfg=161 cterm=bold
+ hi Constant ctermfg=135 cterm=bold
+ hi Cursor ctermfg=16 ctermbg=253
+ hi Debug ctermfg=225 cterm=bold
+ hi Define ctermfg=81
+ hi Delimiter ctermfg=241
+
+ hi DiffAdd ctermbg=24
+ hi DiffChange ctermfg=181 ctermbg=239
+ hi DiffDelete ctermfg=162 ctermbg=53
+ hi DiffText ctermbg=102 cterm=bold
+
+ hi Directory ctermfg=118 cterm=bold
+ hi Error ctermfg=219 ctermbg=89
+ hi ErrorMsg ctermfg=199 ctermbg=16 cterm=bold
+ hi Exception ctermfg=118 cterm=bold
+ hi Float ctermfg=135
+ hi FoldColumn ctermfg=67 ctermbg=16
+ hi Folded ctermfg=67 ctermbg=16
+ hi Function ctermfg=118
+ hi Identifier ctermfg=208
+ hi Ignore ctermfg=244 ctermbg=232
+ hi IncSearch ctermfg=193 ctermbg=16
+
+ hi Keyword ctermfg=161 cterm=bold
+ hi Label ctermfg=229 cterm=none
+ hi Macro ctermfg=193
+ hi SpecialKey ctermfg=81
+
+ hi MatchParen ctermfg=16 ctermbg=208 cterm=bold
+ hi ModeMsg ctermfg=229
+ hi MoreMsg ctermfg=229
+ hi Operator ctermfg=161
+
+ " complete menu
+ hi Pmenu ctermfg=81 ctermbg=16
+ hi PmenuSel ctermbg=244
+ hi PmenuSbar ctermbg=232
+ hi PmenuThumb ctermfg=81
+
+ hi PreCondit ctermfg=118 cterm=bold
+ hi PreProc ctermfg=118
+ hi Question ctermfg=81
+ hi Repeat ctermfg=161 cterm=bold
+ hi Search ctermfg=253 ctermbg=66
+
+ " marks column
+ hi SignColumn ctermfg=118 ctermbg=235
+ hi SpecialChar ctermfg=161 cterm=bold
+ hi SpecialComment ctermfg=245 cterm=bold
+ hi Special ctermfg=81 ctermbg=232
+ hi SpecialKey ctermfg=245
+
+ hi Statement ctermfg=161 cterm=bold
+ hi StatusLine ctermfg=238 ctermbg=253
+ hi StatusLineNC ctermfg=244 ctermbg=232
+ hi StorageClass ctermfg=208
+ hi Structure ctermfg=81
+ hi Tag ctermfg=161
+ hi Title ctermfg=166
+ hi Todo ctermfg=231 ctermbg=232 cterm=bold
+
+ hi Typedef ctermfg=81
+ hi Type ctermfg=81 cterm=none
+ hi Underlined ctermfg=244 cterm=underline
+
+ hi VertSplit ctermfg=244 ctermbg=232 cterm=bold
+ hi VisualNOS ctermbg=238
+ hi Visual ctermbg=235
+ hi WarningMsg ctermfg=231 ctermbg=238 cterm=bold
+ hi WildMenu ctermfg=81 ctermbg=16
+
+ hi Normal ctermfg=252 ctermbg=233
+ hi Comment ctermfg=59
+ hi CursorLine ctermbg=234 cterm=none
+ hi CursorColumn ctermbg=234
+ hi LineNr ctermfg=250 ctermbg=234
+ hi NonText ctermfg=250 ctermbg=234
+end

No commit comments for this range

Something went wrong with that request. Please try again.