
Code: Select all
context default
spellcheck
context linestart \t \n\n
keyword wholeright +() brightmagenta
keyword linestart \t\*\s*: brightcyan
keyword (*): cyan
keyword (*)\{\s\}[*]: cyan
context linestart \s\s\s\s\s\s\s\s \n\n
keyword wholeright +() brightmagenta
keyword \*\s*: brightcyan
keyword (*): cyan
keyword (*)\{\s\}[*]: cyan
keyword whole \* brightcyan
context linestart 19+-+\s \n yellow
keyword <+> brightred
context linestart 20+-+\s \n yellow
keyword <+> brightred
context linestart Mon\s \n yellow
keyword <+> brightred
context linestart Tue\s \n yellow
keyword <+> brightred
context linestart Wed\s \n yellow
keyword <+> brightred
context linestart Thu\s \n yellow
keyword <+> brightred
context linestart Fri\s \n yellow
keyword <+> brightred
context linestart Sat\s \n yellow
keyword <+> brightred
context linestart Sun\s \n yellow
keyword <+> brightredCode: Select all
context default
keyword linestart msgstr\s\"\"\n\n brightred
keyword linestart msgid brightcyan
keyword linestart msgstr brightcyan
context linestart #,\sfuzzy \n\n brightred
context linestart #: \n white
context linestart #, \n white
keyword c-format yellow
context linestart #~ \n red
context linestart # \n brown
spellcheck
context exclusive linestart msgid \n cyan
spellcheck
keyword \"\n\"
keyword \\" brightgreen
keyword \\\n brightgreen
keyword %% brightgreen
keyword %\[#0\s-\+,\]\[0123456789\]\[.\]\[0123456789\]\[L\]\{eEfgG\} brightgreen
keyword %\[0\s-\+,\]\[0123456789\]\[.\]\[0123456789\]\[hl\]\{diouxX\} brightgreen
keyword %\[hl\]n brightgreen
keyword %\[.\]\[0123456789\]s brightgreen
keyword %[*] brightgreen
keyword %c brightgreen
keyword \\\{0123\}\{01234567\}\{01234567\} brightgreen
keyword \\\\ brightgreen
keyword \\' brightgreen
keyword \\\{abtnvfr\} brightgreen
context exclusive linestart msgstr \n green
spellcheck
keyword \"\n\"
keyword \\" brightgreen
keyword \\\n brightgreen
keyword %% brightgreen
keyword %\[#0\s-\+,\]\[0123456789\]\[.\]\[0123456789\]\[L\]\{eEfgG\} brightgreen
keyword %\[0\s-\+,\]\[0123456789\]\[.\]\[0123456789\]\[hl\]\{diouxX\} brightgreen
keyword %\[hl\]n brightgreen
keyword %\[.\]\[0123456789\]s brightgreen
keyword %[*] brightgreen
keyword %c brightgreen
keyword \\\{0123\}\{01234567\}\{01234567\} brightgreen
keyword \\\\ brightgreen
keyword \\' brightgreen
keyword \\\{abtnvfr\} brightgreen


Code: Select all
## *.po file syntax
##
syntax "po" "\.po$"
color brightblue "\<(msgid|msgstr)\>"
color brightred "\/"
color green "#.*$"
color red "\<fuzzy\>"
color yellow "\<c-format\>"
color yellow "\""
color red "\"\""
color brightyellow "\"\\n\""
color brightmagenta "\<(Project\-Id\-Version|Report\-Msgid\-Bugs\-To|Last\-Translator|Language\-Team|charset)\>"
color cyan "\<(POT\-Creation\-Date|PO\-Revision\-Date|MIME\-Version|Content\-Type|Content\-Transfer\-Encoding)\>"
color yellow "\<(Copyright|(C))\>"
color yellow "[0-9]"
color brightyellow "\<(UTF|ISO|Windows|Mac|IBM)\>\-[0-9]"
color red "#~.*$"
Code: Select all
## Changelog file syntax
##
syntax "changelogs" "ChangeLog*"
color green "\+"
color red "\-"
color brightwhite "[0-9]"
color brightblue "[0-9][0-9]\:[0-9][0-9]\:[0-9][0-9]"
color blue "[0-9][0-9][0-9][0-9]\-[0-9][0-9]\-[0-9][0-9]"
color blue "[0-9][0-9][0-9][0-9]\/[0-9][0-9]\/[0-9][0-9]"
color blue "\<(CEST|CET|CST||CDT|EDT)\>"
color yellow "[0-9]\..*$"
color cyan "\*.*$"
color brightblue "\<(pre.*$|beta.*$|rc.*$|release.*$)\>"
color green "#.*$"
icolor brightred "^[[:space:]]*[.0-9A-Z_]*:"
color green "[[:space:]]*[.0-9A-Z_]*[[:space:]]*[.0-9A-Z_]*[[:space:]]<"
color brightyellow "<.*>$"
color brightwhite "commit[[:space:]]*[.0-9A-Z_]*$"

Code: Select all
#!/bin/bash
NANO="/usr/bin/nano"
for PARAM; do
if [[ -f $PARAM ]]; then
[[ ! $NANOFILE ]] && NANOFILE="${PARAM}" || exec $NANO "$@"
fi
done
case `file -b "${NANOFILE}"` in
*perl*"script text"* )
SYNTAX="--syntax perl"
;;
*python*"script text"* )
SYNTAX="--syntax python"
;;
*ruby*"script text"* )
SYNTAX="--syntax ruby"
;;
*PHP*"script text"* )
SYNTAX="--syntax php"
;;
*"script text"* )
SYNTAX="--syntax sh"
;;
*"diff output text"* )
SYNTAX="--syntax patch"
;;
*C*"program text"*)
SYNTAX="--syntax c"
;;
*"Java program text"* )
SYNTAX="--syntax java"
;;
*"HTML document text"* )
SYNTAX="--syntax html"
;;
esac
exec $NANO ${SYNTAX} "$@"
exitCode: Select all
## Here is an example for Python.
##
syntax "python" "\.py$"
header "^#!.*/python[-0-9._]*"
icolor brightblue "def [0-9A-Z_]+"
color brightcyan "\<(and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield)\>"
color brightgreen "['][^']*[^\\][']" "[']{3}.*[^\\][']{3}"
color brightgreen "["][^"]*[^\\]["]" "["]{3}.*[^\\]["]{3}"
color brightgreen start=""""[^"]" end=""""" start="'''[^']" end="'''"
color brightred "#.*$"
color ,green "[[:space:]]+$"Code: Select all
/etc/nanorcCode: Select all
## Color setup
##
## Format:
##
## syntax "short description" ["filename regex" ...]
##
## The "none" syntax is reserved; specifying it on the command line is
## the same as not having a syntax at all. The "default" syntax is
## special: it takes no filename regexes, and applies to files that
## don't match any other syntax's filename regexes.
##
## color foreground,background "regex" ["regex"...]
## or
## icolor foreground,background "regex" ["regex"...]
##
## "color" will do case sensitive matches, while "icolor" will do case
## insensitive matches.
##
## Valid colors: white, black, red, blue, green, yellow, magenta, cyan.
## For foreground colors, you may use the prefix "bright" to get a
## stronger highlight.
##
## To use multi-line regexes, use the start="regex" end="regex"
## [start="regex" end="regex"...] format.
##
## If your system supports transparency, not specifying a background
## color will use a transparent color. If you don't want this, be sure
## to set the background color to black or white.
##
## If you wish, you may put your syntaxes in separate files. You can
## make use of such files (which can only include "syntax", "color", and
## "icolor" commands) as follows:
##
## include "/path/to/syntax_file.nanorc"
##
## Unless otherwise noted, the name of the syntax file (without the
## ".nanorc" extension) should be the same as the "short description"
## name inside that file. These names are kept fairly short to make
## them easier to remember and faster to type using nano's -Y option.
##
## All regexes should be extended regular expressions.
## Key bindings
## Please see nanorc(5) for more details on this
##
## Here are some samples to get you going
##
# bind M-W nowrap main
# bind M-A casesens search
# bind ^S research main
## Set this if your backspace key sends delete most of the time (2.1.3+)
# bind kdel backspace all
## Nanorc files
# include "/usr/share/nano/nanorc.nanorc"
## C/C++
# include "/usr/share/nano/c.nanorc"
## Cascading Style Sheets
# include "/usr/share/nano/css.nanorc"
## Debian files
# include "/usr/share/nano/debian.nanorc"
## Gentoo files
# include "/usr/share/nano/gentoo.nanorc"
## HTML
# include "/usr/share/nano/html.nanorc"
## PHP
# include "/usr/share/nano/php.nanorc"
## TCL
# include "/usr/share/nano/tcl.nanorc"
## TeX
# include "/usr/share/nano/tex.nanorc"
## Quoted emails (under e.g. mutt)
# include "/usr/share/nano/mutt.nanorc"
## Patch files
# include "/usr/share/nano/patch.nanorc"
## Manpages
# include "/usr/share/nano/man.nanorc"
## Groff
# include "/usr/share/nano/groff.nanorc"
## Perl
# include "/usr/share/nano/perl.nanorc"
## Python
# include "/usr/share/nano/python.nanorc"
## Ruby
# include "/usr/share/nano/ruby.nanorc"
## Java
# include "/usr/share/nano/java.nanorc"
## AWK
# include "/usr/share/nano/awk.nanorc"
## Assembler
# include "/usr/share/nano/asm.nanorc"
## Bourne shell scripts
# include "/usr/share/nano/sh.nanorc"
## POV-Ray
# include "/usr/share/nano/pov.nanorc"
## XML-type files
# include "/usr/share/nano/xml.nanorc"
Code: Select all
## Here is an example for Bourne shell scripts.
##
syntax "bash" "\.sh$"
header "^#!.*/(ba|k|pdk)?sh[-0-9_]*"
icolor brightgreen "^[0-9A-Z_]+\(\)"
color green "\<(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)\>"
color green "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
color green "-[Ldefgruwx]\>"
color green "-(eq|ne|gt|lt|ge|le|s|n|z)\>"
color brightblue "\<(cat|cd|chmod|chown|cp|echo|env|export|grep|install|let|ln|make|mkdir|mv|rm|sed|set|tar|touch|umask|unset)\>"
color brightyellow ""(\\.|[^"])*""
icolor brightred "\$\{?[0-9A-Z_!@#$*?-]+\}?"
color brightyellow "'(\\.|[^'])*'"
color cyan "(^|[[:space:]])#.*$"
color ,green "[[:space:]]+$"I finally found. I had left gentoo syntax file twice in /etc/nanorc. Removing the second line enabled python syntax backeyoung100 wrote:A small pointer for all of you:
You may want to consider reading and then uncommentingCode: Select all
/etc/nanorc
Code: Select all
include "/usr/share/nano/nanorc.nanorc"
include "/usr/share/nano/c.nanorc"
include "/usr/share/nano/gentoo.nanorc" ## <-- first
include "/usr/share/nano/html.nanorc"
include "/usr/share/nano/patch.nanorc"
include "/usr/share/nano/perl.nanorc"
include "/usr/share/nano/python.nanorc"
include "/usr/share/nano/java.nanorc"
include "/usr/share/nano/gentoo.nanorc" ## <-- second
include "/usr/share/nano/sh.nanorc"
include "/usr/share/nano/xml.nanorc"
Code: Select all
color ,green "[[:space:]]+$"