diff options
-rw-r--r-- | indent/coffee.vim | 26 | ||||
-rw-r--r-- | indent/tex.vim | 3 | ||||
-rw-r--r-- | syntax/clojure.vim | 2 |
3 files changed, 22 insertions, 9 deletions
diff --git a/indent/coffee.vim b/indent/coffee.vim index 49953151..7bd82e3e 100644 --- a/indent/coffee.vim +++ b/indent/coffee.vim @@ -99,6 +99,16 @@ let s:SYNTAX_COMMENT = 'coffee\%(Comment\|BlockComment\|HeregexComment\)' " Syntax names for strings and comments 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. function! s:SyntaxName(lnum, col) return synIDattr(synID(a:lnum, a:col, 1), 'name') @@ -329,16 +339,16 @@ function! GetCoffeeIndent(curlnum) " Always indent after these operators. if prevline =~ s:BEGIN_BLOCK_OP - return indent(prevnlnum) + shiftwidth() + return indent(prevnlnum) + s:ShiftWidth() endif " Indent if the previous line starts a function block, but don't force " indenting if the line is non-blank (for empty function bodies.) if prevline =~ s:FUNCTION 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 - return indent(prevnlnum) + shiftwidth() + return indent(prevnlnum) + s:ShiftWidth() endif endif @@ -365,7 +375,7 @@ function! GetCoffeeIndent(curlnum) endif " Otherwise indent a level. - return indent(prevnlnum) + shiftwidth() + return indent(prevnlnum) + s:ShiftWidth() endif " 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. if curline !~ '\C^\<then\>' && !s:SearchCode(prevnlnum, '\C\<then\>') && \ prevline !~ s:SINGLE_LINE_ELSE - return indent(prevnlnum) + shiftwidth() + return indent(prevnlnum) + s:ShiftWidth() else exec 'return' s:GetDefaultPolicy(a:curlnum) endif @@ -383,7 +393,7 @@ function! GetCoffeeIndent(curlnum) " Indent a dot access if it's the first. if curline =~ s:DOT_ACCESS if prevline !~ s:DOT_ACCESS - return indent(prevnlnum) + shiftwidth() + return indent(prevnlnum) + s:ShiftWidth() else exec 'return' s:GetDefaultPolicy(a:curlnum) endif @@ -396,7 +406,7 @@ function! GetCoffeeIndent(curlnum) \ s:SearchCode(prevnlnum, '\C\<then\>') && \ !s:SearchCode(prevnlnum, s:CONTAINED_THEN) " Don't force indenting. - return min([indent(a:curlnum), indent(prevnlnum) - shiftwidth()]) + return min([indent(a:curlnum), indent(prevnlnum) - s:ShiftWidth()]) else exec 'return' s:GetDefaultPolicy(a:curlnum) endif @@ -410,7 +420,7 @@ function! GetCoffeeIndent(curlnum) " If inside brackets, indent relative to the brackets, but don't outdent an " already indented line. if matchlnum - return max([indent(a:curlnum), indent(matchlnum) + shiftwidth()]) + return max([indent(a:curlnum), indent(matchlnum) + s:ShiftWidth()]) endif " No special rules applied, so use the default policy. diff --git a/indent/tex.vim b/indent/tex.vim index 63453bda..92866d5b 100644 --- a/indent/tex.vim +++ b/indent/tex.vim @@ -1,6 +1,9 @@ " LaTeX indent file (part of LaTeX Box) " Maintainer: David Munger (mungerd@gmail.com) +if exists("g:LatexBox_custom_indent") && ! g:LatexBox_custom_indent + finish +endif if exists("b:did_indent") finish endif diff --git a/syntax/clojure.vim b/syntax/clojure.vim index 64e4ac0b..873f3e5f 100644 --- a/syntax/clojure.vim +++ b/syntax/clojure.vim @@ -75,7 +75,7 @@ syntax match clojureDispatch "\v#[\^'=<_]?" " Clojure permits no more than 20 params. 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 clojureRegexpQuote start=/\\Q/ skip=/\\\\\|\\"/ end=/\\E/ end=/"/me=s-1 contains=clojureRegexpQuoted keepend contained |