From 5e035bb7a1ab5c933182f9d95f5e62e190958fda Mon Sep 17 00:00:00 2001 From: summivox Date: Wed, 1 Jul 2015 17:44:26 -0400 Subject: [PATCH 1/3] `=>` is alias for `then` -- reflect this in indent file --- indent/ls.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indent/ls.vim b/indent/ls.vim index d504767..b523a91 100644 --- a/indent/ls.vim +++ b/indent/ls.vim @@ -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 @@ -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 From d26bf48d2556e3dedc0bf27c18ee5e85b1235b83 Mon Sep 17 00:00:00 2001 From: summivox Date: Sat, 9 Jan 2016 15:03:04 -0500 Subject: [PATCH 2/3] `|` is alias for `case` --- indent/ls.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indent/ls.vim b/indent/ls.vim index b523a91..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 @@ -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\>' From 7661ddea2b518fa22d288fbf3b121be4cf7a808d Mon Sep 17 00:00:00 2001 From: summivox Date: Sat, 9 Jan 2016 15:28:17 -0500 Subject: [PATCH 3/3] `=>` and `|` should also be in syntax --- syntax/ls.vim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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\)\>/