Skip to content

Instantly share code, notes, and snippets.

@xyproto
Last active April 9, 2020 10:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xyproto/378c0462e18567ace52b9e41872647b5 to your computer and use it in GitHub Desktop.
Save xyproto/378c0462e18567ace52b9e41872647b5 to your computer and use it in GitHub Desktop.
Configuration for the Nano editor - red/black theme

Alias for .bashrc or .zshrc:

sh alias nano="LC_ALL=en_US.UTF-8 nano --smarthome --autoindent --linenumbers --mouse --historylog --trimblanks --backupdir=$HOME/.backup --rcfile=$HOME/.config/nano/config --nohelp --tempfile"

# ~/.config/nano/config
set titlecolor white,black
set statuscolor red,black
set numbercolor black
set errorcolor yellow,black
set selectedcolor brightwhite,yellow
set stripecolor ,yellow
set keycolor red
set functioncolor red
## Here is an example for Bourne shell scripts.
syntax sh "(\.sh|(\.|/)(a|ba|c|da|k|mk|pdk|tc|z)sh(rc|_profile)?|/(etc/|\.)profile)$"
header "^#!.*/(((a|ba|c|da|k|mk|pdk|tc|z)?sh)|(busybox|env) +sh|openrc-run|runscript)"
magic "(POSIX|Bourne-Again) shell script.*text"
comment "#"
linter dash -n
# Function declarations.
color red "^[A-Za-z0-9_-]+\(\)"
# Keywords, symbols, and comparisons.
color red "\<(break|case|continue|do|done|elif|else|esac|exit|fi|for|function|if|in|read|return|select|shift|then|time|until|while)\>"
color red "\<(declare|eval|exec|export|let|local)\>"
color red "[{}():;|`$<>!=&\\]" "(\]|\[)"
color red "-(eq|ne|gt|lt|ge|le|ef|ot|nt)\>"
# Short and long options.
color white "[[:blank:]]-[A-Za-z]\>" "[[:blank:]]--[A-Za-z-]+\>"
# Common commands.
color red "\<(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 white "[.-]tar\>"
# Basic variable names (no braces).
color red "\$[-0-9@*#?$!]" "\$[[:alpha:]_][[:alnum:]_]*"
# More complicated variable names; handles braces and replacements and arrays.
color red "\$\{[#!]?([-@*#?$!]|[0-9]+|[[:alpha:]_][[:alnum:]_]*)(\[([[:space:]]*[[:alnum:]_]+[[:space:]]*|@)\])?(([#%/]|:?[-=?+])[^}]*\}|\[|\})"
# Strings
color red ""(\\.|[^"])*"" "'(\\.|[^'])*'"
# Comments
color black "(^|[[:space:]])#.*"
# Trailing whitespace
color ,red "[[:space:]]+$"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment