From 3c9d7fb30c9bb5e7c5949f3162cee2164acb786d Mon Sep 17 00:00:00 2001 From: Camille Date: Sun, 15 May 2016 22:10:07 +0200 Subject: [PATCH] Improve fish syntax file. It now has a header, has more and better colors. --- runtime/syntax/fish.micro | 46 +++++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/runtime/syntax/fish.micro b/runtime/syntax/fish.micro index 560f4498..99cb7937 100644 --- a/runtime/syntax/fish.micro +++ b/runtime/syntax/fish.micro @@ -1,14 +1,36 @@ ## Here is an example for Fish shell scripts. ## -syntax "Fish" "\.fish$" -brightgreen (i) "^[0-9A-Z_]+\(\)" -color green "\<(alias|begin|break|case|continue|contains|else|end|for|function|if|math|return|set|switch|test|while)\>" -color green "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)" -color green "\<(and|isatty|not|or|in)\>" -color yellow "--[a-z-]+" -color brightmagenta "\ -[a-z]+" -color brightblue "\<(bg|bind|block|breakpoint|builtin|cd|command|commandline|complete|dirh|dirs|echo|emit|eval|exec|exit|fg|fish|fish_config|fish_ident|fish_pager|fish_prompt|fish_right_prompt|fish_update_completions|fishd|funced|funcsave|functions|help|history|jobs|mimedb|nextd|open|popd|prevd|psub|pushd|pwd|random|read|set_color|status|trap|type|ulimit|umask|vared)\>" -brightred (i) "\$\{?[0-9A-Z_!@#$*?-]+\}?" -color cyan "(^|[[:space:]])#.*$" -color brightyellow ""(\\.|[^"])*"" "'(\\.|[^'])*'" -color ,green "[[:space:]]+$" +syntax "fish" "\.fish$" +header "^#!.*/(env +)?fish( |$)" + +## Numbers +color brightcyan "\b[0-9]+\b" + +## Conditionals and control flow +color brightyellow "\b(and|begin|break|case|continue|else|end|for|function|if|not|or|return|select|shift|switch|while)\b" +color brightmagenta "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|^|!|=|&|\|)" + +## Fish commands +color green "\b(bg|bind|block|breakpoint|builtin|cd|count|command|commandline|complete|dirh|dirs|echo|emit|eval|exec|exit|fg|fish|fish_config|fish_ident|fish_pager|fish_prompt|fish_right_prompt|fish_update_completions|fishd|funced|funcsave|functions|help|history|jobs|math|mimedb|nextd|open|popd|prevd|psub|pushd|pwd|random|read|set|set_color|status|string|trap|type|ulimit|umask|vared)\b" + +## Common linux commands +color green "\b((g|ig)?awk|bash|dash|find|\w{0,4}grep|kill|killall|\w{0,4}less|make|pkill|sed|sh|tar)\b" + +## Coreutils commands +color green "\b(base64|basename|cat|chcon|chgrp|chmod|chown|chroot|cksum|comm|cp|csplit|cut|date|dd|df|dir|dircolors|dirname|du|env|expand|expr|factor|false|fmt|fold|head|hostid|id|install|join|link|ln|logname|ls|md5sum|mkdir|mkfifo|mknod|mktemp|mv|nice|nl|nohup|nproc|numfmt|od|paste|pathchk|pinky|pr|printenv|printf|ptx|pwd|readlink|realpath|rm|rmdir|runcon|seq|(sha1|sha224|sha256|sha384|sha512)sum|shred|shuf|sleep|sort|split|stat|stdbuf|stty|sum|sync|tac|tail|tee|test|time|timeout|touch|tr|true|truncate|tsort|tty|uname|unexpand|uniq|unlink|users|vdir|wc|who|whoami|yes)\b" + +## Conditional flags +color brightyellow "--[a-z-]+" +color brightyellow "\ -[a-z]+" + +## Strings +color brightcyan ""(\\.|[^"])*"" +color brightcyan "'(\\.|[^'])*'" +color brightmagenta """ +color brightmagenta "'" + +## Variables +color brightmagenta (i) "\$\{?[0-9A-Z_!@#$*?-]+\}?" + +## Comments +color brightblack "(^|[[:space:]])#.*$"