From c6eb9bd8f0fd2f5f428fc66791f77546e49ae006 Mon Sep 17 00:00:00 2001 From: Lennard Hofmann Date: Mon, 3 Feb 2020 18:33:27 +0000 Subject: [PATCH 1/3] Fix #2832 --- rc/filetype/sh.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/sh.kak b/rc/filetype/sh.kak index 107d6372..47136952 100644 --- a/rc/filetype/sh.kak +++ b/rc/filetype/sh.kak @@ -55,7 +55,7 @@ evaluate-commands %sh{ } add-highlighter shared/sh/code/operators regex [\[\]\(\)&|]{1,2} 0:operator -add-highlighter shared/sh/code/variable regex ([\w-]+)= 1:variable +add-highlighter shared/sh/code/variable regex ((? Date: Mon, 3 Feb 2020 18:59:46 +0000 Subject: [PATCH 2/3] [sh] Allow more characters in aliases and function names Which characters are allowed? - Aliases: https://www.gnu.org/software/bash/manual/html_node/Aliases.html - Functions: https://unix.stackexchange.com/questions/245331/shell-valid-function-name-characters For aliases I chose [\w-.] instead of blacklisting many forbidden characters. For functions I chose \S. --- rc/filetype/sh.kak | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rc/filetype/sh.kak b/rc/filetype/sh.kak index 47136952..ca80ae1f 100644 --- a/rc/filetype/sh.kak +++ b/rc/filetype/sh.kak @@ -56,7 +56,8 @@ evaluate-commands %sh{ add-highlighter shared/sh/code/operators regex [\[\]\(\)&|]{1,2} 0:operator add-highlighter shared/sh/code/variable regex ((? Date: Mon, 3 Feb 2020 21:34:36 +0100 Subject: [PATCH 3/3] [sh] Do not highlight keywords if preceded/succeeded by a hyphen --- rc/filetype/sh.kak | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rc/filetype/sh.kak b/rc/filetype/sh.kak index ca80ae1f..f942066d 100644 --- a/rc/filetype/sh.kak +++ b/rc/filetype/sh.kak @@ -48,10 +48,10 @@ evaluate-commands %sh{ printf %s\\n "declare-option str-list sh_static_words $(join "${keywords}" ' ') $(join "${builtins}" ' ')" # Highlight keywords - printf %s\\n "add-highlighter shared/sh/code/ regex \b($(join "${keywords}" '|'))\b 0:keyword" + printf %s\\n "add-highlighter shared/sh/code/ regex (?