Update ALL the plugins!
git-svn-id: http://photonzero.com/dotfiles/trunk@80 23f722f6-122a-0410-8cef-c75bd312dd78
This commit is contained in:
parent
0a85941bf4
commit
0ad6077023
42 changed files with 9620 additions and 1644 deletions
1
.vim/bundle/vim-coffee-script/ftdetect/eco.vim
Normal file
1
.vim/bundle/vim-coffee-script/ftdetect/eco.vim
Normal file
|
|
@ -0,0 +1 @@
|
|||
autocmd BufNewFile,BufRead *.eco set filetype=eco
|
||||
|
|
@ -12,3 +12,8 @@ let b:did_ftplugin = 1
|
|||
setlocal formatoptions-=t formatoptions+=croql
|
||||
setlocal comments=s:###,m:\ ,e:###,:#
|
||||
setlocal commentstring=#\ %s
|
||||
|
||||
" Compile the current file on write.
|
||||
if exists("coffee_compile_on_save")
|
||||
autocmd BufWritePost,FileWritePost *.coffee silent !coffee -c <afile> &
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -11,30 +11,30 @@ let b:did_indent = 1
|
|||
|
||||
setlocal autoindent
|
||||
setlocal indentexpr=GetCoffeeIndent(v:lnum)
|
||||
" Make sure GetCoffeeIndent is run when these are typed so they can be outdented
|
||||
setlocal indentkeys+=0],0),=else,=when,=catch,=finally
|
||||
" Make sure GetCoffeeIndent is run when these are typed so they can be
|
||||
" indented or outdented.
|
||||
setlocal indentkeys+=0],0),0.,=else,=when,=catch,=finally
|
||||
|
||||
" Only define the function once
|
||||
" Only define the function once.
|
||||
if exists("*GetCoffeeIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Join a list of regexps as branches
|
||||
" Join a list of regexps as branches.
|
||||
function! s:RegexpJoin(regexps)
|
||||
return join(a:regexps, '\|')
|
||||
endfunction
|
||||
|
||||
" Create a regexp group from a list of regexps
|
||||
" Create a regexp group from a list of regexps.
|
||||
function! s:RegexpGroup(...)
|
||||
return '\%(' . s:RegexpJoin(a:000) . '\)'
|
||||
endfunction
|
||||
|
||||
" Outdent certain keywords and brackets
|
||||
" Outdent certain keywords and brackets.
|
||||
let s:outdent = '^'
|
||||
\ . s:RegexpGroup('else', 'when', 'catch', 'finally',
|
||||
\ ']', '}', ')')
|
||||
\ . s:RegexpGroup('else', 'when', 'catch', 'finally', ']', '}', ')')
|
||||
|
||||
" Indent after certain keywords
|
||||
" Indent after certain keywords.
|
||||
let s:indent_after_keywords = '^'
|
||||
\ . s:RegexpGroup('if', 'unless', 'else', 'for',
|
||||
\ 'while', 'until', 'loop', 'switch',
|
||||
|
|
@ -42,23 +42,28 @@ let s:indent_after_keywords = '^'
|
|||
\ 'class')
|
||||
\ . '\>'
|
||||
|
||||
" Indent after brackets, functions, and assignments
|
||||
let s:indent_after_literals = s:RegexpGroup('\[', '{', '(', '->', '=>',
|
||||
\ ':', '=')
|
||||
" Indent after brackets, functions, and assignments.
|
||||
let s:indent_after_literals = s:RegexpGroup('\[', '{', '(', '->', '=>', ':', '=')
|
||||
\ . '$'
|
||||
|
||||
" Combine the two regexps above
|
||||
" Combine the two regexps above.
|
||||
let s:indent_after = s:RegexpJoin([s:indent_after_keywords,
|
||||
\ s:indent_after_literals])
|
||||
|
||||
" Indent after certain keywords used in multi-line assignments
|
||||
" Indent after operators at the end of lines.
|
||||
let s:continuations = s:RegexpGroup('-\@<!>', '=\@<!>', '-\@<!-', '+\@<!+',
|
||||
\ '<', '\*', '/', '%', '|', '&', ',',
|
||||
\ '\.\@<!\.', 'is', 'isnt', 'and', 'or')
|
||||
\ . '$'
|
||||
|
||||
" Indent after certain keywords used as multi-line assignments.
|
||||
let s:assignment_keywords = s:RegexpGroup(':', '=')
|
||||
\ . '\s*\<'
|
||||
\ . s:RegexpGroup('if', 'unless', 'for', 'while',
|
||||
\ 'until', 'switch', 'try', 'class')
|
||||
\ . '\>'
|
||||
|
||||
" Outdent after certain keywords
|
||||
" Outdent after certain keywords.
|
||||
let s:outdent_after = '^'
|
||||
\ . s:RegexpGroup('return', 'break', 'continue', 'throw')
|
||||
\ . '\>'
|
||||
|
|
@ -68,37 +73,55 @@ let s:outdent_after = '^'
|
|||
let s:dont_outdent_after = '\<' . s:RegexpGroup('if', 'unless') . '\>'
|
||||
|
||||
" Check for a single-line statement (e.g., 'if a then b'), which doesn't need an
|
||||
" indent afterwards
|
||||
" indent afterwards.
|
||||
function! s:IsSingleLineStatement(line)
|
||||
" The 'then' keyword is usually a good hint
|
||||
" The 'then' keyword is usually a good hint.
|
||||
return a:line =~ '\<then\>'
|
||||
endfunction
|
||||
|
||||
" Check for a single-line 'else' statement (e.g., 'else return a' but
|
||||
" not 'else if a'), which doesn't need an indent afterwards
|
||||
" not 'else if a'), which doesn't need an indent afterwards.
|
||||
function! s:IsSingleLineElse(line)
|
||||
" Check if the line actually starts with 'else', then if the line contains
|
||||
" anything other than 'else', then finally if the line is actually an 'else'
|
||||
" statement rather than an 'else if' statement
|
||||
return a:line =~ '^else\>' && a:line !~ '^else$' && a:line !~ '^else if\>'
|
||||
" statement rather than an 'else if' or 'else unless' statement.
|
||||
return a:line =~ '^else\>'
|
||||
\ && a:line !~ '^else$'
|
||||
\ && a:line !~ '^else if\>'
|
||||
\ && a:line !~ '^else unless\>'
|
||||
endfunction
|
||||
|
||||
" Check if a 'when' statement is the first in a 'switch' block by searching the
|
||||
" Check if a 'when' statement is the first in a switch block by searching the
|
||||
" previous line for the 'switch' keyword. The first 'when' shouldn't be
|
||||
" outdented
|
||||
" outdented.
|
||||
function! s:IsFirstWhen(curline, prevline)
|
||||
return a:curline =~ '^when\>' && a:prevline =~ '\<switch\>'
|
||||
endfunction
|
||||
|
||||
" Check for a multi-line assignment like
|
||||
" a: if b
|
||||
" c
|
||||
" else
|
||||
" d
|
||||
" a = if b
|
||||
" c
|
||||
" else
|
||||
" d
|
||||
function! s:IsMultiLineAssignment(line)
|
||||
return a:line =~ s:assignment_keywords
|
||||
endfunction
|
||||
|
||||
" Check if a line is a comment.
|
||||
function! s:IsComment(line)
|
||||
return a:line =~ '^#'
|
||||
endfunction
|
||||
|
||||
" Check if a line is a dot-access.
|
||||
function! s:IsDotAccess(line)
|
||||
return a:line =~ '^\.'
|
||||
endfunction
|
||||
|
||||
" Check if a line is a continuation.
|
||||
function! s:IsContinuation(line)
|
||||
return a:line =~ s:continuations
|
||||
endfunction
|
||||
|
||||
function! s:ShouldOutdent(curline, prevline)
|
||||
return !s:IsSingleLineStatement(a:prevline)
|
||||
\ && !s:IsFirstWhen(a:curline, a:prevline)
|
||||
|
|
@ -106,11 +129,21 @@ function! s:ShouldOutdent(curline, prevline)
|
|||
\ && a:curline =~ s:outdent
|
||||
endfunction
|
||||
|
||||
function! s:ShouldIndentAfter(prevline)
|
||||
function! s:ShouldIndent(curline, prevline)
|
||||
return !s:IsDotAccess(a:prevline) && s:IsDotAccess(a:curline)
|
||||
endfunction
|
||||
|
||||
function! s:ShouldIndentAfter(prevline, prevprevline)
|
||||
return !s:IsSingleLineStatement(a:prevline)
|
||||
\ && !s:IsSingleLineElse(a:prevline)
|
||||
\ && !s:IsComment(a:prevline)
|
||||
\
|
||||
\ && (a:prevline =~ s:indent_after
|
||||
\ || s:IsMultiLineAssignment(a:prevline))
|
||||
\ || s:IsMultiLineAssignment(a:prevline)
|
||||
\
|
||||
\ || (s:IsContinuation(a:prevline)
|
||||
\ && !s:IsContinuation(a:prevprevline)
|
||||
\ && a:prevprevline !~ s:indent_after_literals))
|
||||
endfunction
|
||||
|
||||
function! s:ShouldOutdentAfter(prevline)
|
||||
|
|
@ -119,21 +152,36 @@ function! s:ShouldOutdentAfter(prevline)
|
|||
\ && a:prevline =~ s:outdent_after
|
||||
endfunction
|
||||
|
||||
function! GetCoffeeIndent(curlinenum)
|
||||
" Find a non-blank line above the current line
|
||||
let prevlinenum = prevnonblank(a:curlinenum - 1)
|
||||
" Get the nearest previous non-blank line.
|
||||
function! s:GetPrevLineNum(linenum)
|
||||
return prevnonblank(a:linenum - 1)
|
||||
endfunction
|
||||
|
||||
" No indenting is needed at the start of a file
|
||||
" Get the contents of a line without leading whitespace.
|
||||
function! s:GetTrimmedLine(linenum, indent)
|
||||
return substitute(getline(a:linenum)[a:indent : -1], '\s\+$', '', '')
|
||||
endfunction
|
||||
|
||||
function! GetCoffeeIndent(curlinenum)
|
||||
let prevlinenum = s:GetPrevLineNum(a:curlinenum)
|
||||
let prevprevlinenum = s:GetPrevLineNum(prevlinenum)
|
||||
|
||||
" No indenting is needed at the start of a file.
|
||||
if prevlinenum == 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
let curindent = indent(a:curlinenum)
|
||||
let previndent = indent(prevlinenum)
|
||||
let prevprevindent = indent(prevprevlinenum)
|
||||
|
||||
" Strip off leading whitespace
|
||||
let curline = getline(a:curlinenum)[curindent : -1]
|
||||
let prevline = getline(prevlinenum)[previndent : -1]
|
||||
let curline = s:GetTrimmedLine(a:curlinenum, curindent)
|
||||
let prevline = s:GetTrimmedLine(prevlinenum, previndent)
|
||||
let prevprevline = s:GetTrimmedLine(prevprevlinenum, prevprevindent)
|
||||
|
||||
if s:ShouldIndent(curline, prevline)
|
||||
return previndent + &shiftwidth
|
||||
endif
|
||||
|
||||
if s:ShouldOutdent(curline, prevline)
|
||||
" Is the line already outdented?
|
||||
|
|
@ -144,7 +192,7 @@ function! GetCoffeeIndent(curlinenum)
|
|||
endif
|
||||
endif
|
||||
|
||||
if s:ShouldIndentAfter(prevline)
|
||||
if s:ShouldIndentAfter(prevline, prevprevline)
|
||||
return previndent + &shiftwidth
|
||||
endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
This project adds [CoffeeScript] support to the vim editor. Currently, it
|
||||
supports [almost][todo] all of CoffeeScript 0.9.2's syntax and indentation style.
|
||||
supports [almost][todo] all of CoffeeScript's syntax and indentation style.
|
||||
|
||||
![Screenshot][screenshot]
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ supports [almost][todo] all of CoffeeScript 0.9.2's syntax and indentation style
|
|||
> so you actually need to "filetype off" before "filetype plugin indent on"
|
||||
> to force reloading.
|
||||
|
||||
[pathogen]: http://vim.org/scripts/script.php?script_id=2332
|
||||
[pathogen]: http://www.vim.org/scripts/script.php?script_id=2332
|
||||
|
||||
2. Create, and change into, the `~/.vim/bundle/` directory:
|
||||
|
||||
|
|
@ -50,12 +50,19 @@ extension or a `Cakefile` will load all the CoffeeScript stuff.
|
|||
|
||||
$ git pull
|
||||
|
||||
Everything will then be brought up to date!
|
||||
Everything will then be brought up to date.
|
||||
|
||||
### Customizing
|
||||
|
||||
Some of the possibly unwanted syntax highlighting elements can be disabled
|
||||
in the following ways.
|
||||
#### Compile the current file on write/save
|
||||
|
||||
If you are using the NodeJS version of CofeeScript, with the `coffee` command
|
||||
in your `$PATH`, you can enable auto-compiling on file write/save like so:
|
||||
|
||||
let coffee_compile_on_save = 1
|
||||
|
||||
This will compile the CoffeeScript to JavaScript. For example,
|
||||
`/Users/brian/ZOMG.coffee` will compile to `/Users/brian/ZOMG.js`.
|
||||
|
||||
#### Disable trailing whitespace error highlighting
|
||||
|
||||
|
|
|
|||
|
|
@ -13,11 +13,15 @@ endif
|
|||
|
||||
let b:current_syntax = "coffee"
|
||||
|
||||
" Highlight long strings.
|
||||
syntax sync minlines=100
|
||||
|
||||
" CoffeeScript allows dollar signs in identifiers
|
||||
" CoffeeScript allows dollar signs in identifiers.
|
||||
setlocal isident+=$
|
||||
|
||||
" These are 'matches' rather than 'keywords' because vim's highlighting priority
|
||||
" for keywords (the highest) causes them to be wrongly highlighted when used as
|
||||
" dot-properties.
|
||||
syntax match coffeeStatement /\<\%(return\|break\|continue\|throw\)\>/
|
||||
highlight default link coffeeStatement Statement
|
||||
|
||||
|
|
@ -33,7 +37,7 @@ highlight default link coffeeException Exception
|
|||
syntax match coffeeOperator /\<\%(instanceof\|typeof\|delete\)\>/
|
||||
highlight default link coffeeOperator Operator
|
||||
|
||||
syntax match coffeeKeyword /\<\%(new\|in\|of\|by\|where\|and\|or\|not\|is\|isnt\|class\|extends\|super\|all\)\>/
|
||||
syntax match coffeeKeyword /\<\%(new\|in\|of\|by\|and\|or\|not\|is\|isnt\|class\|extends\|super\|own\|do\)\>/
|
||||
highlight default link coffeeKeyword Keyword
|
||||
|
||||
syntax match coffeeBoolean /\<\%(\%(true\|on\|yes\|false\|off\|no\)\)\>/
|
||||
|
|
@ -42,50 +46,74 @@ highlight default link coffeeBoolean Boolean
|
|||
syntax match coffeeGlobal /\<\%(null\|undefined\)\>/
|
||||
highlight default link coffeeGlobal Type
|
||||
|
||||
" Keywords reserved by the language
|
||||
syntax cluster coffeeReserved contains=coffeeStatement,coffeeRepeat,
|
||||
\ coffeeConditional,coffeeException,
|
||||
\ coffeeOperator,coffeeKeyword,
|
||||
\ coffeeBoolean,coffeeGlobal
|
||||
|
||||
syntax match coffeeAssignmentMod /\%(\s\+\zs\%(and\|or\)\|\W\{,3}\)\ze=/ contained
|
||||
highlight default link coffeeAssignmentMod SpecialChar
|
||||
|
||||
syntax match coffeeAssignmentChar /:\|=/ contained
|
||||
highlight default link coffeeAssignmentChar SpecialChar
|
||||
|
||||
syntax match coffeeVar /\<\%(this\|prototype\|arguments\)\>/
|
||||
" Matches @-variables like @abc
|
||||
" Matches @-variables like @abc.
|
||||
syntax match coffeeVar /@\%(\I\i*\)\?/
|
||||
highlight default link coffeeVar Type
|
||||
|
||||
" Matches class-like names that start with a capital letter, like Array or
|
||||
" Object
|
||||
" Object.
|
||||
syntax match coffeeObject /\<\u\w*\>/
|
||||
highlight default link coffeeObject Structure
|
||||
|
||||
" Matches constant-like names in SCREAMING_CAPS
|
||||
" Matches constant-like names in SCREAMING_CAPS.
|
||||
syntax match coffeeConstant /\<\u[A-Z0-9_]\+\>/
|
||||
highlight default link coffeeConstant Constant
|
||||
|
||||
syntax match coffeePrototype /::/
|
||||
highlight default link coffeePrototype SpecialChar
|
||||
|
||||
syntax region coffeeString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=@coffeeInterpString
|
||||
syntax region coffeeString start=/'/ skip=/\\\\\|\\'/ end=/'/ contains=@coffeeSimpleString
|
||||
highlight default link coffeeString String
|
||||
|
||||
" What can make up a variable name
|
||||
syntax cluster coffeeIdentifier contains=coffeeVar,coffeeObject,coffeeConstant,
|
||||
\ coffeePrototype
|
||||
|
||||
syntax match coffeeAssignment /@\?\I\%(\i\|::\|\.\|\[.\+\]\|([^)]*)\)*\s*\%(::\@!\|\%(and\|or\|\|&&\|||\|?\|+\|-\|\/\|\*\|%\|<<\|>>\|>>>\|&\||\|\^\)==\@!>\@!\)/
|
||||
\ contains=@coffeeIdentifier,coffeeAssignmentMod,
|
||||
\ coffeeAssignmentChar,coffeeBrackets,
|
||||
\ coffeeParens
|
||||
syntax match coffeeAssignment /\%("\|'\)[^'"]\+\%("\|'\)\s*:/ contains=coffeeString,
|
||||
\ coffeeAssignmentChar
|
||||
syntax match coffeeAssignment /\d*\%(\.\d\+\)\?\s*:/ contains=coffeeNumber,coffeeAssignmentChar
|
||||
highlight default link coffeeAssignment Identifier
|
||||
syntax region coffeeString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=@coffeeInterpString
|
||||
syntax region coffeeString start=/'/ skip=/\\\\\|\\'/ end=/'/ contains=@coffeeSimpleString
|
||||
highlight default link coffeeString String
|
||||
|
||||
syntax region coffeeAssignString start=/"/ skip=/\\\\\|\\"/ end=/"/ contained contains=@coffeeSimpleString
|
||||
syntax region coffeeAssignString start=/'/ skip=/\\\\\|\\'/ end=/'/ contained contains=@coffeeSimpleString
|
||||
highlight default link coffeeAssignString String
|
||||
|
||||
" Matches numbers like -10, -10e8, -10E8, 10, 10e8, 10E8.
|
||||
syntax match coffeeNumber /\i\@<![-+]\?\d\+\%([eE][+-]\?\d\+\)\?/
|
||||
" Matches hex numbers like 0xfff, 0x000.
|
||||
syntax match coffeeNumber /\<0[xX]\x\+\>/
|
||||
highlight default link coffeeNumber Number
|
||||
|
||||
" Matches floating-point numbers like -10.42e8, 10.42e-8.
|
||||
syntax match coffeeFloat /\i\@<![-+]\?\d*\.\@<!\.\d\+\%([eE][+-]\?\d\+\)\?/
|
||||
highlight default link coffeeFloat Float
|
||||
|
||||
syntax match coffeeAssignSymbols /:\@<!::\@!\|++\|--\|\%(\%(\s\zs\%(and\|or\)\)\|&&\|||\|?\|+\|-\|\/\|\*\|%\|<<\|>>\|>>>\|&\||\|\^\)\?=\@<!==\@!>\@!/ contained
|
||||
highlight default link coffeeAssignSymbols SpecialChar
|
||||
|
||||
syntax match coffeeAssignBrackets /\[.\+\]/ contained contains=TOP,coffeeAssign
|
||||
|
||||
syntax match coffeeAssign /\%(++\|--\)\s*\%(@\|@\?\I\)\%(\i\|::\|\.\|?\|\[.\+\]\)*/
|
||||
\ contains=@coffeeIdentifier,coffeeAssignSymbols,coffeeAssignBrackets
|
||||
syntax match coffeeAssign /\%(@\|@\?\I\)\%(\i\|::\|\.\|?\|\[.\+\]\)*\%(++\|--\|\s*\%(and\|or\|&&\|||\|?\|+\|-\|\/\|\*\|%\|<<\|>>\|>>>\|&\||\|\^\)\?=\@<!==\@!>\@!\)/
|
||||
\ contains=@coffeeIdentifier,coffeeAssignSymbols,coffeeAssignBrackets
|
||||
|
||||
" Displays an error for reserved words.
|
||||
if !exists("coffee_no_reserved_words_error")
|
||||
syntax match coffeeReservedError /\<\%(case\|default\|function\|var\|void\|with\|const\|let\|enum\|export\|import\|native\|__hasProp\|__extends\|__slice\|__bind\|__indexOf\)\>/
|
||||
highlight default link coffeeReservedError Error
|
||||
endif
|
||||
|
||||
syntax match coffeeAssign /@\?\I\i*\s*:\@<!::\@!/ contains=@coffeeIdentifier,coffeeAssignSymbols
|
||||
" Matches string assignments in object literals like {'a': 'b'}.
|
||||
syntax match coffeeAssign /\("\|'\)[^'"]\+\1\s*;\@<!::\@!/ contains=coffeeAssignString,
|
||||
\ coffeeAssignSymbols
|
||||
" Matches number assignments in object literals like {42: 'a'}.
|
||||
syntax match coffeeAssign /\d\+\%(\.\d\+\)\?\s*:\@<!::\@!/ contains=coffeeNumber,coffeeAssignSymbols
|
||||
highlight default link coffeeAssign Identifier
|
||||
|
||||
syntax match coffeePrototype /::/
|
||||
highlight default link coffeePrototype SpecialChar
|
||||
|
||||
syntax match coffeeFunction /->\|=>/
|
||||
highlight default link coffeeFunction Function
|
||||
|
|
@ -97,65 +125,51 @@ syntax match coffeeComment /#.*/ contains=@Spell,coffeeTodo
|
|||
syntax match coffeeComment /####\@!\_.\{-}###/ contains=@Spell,coffeeTodo
|
||||
highlight default link coffeeComment Comment
|
||||
|
||||
syntax region coffeeEmbed start=/`/ end=/`/
|
||||
syntax region coffeeHereComment start=/#/ end=/\ze\/\/\// end=/$/ contained contains=@Spell,coffeeTodo
|
||||
highlight default link coffeeHereComment coffeeComment
|
||||
|
||||
syntax region coffeeEmbed start=/`/ skip=/\\\\\|\\`/ end=/`/
|
||||
highlight default link coffeeEmbed Special
|
||||
|
||||
" Matches numbers like -10, -10e8, -10E8, 10, 10e8, 10E8
|
||||
syntax match coffeeNumber /\<-\?\d\+\%([eE][+-]\?\d\+\)\?\>/
|
||||
" Matches hex numbers like 0xfff, 0x000
|
||||
syntax match coffeeNumber /\<0[xX]\x\+\>/
|
||||
highlight default link coffeeNumber Number
|
||||
|
||||
" Matches floating-point numbers like -10.42e8, 10.42e-8
|
||||
syntax match coffeeFloat /-\?\d*\.\@<!\.\d\+\%([eE][+-]\?\d\+\)\?/
|
||||
highlight default link coffeeFloat Float
|
||||
|
||||
syntax region coffeeInterpolation matchgroup=coffeeInterpDelim
|
||||
\ start=/\#{/ end=/}/
|
||||
\ contained contains=TOP
|
||||
highlight default link coffeeInterpDelim Delimiter
|
||||
|
||||
" Matches escape sequences like \000, \x00, \u0000, \n.
|
||||
syntax match coffeeEscape /\\\d\d\d\|\\x\x\{2\}\|\\u\x\{4\}\|\\./ contained
|
||||
highlight default link coffeeEscape SpecialChar
|
||||
|
||||
" What is in a non-interpolated string
|
||||
syntax cluster coffeeSimpleString contains=@Spell,coffeeEscape
|
||||
" What is in an interpolated string
|
||||
syntax cluster coffeeInterpString contains=@coffeeSimpleString,
|
||||
\ coffeeInterpolation
|
||||
|
||||
syntax region coffeeRegExp start=/)\@<!\%(\%((\s*\|=\s\+\)\@<=\/\|\s\zs\/\s\@!\)/
|
||||
\ end=/\/[gimy]\{,4}/ oneline
|
||||
\ contains=@coffeeInterpString
|
||||
\ skip=/\[.*\/.*\]/ end=/\/[gimy]\{,4}/ oneline
|
||||
\ contains=@coffeeSimpleString
|
||||
syntax region coffeeHereRegexp start=/\/\/\// end=/\/\/\/[gimy]\{,4}/ contains=@coffeeInterpString,coffeeHereComment fold
|
||||
highlight default link coffeeHereRegexp coffeeRegExp
|
||||
highlight default link coffeeRegExp String
|
||||
|
||||
syntax region coffeeHeredoc start=/"""/ end=/"""/ contains=@coffeeInterpString
|
||||
syntax region coffeeHeredoc start=/'''/ end=/'''/ contains=@coffeeSimpleString
|
||||
syntax region coffeeHeredoc start=/"""/ end=/"""/ contains=@coffeeInterpString fold
|
||||
syntax region coffeeHeredoc start=/'''/ end=/'''/ contains=@coffeeSimpleString fold
|
||||
highlight default link coffeeHeredoc String
|
||||
|
||||
syntax region coffeeCurlies start=/{/ end=/}/ contains=TOP
|
||||
syntax region coffeeBrackets start=/\[/ end=/\]/ contains=TOP,coffeeAssignment
|
||||
syntax match coffeeParens /(.*)/ contains=TOP,coffeeAssignment
|
||||
|
||||
" Displays an error for trailing whitespace
|
||||
" Displays an error for trailing whitespace.
|
||||
if !exists("coffee_no_trailing_space_error")
|
||||
syntax match coffeeSpaceError /\s\+$/ display
|
||||
syntax match coffeeSpaceError /\S\@<=\s\+$/ display
|
||||
highlight default link coffeeSpaceError Error
|
||||
endif
|
||||
|
||||
" Displays an error for trailing semicolons
|
||||
" Displays an error for trailing semicolons.
|
||||
if !exists("coffee_no_trailing_semicolon_error")
|
||||
syntax match coffeeSemicolonError /;$/ display
|
||||
highlight default link coffeeSemicolonError Error
|
||||
endif
|
||||
|
||||
" Displays an error for reserved words
|
||||
if !exists("coffee_no_reserved_words_error")
|
||||
syntax keyword coffeeReservedError case default do function var void with const
|
||||
\ let enum export import native __hasProp
|
||||
\ __extends __slice
|
||||
highlight default link coffeeReservedError Error
|
||||
endif
|
||||
|
||||
" Reserved words can be used as dot-properties
|
||||
" Reserved words can be used as dot-properties.
|
||||
syntax match coffeeDot /\.\@<!\.\i\+/ transparent
|
||||
\ contains=ALLBUT,@coffeeReserved,
|
||||
\ coffeeReservedError
|
||||
|
|
|
|||
62
.vim/bundle/vim-coffee-script/syntax/eco.vim
Normal file
62
.vim/bundle/vim-coffee-script/syntax/eco.vim
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
" Vim syntax file
|
||||
" Language: eco
|
||||
" Maintainer: Jay Adkisson
|
||||
" Mostly stolen from eruby.vim
|
||||
|
||||
if !exists("g:eco_default_subtype")
|
||||
let g:eco_default_subtype = "html"
|
||||
endif
|
||||
|
||||
if !exists("b:eco_subtype")
|
||||
let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$")
|
||||
let b:eco_subtype = matchstr(s:lines,'eco_subtype=\zs\w\+')
|
||||
if b:eco_subtype == ''
|
||||
let b:eco_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eco\)\+$','',''),'\.\zs\w\+$')
|
||||
endif
|
||||
if b:eco_subtype == 'rhtml'
|
||||
let b:eco_subtype = 'html'
|
||||
elseif b:eco_subtype == 'rb'
|
||||
let b:eco_subtype = 'ruby'
|
||||
elseif b:eco_subtype == 'yml'
|
||||
let b:eco_subtype = 'yaml'
|
||||
elseif b:eco_subtype == 'js'
|
||||
let b:eco_subtype = 'javascript'
|
||||
elseif b:eco_subtype == 'txt'
|
||||
" Conventional; not a real file type
|
||||
let b:eco_subtype = 'text'
|
||||
elseif b:eco_subtype == ''
|
||||
if b:current_syntax == ''
|
||||
let b:eco_subtype = g:eco_default_subtype
|
||||
else
|
||||
let b:eco_subtype = b:current_syntax
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
if exists("b:eruby_subtype") && b:eruby_subtype != ''
|
||||
exec "runtime! syntax/".b:eruby_subtype.".vim"
|
||||
let b:current_syntax = "eco"
|
||||
endif
|
||||
|
||||
syn include @coffeeTop syntax/coffee.vim
|
||||
|
||||
syn cluster ecoRegions contains=ecoBlock,ecoExpression,ecoComment
|
||||
|
||||
syn region ecoBlock matchgroup=ecoDelimiter start=/<%/ end=/%>/ contains=@coffeeTop containedin=ALLBUT,@ecoRegions keepend
|
||||
syn region ecoExpression matchgroup=ecoDelimiter start=/<%[=\-]/ end=/%>/ contains=@coffeeTop containedin=ALLBUT,@ecoRegions keepend
|
||||
syn region ecoComment matchgroup=ecoComment start=/<%#/ end=/%>/ contains=@coffeeTodo,@Spell containedin=ALLBUT,@ecoRegions keepend
|
||||
|
||||
" eco features not in coffeescript proper
|
||||
syn keyword ecoEnd end containedin=@ecoRegions
|
||||
syn match ecoIndentColon /\s+\w+:/ containedin=@ecoRegions
|
||||
|
||||
" Define the default highlighting.
|
||||
|
||||
hi def link ecoDelimiter Delimiter
|
||||
hi def link ecoComment Comment
|
||||
hi def link ecoEnd coffeeConditional
|
||||
hi def link ecoIndentColon None
|
||||
|
||||
let b:current_syntax = 'eco'
|
||||
|
||||
" vim: nowrap sw=2 sts=2 ts=8:
|
||||
22
.vim/bundle/vim-coffee-script/thanks.md
Normal file
22
.vim/bundle/vim-coffee-script/thanks.md
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
Thanks to the following contributors:
|
||||
|
||||
Brian Egan (3):
|
||||
Adding compile functionality to the ftplugin. Must be enabled in .vimrc
|
||||
Updating the readme with compilation instructions
|
||||
Updating bad header in readme to make instructions easier to read
|
||||
|
||||
Chris Hoffman (3):
|
||||
Add new keywoards from, to, and do
|
||||
Highlight the - in negative integers
|
||||
Add here regex highlighting, increase fold level for here docs
|
||||
|
||||
Jay Adkisson:
|
||||
Support for eco templates
|
||||
|
||||
Karl Guertin (1):
|
||||
Cakefiles are coffeescript
|
||||
|
||||
Simon Lipp (1):
|
||||
Trailing spaces are not error on lines containing only spaces
|
||||
|
||||
And thanks to anyone who files or has filed a bug report.
|
||||
|
|
@ -6,14 +6,6 @@
|
|||
{a, b} = c
|
||||
└──┴─ these should be highlighted as identifiers
|
||||
|
||||
- Assignments inside brackets (sounds simple enough):
|
||||
|
||||
a[b -= c] = d
|
||||
|
||||
this should still be highlighted correctly:
|
||||
|
||||
a[b[c]] = d
|
||||
|
||||
- Smart, lookback outdenting for cases like:
|
||||
|
||||
a = {
|
||||
|
|
@ -22,14 +14,13 @@
|
|||
}
|
||||
└─ bracket should be put here
|
||||
|
||||
- Should indent if the previous line ends, or the current line starts, with one
|
||||
of these:
|
||||
- Fix assignments with brackets in these cases:
|
||||
|
||||
+ - * / % | & , . is isnt and or && ||
|
||||
a[b] = c[d]
|
||||
a[b -= c] = d
|
||||
|
||||
- Support `else unless` in indentation:
|
||||
and still highlight these correctly:
|
||||
|
||||
unless a
|
||||
b
|
||||
else unless c
|
||||
d
|
||||
a[b] = c
|
||||
a[b[c]] = d
|
||||
a[b[c] -= d] = e
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue