Browse Source

new: [myc-update] set color mode for yaml in nano

nanoyaml
Boris Gallet 2 months ago
parent
commit
667f69838d
  1. 42
      bin/myc-update

42
bin/myc-update

@ -113,6 +113,48 @@ sed -ri 's/^# (export LS_OPTIONS=.--color=auto.)/\1/;
EOF
fi
if [ -d "/usr/share/nano" && ! -e "/usr/share/nano/yaml.nanorc" ]; then
Wrap -d "Enable colored yaml syntax in nano" <<EOF || exit 1
cat << 'EOF' > /usr/share/nano/yaml.nanorc
# Supports `YAML` files
syntax "YAML" "\.ya?ml$"
header "^(---|===)" "%YAML"
## Keys
color brightmagenta "^\s*[\$A-Za-z0-9_-]+\:"
color brightmagenta "^\s*@[\$A-Za-z0-9_-]+\:"
## Values
color yellow ":\s.+$"
## Booleans
icolor brightcyan " (y|yes|n|no|true|false|on|off)$"
## Numbers
color brightred " [[:digit:]]+(\.[[:digit:]]+)?"
## Arrays
color red "\[" "\]" ":\s+[|>]" "^\s*- "
## Reserved
color green "(^| )!!(binary|bool|float|int|map|null|omap|seq|set|str) "
## Comments
color cyan "#.*$"
## Errors
##color ,red ":\w.+$"
##color ,red ":'.+$"
##color ,red ":".+$"
##color ,red "\s+$"
## Non closed quote
color ,red "['\"][^['\"]]*$"
## Closed quotes
color yellow "['\"].*['\"]"
## Equal sign
color white ":( |$)"
EOF
EOF
fi
for keyfile in {/root,/home/debian}/.ssh/authorized_keys; do
[ -e "$keyfile" ] || continue

Loading…
Cancel
Save