diff --git a/Readme.rst b/Readme.rst index eb42222..ce67085 100644 --- a/Readme.rst +++ b/Readme.rst @@ -55,3 +55,6 @@ my config file includes:: ## XML include "~/.nano/xml.nanorc" + ## Lua + include "~/.nano/lua.nanorc" + diff --git a/lua.nanorc b/lua.nanorc new file mode 100644 index 0000000..e41c8d4 --- /dev/null +++ b/lua.nanorc @@ -0,0 +1,72 @@ +############################################################################## +# +# Lua syntax highlighting for Nano. +# +# Author: Matthew Wild +# License: GPL 2 or later +# +# Version: 2007-06-06 +# +# Notes: Originally based on Ruby syntax rc by Josef 'Jupp' Schugt +############################################################################## + + +# Automatically use for '.lua' files +syntax "lua" ".*\.lua$" + +# General +color brightwhite ".+" + +# Operators +color brightyellow ":|\*\*|\*|/|%|\+|-|\^|>|>=|<|<=|~=|=|\.\.|\<(not|and|or)\>" + +# Statements +color brightblue "\<(do|end|while|repeat|until|if|elseif|then|else|for|in|function|local|return)\>" + +# Keywords +color brightyellow "\<(debug|string|math|table|io|coroutine|os)\>\." +color brightyellow "\<(_G|_VERSION|assert|collectgarbage|dofile|error|getfenv|getmetatable|ipairs|load|loadfile|module|next|pairs|pcall|print|rawequal|rawget|rawset|require|select|setfenv|setmetatable|tonumber|tostring|type|unpack|xpcall)\s*\(" + +# Standard library +color brightyellow "io\.\<(close|flush|input|lines|open|output|popen|read|tmpfile|type|write)\>" +color brightyellow "math\.\<(abs|acos|asin|atan2|atan|ceil|cosh|cos|deg|exp|floor|fmod|frexp|huge|ldexp|log10|log|max|min|modf|pi|pow|rad|random|randomseed|sinh|tan)\>" +color brightyellow "os\.\<(clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)\>" +color brightyellow "package\.\<(cpath|loaded|loadlib|path|preload|seeall)\>" +color brightyellow "string\.\<(byte|char|dump|find|format|gmatch|gsub|len|lower|match|rep|reverse|sub|upper)\>" +color brightyellow "table\.\<(concat|insert|maxn|remove|sort)\>" +color brightyellow "coroutine\.\<(create|resume|running|status|wrap|yield)\>" +color brightyellow "debug\.\<(debug|getfenv|gethook|getinfo|getlocal|getmetatable|getregistry|getupvalue|setfenv|sethook|setlocal|setmetatable|setupvalue|traceback)\>" + +# File handle methods +color brightyellow "\:\<(close|flush|lines|read|seek|setvbuf|write)\>" + +# false, nil, true +color brightmagenta "\<(false|nil|true)\>" + +# External files +color brightgreen "(\<(dofile|require|include)|%q|%!|%Q|%r|%x)\>" + +# Numbers +color red "\<([0-9]+)\>" + +# Symbols +color brightmagenta "(\(|\)|\[|\]|\{|\})" + +# Strings +#color green "\"(\\.|[^\\\"])*\"|'(\\.|[^\\'])*'" + +# Strings +color red "\"(\\.|[^\\\"])*\"|'(\\.|[^\\'])*'" + +# Escapes +color red "\\[0-7][0-7][0-7]|\\x[0-9a-fA-F][0-9a-fA-F]|\\[abefnrs]|(\\c|\\C-|\\M-|\\M-\\C-)." + + +# Shebang +color brightcyan "^#!.*" + +# Simple comments +color green "\-\-.*$" + +# Multiline comments +color green start="\-\-\[" end="]"