summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennard Hofmann <lennard.hofmann@web.de>2020-02-03 18:59:46 +0000
committerGitHub <noreply@github.com>2020-02-03 18:59:46 +0000
commit75bb796b2bc774992c48660ed7e5c8b28aef6d86 (patch)
tree56b1235b75f1a9b230841422c827426cab0d94ed
parentc6eb9bd8f0fd2f5f428fc66791f77546e49ae006 (diff)
[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.
-rw-r--r--rc/filetype/sh.kak3
1 files changed, 2 insertions, 1 deletions
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 ((?<![-:])\b\w+)= 1:variable
-add-highlighter shared/sh/code/function regex ^\h*(\w+)\h*\(\) 1:function
+add-highlighter shared/sh/code/alias regex \balias(\h+[-+]\w)*\h+([\w-.]+)= 2:variable
+add-highlighter shared/sh/code/function regex ^\h*(\S+)\h*\(\) 1:function
add-highlighter shared/sh/code/unscoped_expansion regex \$(\w+|#|@|\?|\$|!|-|\*) 0:value
add-highlighter shared/sh/double_string/expansion regex \$(\w+|\{.+?\}) 0:value