mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-10 04:23:51 -05:00
Update clojure, tex and coffee
This commit is contained in:
@@ -99,6 +99,16 @@ let s:SYNTAX_COMMENT = 'coffee\%(Comment\|BlockComment\|HeregexComment\)'
|
|||||||
" Syntax names for strings and comments
|
" Syntax names for strings and comments
|
||||||
let s:SYNTAX_STRING_COMMENT = s:SYNTAX_STRING . '\|' . s:SYNTAX_COMMENT
|
let s:SYNTAX_STRING_COMMENT = s:SYNTAX_STRING . '\|' . s:SYNTAX_COMMENT
|
||||||
|
|
||||||
|
" Compatibility code for shiftwidth() as recommended by the docs, but modified
|
||||||
|
" so there isn't as much of a penalty if shiftwidth() exists.
|
||||||
|
if exists('*shiftwidth')
|
||||||
|
let s:ShiftWidth = function('shiftwidth')
|
||||||
|
else
|
||||||
|
function! s:ShiftWidth()
|
||||||
|
return &shiftwidth
|
||||||
|
endfunction
|
||||||
|
endif
|
||||||
|
|
||||||
" Get the linked syntax name of a character.
|
" Get the linked syntax name of a character.
|
||||||
function! s:SyntaxName(lnum, col)
|
function! s:SyntaxName(lnum, col)
|
||||||
return synIDattr(synID(a:lnum, a:col, 1), 'name')
|
return synIDattr(synID(a:lnum, a:col, 1), 'name')
|
||||||
@@ -329,16 +339,16 @@ function! GetCoffeeIndent(curlnum)
|
|||||||
|
|
||||||
" Always indent after these operators.
|
" Always indent after these operators.
|
||||||
if prevline =~ s:BEGIN_BLOCK_OP
|
if prevline =~ s:BEGIN_BLOCK_OP
|
||||||
return indent(prevnlnum) + shiftwidth()
|
return indent(prevnlnum) + s:ShiftWidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Indent if the previous line starts a function block, but don't force
|
" Indent if the previous line starts a function block, but don't force
|
||||||
" indenting if the line is non-blank (for empty function bodies.)
|
" indenting if the line is non-blank (for empty function bodies.)
|
||||||
if prevline =~ s:FUNCTION
|
if prevline =~ s:FUNCTION
|
||||||
if strlen(getline(a:curlnum)) > indent(a:curlnum)
|
if strlen(getline(a:curlnum)) > indent(a:curlnum)
|
||||||
return min([indent(prevnlnum) + shiftwidth(), indent(a:curlnum)])
|
return min([indent(prevnlnum) + s:ShiftWidth(), indent(a:curlnum)])
|
||||||
else
|
else
|
||||||
return indent(prevnlnum) + shiftwidth()
|
return indent(prevnlnum) + s:ShiftWidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -365,7 +375,7 @@ function! GetCoffeeIndent(curlnum)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" Otherwise indent a level.
|
" Otherwise indent a level.
|
||||||
return indent(prevnlnum) + shiftwidth()
|
return indent(prevnlnum) + s:ShiftWidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Check if the previous line starts with a keyword that begins a block.
|
" Check if the previous line starts with a keyword that begins a block.
|
||||||
@@ -374,7 +384,7 @@ function! GetCoffeeIndent(curlnum)
|
|||||||
" isn't a single-line statement.
|
" isn't a single-line statement.
|
||||||
if curline !~ '\C^\<then\>' && !s:SearchCode(prevnlnum, '\C\<then\>') &&
|
if curline !~ '\C^\<then\>' && !s:SearchCode(prevnlnum, '\C\<then\>') &&
|
||||||
\ prevline !~ s:SINGLE_LINE_ELSE
|
\ prevline !~ s:SINGLE_LINE_ELSE
|
||||||
return indent(prevnlnum) + shiftwidth()
|
return indent(prevnlnum) + s:ShiftWidth()
|
||||||
else
|
else
|
||||||
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
||||||
endif
|
endif
|
||||||
@@ -383,7 +393,7 @@ function! GetCoffeeIndent(curlnum)
|
|||||||
" Indent a dot access if it's the first.
|
" Indent a dot access if it's the first.
|
||||||
if curline =~ s:DOT_ACCESS
|
if curline =~ s:DOT_ACCESS
|
||||||
if prevline !~ s:DOT_ACCESS
|
if prevline !~ s:DOT_ACCESS
|
||||||
return indent(prevnlnum) + shiftwidth()
|
return indent(prevnlnum) + s:ShiftWidth()
|
||||||
else
|
else
|
||||||
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
||||||
endif
|
endif
|
||||||
@@ -396,7 +406,7 @@ function! GetCoffeeIndent(curlnum)
|
|||||||
\ s:SearchCode(prevnlnum, '\C\<then\>') &&
|
\ s:SearchCode(prevnlnum, '\C\<then\>') &&
|
||||||
\ !s:SearchCode(prevnlnum, s:CONTAINED_THEN)
|
\ !s:SearchCode(prevnlnum, s:CONTAINED_THEN)
|
||||||
" Don't force indenting.
|
" Don't force indenting.
|
||||||
return min([indent(a:curlnum), indent(prevnlnum) - shiftwidth()])
|
return min([indent(a:curlnum), indent(prevnlnum) - s:ShiftWidth()])
|
||||||
else
|
else
|
||||||
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
||||||
endif
|
endif
|
||||||
@@ -410,7 +420,7 @@ function! GetCoffeeIndent(curlnum)
|
|||||||
" If inside brackets, indent relative to the brackets, but don't outdent an
|
" If inside brackets, indent relative to the brackets, but don't outdent an
|
||||||
" already indented line.
|
" already indented line.
|
||||||
if matchlnum
|
if matchlnum
|
||||||
return max([indent(a:curlnum), indent(matchlnum) + shiftwidth()])
|
return max([indent(a:curlnum), indent(matchlnum) + s:ShiftWidth()])
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" No special rules applied, so use the default policy.
|
" No special rules applied, so use the default policy.
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
" LaTeX indent file (part of LaTeX Box)
|
" LaTeX indent file (part of LaTeX Box)
|
||||||
" Maintainer: David Munger (mungerd@gmail.com)
|
" Maintainer: David Munger (mungerd@gmail.com)
|
||||||
|
|
||||||
|
if exists("g:LatexBox_custom_indent") && ! g:LatexBox_custom_indent
|
||||||
|
finish
|
||||||
|
endif
|
||||||
if exists("b:did_indent")
|
if exists("b:did_indent")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ syntax match clojureDispatch "\v#[\^'=<_]?"
|
|||||||
" Clojure permits no more than 20 params.
|
" Clojure permits no more than 20 params.
|
||||||
syntax match clojureAnonArg "%\(20\|1\d\|[1-9]\|&\)\?"
|
syntax match clojureAnonArg "%\(20\|1\d\|[1-9]\|&\)\?"
|
||||||
|
|
||||||
syntax match clojureRegexpEscape "\v\\%([\\tnrfae()\[\]{}^$*?+]|c\u|0[0-3]?\o{1,2}|x%(\x{2}|\{\x{1,6}\})|u\x{4})" contained display
|
syntax match clojureRegexpEscape "\v\\%([\\tnrfae.()\[\]{}^$*?+]|c\u|0[0-3]?\o{1,2}|x%(\x{2}|\{\x{1,6}\})|u\x{4})" contained display
|
||||||
syntax region clojureRegexpQuoted start=/\\Q/ms=e+1 skip=/\\\\\|\\"/ end=/\\E/me=s-1 end=/"/me=s-1 contained
|
syntax region clojureRegexpQuoted start=/\\Q/ms=e+1 skip=/\\\\\|\\"/ end=/\\E/me=s-1 end=/"/me=s-1 contained
|
||||||
syntax region clojureRegexpQuote start=/\\Q/ skip=/\\\\\|\\"/ end=/\\E/ end=/"/me=s-1 contains=clojureRegexpQuoted keepend contained
|
syntax region clojureRegexpQuote start=/\\Q/ skip=/\\\\\|\\"/ end=/\\E/ end=/"/me=s-1 contains=clojureRegexpQuoted keepend contained
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user