From b1822d25ae780563d5ea695a34eef82e205e7391 Mon Sep 17 00:00:00 2001 From: Eduard Veit Date: Mon, 20 Feb 2023 14:39:03 +0100 Subject: [PATCH] feature(nano): add initial config script --- nano-config.sh | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 nano-config.sh diff --git a/nano-config.sh b/nano-config.sh new file mode 100644 index 0000000..e0c0feb --- /dev/null +++ b/nano-config.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash + +# This script installs syntax highlighting only for shell scripts +# It is ment to be used on fresh Uberspaces + +mkdir ~/.nano +cat << 'end_of_content' > ~/.nano/sh.nanorc +## Syntax highlighting for Bourne shell scripts. +## UBERSPACE EDITION (compatible with nano 2.3.1) + +syntax "sh" "(\.sh|(\.|/)(a|ba|c|da|k|mk|pdk|tc|z)sh(rc|_profile)?|/(etc/|\.)profile)$" +header "^#!.*/((env\s+)?((a|ba|c|da|k|mk|pdk|tc|z)?sh)|busybox\s+sh|openrc-run|runscript)\>" +header "-\*-.*shell-script.*-\*-" +magic "(POSIX|Bourne-Again) shell script.*text" +#comment "#" + +#linter dash -n + +# Function declarations. +color brightgreen "^[A-Za-z0-9_-]+\(\)" + +# Keywords, symbols, and comparisons. +color green "\<(break|case|continue|do|done|elif|else|esac|exit|fi|for|function|if|in|read|return|select|shift|then|time|until|while)\>" +color green "\<(declare|eval|exec|export|let|local)\>" +color green "[{}():;|`$<>!=&\\]" "(\]|\[)" +color green "-(eq|ne|gt|lt|ge|le|ef|ot|nt)\>" + +# Short and long options. +color brightmagenta "[[:blank:]]-[A-Za-z]\>" "[[:blank:]]--[A-Za-z-]+\>" + +# Common commands. +color brightblue "\<(awk|cat|cd|ch(grp|mod|own)|cp|cut|echo|env|grep|head|install|ln|make|mkdir|mv|popd|printf|pushd|rm|rmdir|sed|set|sort|tail|tar|touch|umask|unset)\>" +#color normal "[.-]tar\>" + +# Basic variable names (no braces). +color brightred "\$[-0-9@*#?$!]" "\$[[:alpha:]_][[:alnum:]_]*" +# More complicated variable names; handles braces and replacements and arrays. +color brightred "\$\{[#!]?([-@*#?$!]|[0-9]+|[[:alpha:]_][[:alnum:]_]*)(\[([[:space:]]*[[:alnum:]_]+[[:space:]]*|@)\])?(([#%/]|:?[-=?+])[^}]*\}|\[|\})" + +# Comments. +color cyan "(^|[[:space:]])#.*" + +# Strings. +color brightyellow ""(\\.|[^"])*"" "'(\\.|[^'])*'" + +# Trailing whitespace. +color ,green "[[:space:]]+$" +end_of_content + +cat << end_of_content >> ~/.nanorc +include "~/.nano/sh.nanorc" +end_of_content \ No newline at end of file