diff --git a/indent/ls.vim b/indent/ls.vim index d504767..8bff512 100644 --- a/indent/ls.vim +++ b/indent/ls.vim @@ -22,7 +22,7 @@ endif " Keywords to indent after let s:INDENT_AFTER_KEYWORD = '^\%(if\|unless\|else\|for\|while\|until\|' -\ . 'loop\|case\|default\|try\|catch\|finally\|' +\ . 'loop\|case\||\|default\|try\|catch\|finally\|' \ . 'class\|do\|new\|let\|with\|function\)\>' " Operators to indent after @@ -115,7 +115,7 @@ function! s:ShouldSkip(startlinenum, linenum, col) endif " Check for a single-line statement that isn't adjacent. - if s:SmartSearch(a:linenum, '\') && a:startlinenum - a:linenum > 1 + if s:SmartSearch(a:linenum, '\\|=>') && a:startlinenum - a:linenum > 1 return 1 endif @@ -162,7 +162,7 @@ function! s:GetMatch(curline) elseif firstchar == ']' return s:SearchPair('\[', '\]') elseif a:curline =~ '^else\>' - return s:SearchPair('\<\%(if\|unless\|case\|when\)\>', '\') + return s:SearchPair('\<\%(if\|unless\|case\||\|when\)\>', '\') elseif a:curline =~ '^catch\>' return s:SearchPair('\', '\') elseif a:curline =~ '^finally\>' @@ -231,7 +231,7 @@ function! s:GetLiveScriptIndent(curlinenum) " Indent after these keywords and compound assignments if they aren't a " single-line statement. if prevline =~ s:INDENT_AFTER_KEYWORD || prevline =~ s:COMPOUND_ASSIGNMENT - if !s:SmartSearch(prevlinenum, '\') && prevline !~ s:SINGLE_LINE_ELSE + if !s:SmartSearch(prevlinenum, '\\|=>') && prevline !~ s:SINGLE_LINE_ELSE return previndent + &shiftwidth endif endif @@ -245,7 +245,7 @@ function! s:GetLiveScriptIndent(curlinenum) " aren't a single-line statement. if prevline =~ s:OUTDENT_AFTER if !s:SmartSearch(prevlinenum, s:POSTFIX_CONDITION) || - \ s:SmartSearch(prevlinenum, '\') + \ s:SmartSearch(prevlinenum, '\\|=>') return previndent - &shiftwidth endif endif diff --git a/syntax/ls.vim b/syntax/ls.vim index 9baa3fa..966adf4 100755 --- a/syntax/ls.vim +++ b/syntax/ls.vim @@ -26,13 +26,16 @@ highlight default link lsStatement Statement syntax match lsRepeat /\<\%(for\%( own\| ever\)\?\|while\|until\)\>/ highlight default link lsRepeat Repeat -syntax match lsConditional /\<\%(if\|else\|unless\|switch\|case\|when\|default\|match\)\>/ +syntax match lsConditional /\<\%(if\|then\|else\|unless\|switch\|match\)\>\|=>/ highlight default link lsConditional Conditional +syntax match lsLabel /\<\%(when\|case\|default\)\>\||\|^\s\+:[$A-Za-z_]\k*\%(-[a-zA-Z]\+\)*/ +highlight default link lsLabel Label + syntax match lsException /\<\%(try\|catch\|finally\)\>/ highlight default link lsException Exception -syntax match lsKeyword /\<\%(new\|in\%(stanceof\)\?\|typeof\|delete\|and\|o[fr]\|not\|xor\|is\|isnt\|imp\%(ort\%( all\)\?\|lements\)\|extends\|loop\|from\|to\|til\|by\|do\|then\|function\|class\|let\|with\|export\|const\|var\|eval\|super\|fallthrough\|debugger\|where\|yield\)\>/ +syntax match lsKeyword /\<\%(new\|in\%(stanceof\)\?\|typeof\|delete\|and\|o[fr]\|not\|xor\|is\|isnt\|imp\%(ort\%( all\)\?\|lements\)\|extends\|loop\|from\|to\|til\|by\|do\|function\|class\|let\|with\|export\|const\|var\|eval\|super\|fallthrough\|debugger\|where\|yield\)\>/ highlight default link lsKeyword Keyword syntax match lsBoolean /\<\%(true\|false\|yes\|no\|on\|off\|null\|void\)\>/