Add default colorscheme (based on solarized) and colorscheme support

This commit is contained in:
Zachary Yedidia
2016-03-21 16:02:58 -04:00
parent 11bc2cfbad
commit 7300ab66f7
38 changed files with 400 additions and 417 deletions

97
src/colorscheme.go Normal file
View File

@@ -0,0 +1,97 @@
package main
import (
"github.com/zyedidia/tcell"
"strings"
)
// The current colorscheme
var colorscheme map[string]tcell.Style
func InitColorscheme() {
colorscheme = DefaultColorscheme()
}
// DefaultColorscheme returns the default colorscheme
func DefaultColorscheme() map[string]tcell.Style {
c := make(map[string]tcell.Style)
c["comment"] = StringToStyle("brightgreen")
c["constant"] = StringToStyle("cyan")
c["identifier"] = StringToStyle("blue")
c["statement"] = StringToStyle("green")
c["preproc"] = StringToStyle("brightred")
c["type"] = StringToStyle("yellow")
c["special"] = StringToStyle("red")
c["underlined"] = StringToStyle("brightmagenta")
c["ignore"] = StringToStyle("")
c["error"] = StringToStyle("bold brightred")
c["todo"] = StringToStyle("bold brightmagenta")
return c
}
// StringToStyle returns a style from a string
func StringToStyle(str string) tcell.Style {
var fg string
var bg string
split := strings.Split(str, ",")
if len(split) > 1 {
fg, bg = split[0], split[1]
} else {
fg = split[0]
}
style := tcell.StyleDefault.Foreground(StringToColor(fg)).Background(StringToColor(bg))
if strings.Contains(str, "bold") {
style = style.Bold(true)
}
if strings.Contains(str, "blink") {
style = style.Blink(true)
}
if strings.Contains(str, "reverse") {
style = style.Reverse(true)
}
if strings.Contains(str, "underline") {
style = style.Underline(true)
}
return style
}
// StringToColor returns a tcell color from a string representation of a color
func StringToColor(str string) tcell.Color {
switch str {
case "black":
return tcell.ColorBlack
case "red":
return tcell.ColorMaroon
case "green":
return tcell.ColorGreen
case "yellow":
return tcell.ColorOlive
case "blue":
return tcell.ColorNavy
case "magenta":
return tcell.ColorPurple
case "cyan":
return tcell.ColorTeal
case "white":
return tcell.ColorSilver
case "brightblack":
return tcell.ColorGray
case "brightred":
return tcell.ColorRed
case "brightgreen":
return tcell.ColorLime
case "brightyellow":
return tcell.ColorYellow
case "brightblue":
return tcell.ColorBlue
case "brightmagenta":
return tcell.ColorFuchsia
case "brightcyan":
return tcell.ColorAqua
case "brightwhite":
return tcell.ColorWhite
default:
return tcell.ColorDefault
}
}

View File

@@ -33,6 +33,8 @@ func JoinRule(rule string) string {
// This involves finding the regex for syntax and if it exists, the regex
// for the header. Then we must get the text for the file and the filetype.
func LoadSyntaxFilesFromDir(dir string) {
InitColorscheme()
syntaxFiles = make(map[[2]*regexp.Regexp][2]string)
files, _ := ioutil.ReadDir(dir)
for _, f := range files {
@@ -156,7 +158,12 @@ func Match(rules string, buf *Buffer, v *View) map[int]tcell.Style {
// Error with the regex!
continue
}
st := StringToStyle(color)
st := tcell.StyleDefault
if _, ok := colorscheme[color]; ok {
st = colorscheme[color]
} else {
st = StringToStyle(color)
}
if regex.MatchString(str) {
indicies := regex.FindAllStringIndex(str, -1)
@@ -174,57 +181,3 @@ func Match(rules string, buf *Buffer, v *View) map[int]tcell.Style {
return m
}
// StringToStyle returns a style from a string
func StringToStyle(str string) tcell.Style {
var fg string
var bg string
split := strings.Split(str, ",")
if len(split) > 1 {
fg, bg = split[0], split[1]
} else {
fg = split[0]
}
return tcell.StyleDefault.Foreground(StringToColor(fg)).Background(StringToColor(bg))
}
// StringToColor returns a tcell color from a string representation of a color
func StringToColor(str string) tcell.Color {
switch str {
case "black":
return tcell.ColorBlack
case "red":
return tcell.ColorMaroon
case "green":
return tcell.ColorGreen
case "yellow":
return tcell.ColorOlive
case "blue":
return tcell.ColorNavy
case "magenta":
return tcell.ColorPurple
case "cyan":
return tcell.ColorTeal
case "white":
return tcell.ColorSilver
case "brightblack":
return tcell.ColorGray
case "brightred":
return tcell.ColorRed
case "brightgreen":
return tcell.ColorLime
case "brightyellow":
return tcell.ColorYellow
case "brightblue":
return tcell.ColorBlue
case "brightmagenta":
return tcell.ColorFuchsia
case "brightcyan":
return tcell.ColorAqua
case "brightwhite":
return tcell.ColorWhite
default:
return tcell.ColorDefault
}
}

View File

@@ -2,7 +2,7 @@
syntax "Dockerfile" "Dockerfile[^/]*$" "\.dockerfile$"
## Keywords
red (i) "^(FROM|MAINTAINER|RUN|CMD|LABEL|EXPOSE|ENV|ADD|COPY|ENTRYPOINT|VOLUME|USER|WORKDIR|ONBUILD)[[:space:]]"
color red (i) "^(FROM|MAINTAINER|RUN|CMD|LABEL|EXPOSE|ENV|ADD|COPY|ENTRYPOINT|VOLUME|USER|WORKDIR|ONBUILD)[[:space:]]"
## Brackets & parenthesis
color brightgreen "(\(|\)|\[|\])"
@@ -11,7 +11,7 @@ color brightgreen "(\(|\)|\[|\])"
color brightmagenta "&&"
## Comments
cyan (i) "^[[:space:]]*#.*$"
color cyan (i) "^[[:space:]]*#.*$"
## Blank space at EOL
color ,green "[[:space:]]+$"

View File

@@ -6,5 +6,6 @@ put them all in `~/.micro/syntax`.
They are taken from Nano, specifically from [this repository](https://github.com/scopatz/nanorc).
Micro syntax files are almost identical to Nano's, except for some key differences:
* Micro does not use `. Instead (i) use the case insensitive flag (`(i)`) in the regular expression
color color * Micro does not use `. Instead (i) use the case insensitive flag (`(i)`) in the regular expression
* Micro does not support `start="..." end="..."`, instead use the multiline match flag (`(s)`) and put `.*?` in the middle

View File

@@ -35,22 +35,22 @@ color brightred "\b[A-Z_][0-9A-Z_]+\b"
color green "\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\b"
## Constants
green (i) "\b(HIGH|LOW|INPUT|OUTPUT)\b"
color green (i) "\b(HIGH|LOW|INPUT|OUTPUT)\b"
## Serial Print
red (i) "\b(DEC|BIN|HEX|OCT|BYTE)\b"
color red (i) "\b(DEC|BIN|HEX|OCT|BYTE)\b"
## PI Constants
green (i) "\b(PI|HALF_PI|TWO_PI)\b"
color green (i) "\b(PI|HALF_PI|TWO_PI)\b"
## ShiftOut
green (i) "\b(LSBFIRST|MSBFIRST)\b"
color green (i) "\b(LSBFIRST|MSBFIRST)\b"
## Attach Interrupt
green (i) "\b(CHANGE|FALLING|RISING)\b"
color green (i) "\b(CHANGE|FALLING|RISING)\b"
## Analog Reference
green (i) "\b(DEFAULT|EXTERNAL|INTERNAL|INTERNAL1V1|INTERNAL2V56)\b"
color green (i) "\b(DEFAULT|EXTERNAL|INTERNAL|INTERNAL1V1|INTERNAL2V56)\b"
## === FUNCTIONS === ##
@@ -100,7 +100,7 @@ color brightmagenta "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\
## GCC builtins
color cyan "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
## String highlighting. You will in general want your comments and
## String highlighting. You will in general want your brightblacks and
## strings to come last, because syntax highlighting rules will be
## applied in the order they are read in.
color brightyellow "<[^= ]*>" ""(\\.|[^"])*""

View File

@@ -5,12 +5,12 @@ color red "\b[A-Z_]{2,}\b"
color brightgreen "\.(data|subsection|text)"
color green "\.(align|file|globl|global|hidden|section|size|type|weak)"
color brightyellow "\.(ascii|asciz|byte|double|float|hword|int|long|short|single|struct|word)"
brightred (i) "^[[:space:]]*[.0-9A-Z_]*:"
color brightred (i) "^[[:space:]]*[.0-9A-Z_]*:"
color brightcyan "^[[:space:]]*#[[:space:]]*(define|undef|include|ifn?def|endif|elif|else|if|warning|error)"
## Highlight strings (note: VERY resource intensive)
color brightyellow "<[^= ]*>" ""(\\.|[^"])*""
color brightyellow (s) ""(\\.|[^"])*\\[[:space:]]*$.*?^(\\.|[^"])*""
## Highlight comments
## Highlight brightblacks
color brightblue "//.*"
color brightblue (s) "/\*.*?\*/"
## Highlight trailing whitespace

View File

@@ -1,39 +1,39 @@
## Here is an example for C/C++.
##
syntax "C" "\.(c(c|pp|xx)?|C)$" "\.(h(h|pp|xx)?|H)$" "\.ii?$" "\.(def)$"
color brightred "\b[A-Z_][0-9A-Z_]+\b"
color green "\b(float|double|bool|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline)\b"
color green "\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\b"
color green "\b(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\b"
color green "\b(for|if|while|do|else|case|default|switch)\b"
color green "\b(try|throw|catch|operator|new|delete)\b"
color brightmagenta "\b(goto|continue|break|return)\b"
color brightcyan "^[[:space:]]*#[[:space:]]*(define|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
color identifier "\b[A-Z_][0-9A-Z_]+\b"
color type "\b(float|double|bool|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline)\b"
color type "\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\b"
color statement "\b(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\b"
color statement "\b(for|if|while|do|else|case|default|switch)\b"
color statement "\b(try|throw|catch|operator|new|delete)\b"
color statement "\b(goto|continue|break|return)\b"
color preproc "^[[:space:]]*#[[:space:]]*(define|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
color brightmagenta "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
##
## GCC builtins
color green "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
color statement "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
#Operator Color
color yellow "[.:;,+*|=!\%]" "<" ">" "/" "-" "&"
color statement "[.:;,+*|=!\%]" "<" ">" "/" "-" "&"
#Parenthetical Color
color magenta "[(){}]" "\[" "\]"
# color magenta "[(){}]" "\[" "\]"
##
## String highlighting. You will in general want your comments and
## String highlighting. You will in general want your brightblacks and
## strings to come last, because syntax highlighting rules will be
## applied in the order they are read in.
color cyan ""(\\.|[^"])*""
color constant ""(\\.|[^"])*""
##
## This string is VERY resource intensive!
#color cyan (s) ""(\\.|[^"])*\\[[:space:]]*$.*?^(\\.|[^"])*""
## Comment highlighting
color brightblue "//.*"
color brightblue (s) "/\*.*?\*/"
color comment "//.*"
color comment (s) "/\*.*?\*/"
## Trailing whitespace
#color ,green "[[:space:]]+$"

View File

@@ -2,14 +2,14 @@
##
syntax "CMake" "(CMakeLists\.txt|\.cmake)$"
green (i) "^[[:space:]]*[A-Z0-9_]+"
brightyellow (i) "^[[:space:]]*(include|include_directories|include_external_msproject)\b"
color green (i) "^[[:space:]]*[A-Z0-9_]+"
color brightyellow (i) "^[[:space:]]*(include|include_directories|include_external_msproject)\b"
brightgreen (i) "^[[:space:]]*\b((else|end)?if|else|(end)?while|(end)?foreach|break)\b"
color brightgreen (i) "^[[:space:]]*\b((else|end)?if|else|(end)?while|(end)?foreach|break)\b"
color brightgreen "\b(COPY|NOT|COMMAND|PROPERTY|POLICY|TARGET|EXISTS|IS_(DIRECTORY|ABSOLUTE)|DEFINED)\b[[:space:]]"
color brightgreen "[[:space:]]\b(OR|AND|IS_NEWER_THAN|MATCHES|(STR|VERSION_)?(LESS|GREATER|EQUAL))\b[[:space:]]"
brightred (i) "^[[:space:]]*\b((end)?(function|macro)|return)"
color brightred (i) "^[[:space:]]*\b((end)?(function|macro)|return)"
#String Color
color cyan "['][^']*[^\\][']" "[']{3}.*[^\\][']{3}"
@@ -18,6 +18,7 @@ color cyan "["][^"]*[^\\]["]" "["]{3}.*[^\\]["]{3}"
brightred (is) "\$(\{|ENV\{).*?\}"
color magenta "\b(APPLE|UNIX|WIN32|CYGWIN|BORLAND|MINGW|MSVC(_IDE|60|71|80|90)?)\b"
brightblue (i) "^([[:space:]]*)?#.*"
brightblue (i) "[[:space:]]#.*"
color brightblue (i) "^([[:space:]]*)?#.*"
color brightblue (i) "[[:space:]]#.*"

View File

@@ -3,8 +3,9 @@
syntax "Conf" "\.c[o]?nf$"
## Possible errors and parameters
## Strings
white (i) ""(\\.|[^"])*""
color white (i) ""(\\.|[^"])*""
## Comments
brightblue (i) "^[[:space:]]*#.*$"
cyan (i) "^[[:space:]]*##.*$"
color brightblue (i) "^[[:space:]]*#.*$"
color cyan (i) "^[[:space:]]*##.*$"

View File

@@ -11,7 +11,7 @@ color green "\b(alignment|append_file|background|border_inner_margin|border_oute
color yellow "\b(above|below|bottom_left|bottom_right|bottom_middle|desktop|dock|no|none|normal|override|skip_pager|skip_taskbar|sticky|top_left|top_right|top_middle|middle_left|middle_right|middle_middle|undecorated|yes)\b"
## Variables
color brightblue "\b(acpiacadapter|acpifan|acpitemp|addr|addrs|alignc|alignr|apcupsd|apcupsd_cable|apcupsd_charge|apcupsd_lastxfer|apcupsd_linev|apcupsd_load|apcupsd_loadbar|apcupsd_loadgauge|apcupsd_loadgraph|apcupsd_model|apcupsd_name|apcupsd_status|apcupsd_temp|apcupsd_timeleft|apcupsd_upsmode|apm_adapter|apm_battery_life|apm_battery_time|audacious_bar|audacious_bitrate|audacious_channels|audacious_filename|audacious_frequency|audacious_length|audacious_length_seconds|audacious_main_volume|audacious_playlist_length|audacious_playlist_position|audacious_position|audacious_position_seconds|audacious_status|audacious_title|battery|battery_bar|battery_percent|battery_short|battery_time|blink|bmpx_album|bmpx_artist|bmpx_bitrate|bmpx_title|bmpx_track|bmpx_uri|buffers|cached|cmdline_to_pid|color|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|combine|conky_build_arch|conky_build_date|conky_version|cpu|cpubar|cpugauge|cpugraph|curl|desktop|desktop_name|desktop_number|disk_protect|diskio|diskio_read|diskio_write|diskiograph|diskiograph_read|diskiograph_write|distribution|downspeed|downspeedf|downspeedgraph|draft_mails|else|endif|entropy_avail|entropy_bar|entropy_perc|entropy_poolsize|eval|eve|exec|execbar|execgauge|execgraph|execi|execibar|execigauge|execigraph|execp|execpi|flagged_mails|font|format_time|forwarded_mails|freq|freq_g|fs_bar|fs_bar_free|fs_free|fs_free_perc|fs_size|fs_type|fs_used|fs_used_perc|goto|gw_iface|gw_ip|hddtemp|head|hr|hwmon|i2c|i8k_ac_status|i8k_bios|i8k_buttons_status|i8k_cpu_temp|i8k_left_fan_rpm|i8k_left_fan_status|i8k_right_fan_rpm|i8k_right_fan_status|i8k_serial|i8k_version|ibm_brightness|ibm_fan|ibm_temps|ibm_volume|ical|iconv_start|iconv_stop|if_empty|if_existing|if_gw|if_match|if_mixer_mute|if_mounted|if_mpd_playing|if_running|if_smapi_bat_installed|if_up|if_updatenr|if_xmms2_connected|image|imap_messages|imap_unseen|ioscheduler|irc|kernel|laptop_mode|lines|loadavg|loadgraph|lua|lua_bar|lua_gauge|lua_graph|lua_parse|machine|mails|mboxscan|mem|memwithbuffers|membar|memwithbuffersbar|memeasyfree|memfree|memgauge|memgraph|memmax|memperc|mixer|mixerbar|mixerl|mixerlbar|mixerr|mixerrbar|moc_album|moc_artist|moc_bitrate|moc_curtime|moc_file|moc_rate|moc_song|moc_state|moc_timeleft|moc_title|moc_totaltime|monitor|monitor_number|mpd_album|mpd_artist|mpd_bar|mpd_bitrate|mpd_elapsed|mpd_file|mpd_length|mpd_name|mpd_percent|mpd_random|mpd_repeat|mpd_smart|mpd_status|mpd_title|mpd_track|mpd_vol|mysql|nameserver|new_mails|nodename|nodename_short|no_update|nvidia|obsd_product|obsd_sensors_fan|obsd_sensors_temp|obsd_sensors_volt|obsd_vendor|offset|outlinecolor|pb_battery|pid_chroot|pid_cmdline|pid_cwd|pid_environ|pid_environ_list|pid_exe|pid_nice|pid_openfiles|pid_parent|pid_priority|pid_state|pid_state_short|pid_stderr|pid_stdin|pid_stdout|pid_threads|pid_thread_list|pid_time_kernelmode|pid_time_usermode|pid_time|pid_uid|pid_euid|pid_suid|pid_fsuid|pid_gid|pid_egid|pid_sgid|pid_fsgid|pid_read|pid_vmpeak|pid_vmsize|pid_vmlck|pid_vmhwm|pid_vmrss|pid_vmdata|pid_vmstk|pid_vmexe|pid_vmlib|pid_vmpte|pid_write|platform|pop3_unseen|pop3_used|processes|read_tcp|read_udp|replied_mails|rss|running_processes|running_threads|scroll|seen_mails|shadecolor|smapi|smapi_bat_bar|smapi_bat_perc|smapi_bat_power|smapi_bat_temp|sony_fanspeed|stippled_hr|stock|swap|swapbar|swapfree|swapmax|swapperc|sysname|tab|tail|tcp_ping|tcp_portmon|template0|template1|template2|template3|template4|template5|template6|template7|template8|template9|texeci|texecpi|threads|time|to_bytes|top|top_io|top_mem|top_time|totaldown|totalup|trashed_mails|tztime|gid_name|uid_name|unflagged_mails|unforwarded_mails|unreplied_mails|unseen_mails|updates|upspeed|upspeedf|upspeedgraph|uptime|uptime_short|user_names|user_number|user_terms|user_times|user_time|utime|voffset|voltage_mv|voltage_v|weather|wireless_ap|wireless_bitrate|wireless_essid|wireless_link_bar|wireless_link_qual|wireless_link_qual_max|wireless_link_qual_perc|wireless_mode|words|xmms2_album|xmms2_artist|xmms2_bar|xmms2_bitrate|xmms2_comment|xmms2_date|xmms2_duration|xmms2_elapsed|xmms2_genre|xmms2_id|xmms2_percent|xmms2_playlist|xmms2_size|xmms2_smart|xmms2_status|xmms2_timesplayed|xmms2_title|xmms2_tracknr|xmms2_url)\b"
color brightblue "\b(acpiacadapter|acpifan|acpitemp|addr|addrs|alignc|alignr|apcupsd|apcupsd_cable|apcupsd_charge|apcupsd_lastxfer|apcupsd_linev|apcupsd_load|apcupsd_loadbar|apcupsd_loadgauge|apcupsd_loadgraph|apcupsd_model|apcupsd_name|apcupsd_status|apcupsd_temp|apcupsd_timeleft|apcupsd_upsmode|apm_adapter|apm_battery_life|apm_battery_time|audacious_bar|audacious_bitrate|audacious_channels|audacious_filename|audacious_frequency|audacious_length|audacious_length_seconds|audacious_main_volume|audacious_playlist_length|audacious_playlist_position|audacious_position|audacious_position_seconds|audacious_status|audacious_title|battery|battery_bar|battery_percent|battery_short|battery_time|blink|bmpx_album|bmpx_artist|bmpx_bitrate|bmpx_title|bmpx_track|bmpx_uri|buffers|cached|cmdline_to_pid|color|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|combine|conky_build_arch|conky_build_date|conky_version|cpu|cpubar|cpugauge|cpugraph|curl|desktop|desktop_name|desktop_number|disk_protect|diskio|diskio_read|diskio_write|diskiograph|diskiograph_read|diskiograph_write|distribution|downspeed|downspeedf|downspeedgraph|draft_mails|else|endif|entropy_avail|entropy_bar|entropy_perc|entropy_poolsize|eval|eve|exec|execbar|execgauge|execgraph|execi|execibar|execigauge|execigraph|execp|execpi|flagged_mails|font|format_time|forwarded_mails|freq|freq_g|fs_bar|fs_bar_free|fs_free|fs_free_perc|fs_size|fs_type|fs_used|fs_used_perc|goto|gw_iface|gw_ip|hddtemp|head|hr|hwmon|i2c|i8k_ac_status|i8k_bios|i8k_buttons_status|i8k_cpu_temp|i8k_left_fan_rpm|i8k_left_fan_status|i8k_right_fan_rpm|i8k_right_fan_status|i8k_serial|i8k_version|ibm_brightness|ibm_fan|ibm_temps|ibm_volume|ical|iconv_start|iconv_stop|if_empty|if_existing|if_gw|if_match|if_mixer_mute|if_mounted|if_mpd_playing|if_running|if_smapi_bat_installed|if_up|if_updatenr|if_xmms2_connected|image|imap_messages|imap_unseen|ioscheduler|irc|kernel|laptop_mode|lines|loadavg|loadgraph|lua|lua_bar|lua_gauge|lua_graph|lua_parse|machine|mails|mboxscan|mem|memwithbuffers|membar|memwithbuffersbar|memeasyfree|memfree|memgauge|memgraph|memmax|memperc|mixer|mixerbar|mixerl|mixerlbar|mixerr|mixerrbar|moc_album|moc_artist|moc_bitrate|moc_curtime|moc_file|moc_rate|moc_song|moc_state|moc_timeleft|moc_title|moc_totaltime|monitor|monitor_number|mpd_album|mpd_artist|mpd_bar|mpd_bitrate|mpd_elapsed|mpd_file|mpd_length|mpd_name|mpd_percent|mpd_random|mpd_repeat|mpd_smart|mpd_status|mpd_title|mpd_track|mpd_vol|mysql|nameserver|new_mails|nodename|nodename_short|no_update|nvidia|obsd_product|obsd_sensors_fan|obsd_sensors_temp|obsd_sensors_volt|obsd_vendor|offset|outlinecolor|pb_battery|pid_chroot|pid_cmdline|pid_cwd|pid_environ|pid_environ_list|pid_exe|pid_nice|pid_openfiles|pid_parent|pid_priority|pid_state|pid_state_short|pid_stderr|pid_stdin|pid_stdout|pid_threads|pid_thread_list|pid_time_kernelmode|pid_time_usermode|pid_time|pid_uid|pid_euid|pid_suid|pid_fsuid|pid_gid|pid_egid|pid_sgid|pid_fsgid|pid_read|pid_vmpeak|pid_vmsize|pid_vmlck|pid_vmhwm|pid_vmrss|pid_vmdata|pid_vmstk|pid_vmexe|pid_vmlib|pid_vmpte|pid_write|platform|pop3_unseen|pop3_used|processes|read_tcp|read_udp|replied_mails|rss|running_processes|running_threads|scroll|seen_mails|shadecolor|smapi|smapi_bat_bar|smapi_bat_perc|smapi_bat_power|smapi_bat_temp|sony_fanspeed|stippled_hr|stock|swap|swapbar|swapfree|swapmax|swapperc|sysname|tab|tail|tcp_ping|tcp_portmon|template0|template1|template2|template3|template4|template5|template6|template7|template8|template9|texeci|texecpi|threads|time|to_bytes|top|top_io|top_mem|top_time|totaldown|totalup|trashed_mails|tztime|gid_name|uid_name|unflagged_mails|unforwarded_mails|unreplied_mails|unseen_mails|updates|upspeed|upspeedf|upspeedgraph|uptime|uptime_short|user_names|user_number|user_terms|user_times|user_time|utime|voffset|voltage_mv|voltage_v|weather|wireless_ap|wireless_bitrate|wireless_essid|wireless_link_bar|wireless_link_qual|wireless_link_qual_max|wireless_link_qual_perc|wireless_mode|words|xmms2_album|xmms2_artist|xmms2_bar|xmms2_bitrate|xmms2_brightblack|xmms2_date|xmms2_duration|xmms2_elapsed|xmms2_genre|xmms2_id|xmms2_percent|xmms2_playlist|xmms2_size|xmms2_smart|xmms2_status|xmms2_timesplayed|xmms2_title|xmms2_tracknr|xmms2_url)\b"
color brightblue "\$\{?[0-9A-Z_!@#$*?-]+\}?"
color cyan "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"

View File

@@ -1,9 +1,9 @@
## Cython nanorc, based off of Python nanorc.
##
syntax "Cython" "\.pyx$" "\.pxd$" "\.pyi$"
brightred (i) "def [ 0-9A-Z_]+"
brightred (i) "cpdef [0-9A-Z_]+\(.*\):"
brightred (i) "cdef cppclass [ 0-9A-Z_]+\(.*\):"
color brightred (i) "def [ 0-9A-Z_]+"
color brightred (i) "cpdef [0-9A-Z_]+\(.*\):"
color brightred (i) "cdef cppclass [ 0-9A-Z_]+\(.*\):"

View File

@@ -6,82 +6,78 @@
syntax "D" "\.(d(i|d)?)$"
## Operators and punctuation
color green "(\*|/|%|\+|-|>>|<<|>>>|&|\^(\^)?|\||~)?="
color green "\.\.(\.)?|!|\*|&|~|\(|\)|\[|\]|\\|/|\+|-|%|<|>|\?|:|;"
color statement "(\*|/|%|\+|-|>>|<<|>>>|&|\^(\^)?|\||~)?="
color statement "\.\.(\.)?|!|\*|&|~|\(|\)|\[|\]|\\|/|\+|-|%|<|>|\?|:|;"
## Octal integer literals are deprecated
color ,red "(0[0-7_]*)(L[uU]?|[uU]L?)?"
color error "(0[0-7_]*)(L[uU]?|[uU]L?)?"
## Decimal integer literals
color brightyellow "([0-9]|[1-9][0-9_]*)(L[uU]?|[uU]L?)?"
color constant "([0-9]|[1-9][0-9_]*)(L[uU]?|[uU]L?)?"
## Binary integer literals
color brightgreen "(0[bB][01_]*)(L[uU]?|[uU]L?)?"
color constant "(0[bB][01_]*)(L[uU]?|[uU]L?)?"
## Decimal float literals
color brightblue "[0-9][0-9_]*\.([0-9][0-9_]*)([eE][+-]?([0-9][0-9_]*))?[fFL]?i?"
color brightblue "[0-9][0-9_]*([eE][+-]?([0-9][0-9_]*))[fFL]?i?"
color brightblue "[^.]\.([0-9][0-9_]*)([eE][+-]?([0-9][0-9_]*))?[fFL]?i?"
color brightblue "[0-9][0-9_]*([fFL]?i|[fF])"
color constant "[0-9][0-9_]*\.([0-9][0-9_]*)([eE][+-]?([0-9][0-9_]*))?[fFL]?i?"
color constant "[0-9][0-9_]*([eE][+-]?([0-9][0-9_]*))[fFL]?i?"
color constant "[^.]\.([0-9][0-9_]*)([eE][+-]?([0-9][0-9_]*))?[fFL]?i?"
color constant "[0-9][0-9_]*([fFL]?i|[fF])"
## Hexadecimal integer literals
color brightcyan "(0[xX]([0-9a-fA-F][0-9a-fA-F_]*|[0-9a-fA-F_]*[0-9a-fA-F]))(L[uU]?|[uU]L?)?"
color constant "(0[xX]([0-9a-fA-F][0-9a-fA-F_]*|[0-9a-fA-F_]*[0-9a-fA-F]))(L[uU]?|[uU]L?)?"
## Hexadecimal float literals
color blue "0[xX]([0-9a-fA-F][0-9a-fA-F_]*|[0-9a-fA-F_]*[0-9a-fA-F])(\.[0-9a-fA-F][0-9a-fA-F_]*|[0-9a-fA-F_]*[0-9a-fA-F])?[pP][+-]?([0-9][0-9_]*)[fFL]?i?"
color blue "0[xX]\.([0-9a-fA-F][0-9a-fA-F_]*|[0-9a-fA-F_]*[0-9a-fA-F])[pP][+-]?([0-9][0-9_]*)[fFL]?i?"
color constant "0[xX]([0-9a-fA-F][0-9a-fA-F_]*|[0-9a-fA-F_]*[0-9a-fA-F])(\.[0-9a-fA-F][0-9a-fA-F_]*|[0-9a-fA-F_]*[0-9a-fA-F])?[pP][+-]?([0-9][0-9_]*)[fFL]?i?"
color constant "0[xX]\.([0-9a-fA-F][0-9a-fA-F_]*|[0-9a-fA-F_]*[0-9a-fA-F])[pP][+-]?([0-9][0-9_]*)[fFL]?i?"
## Character literals
color brightmagenta "'([^\']|\\(['"?\abfnrtv]|x[[:xdigit:]]{2}|[0-7]{1,3}|u[[:xdigit:]]{4}|U[[:xdigit:]]{8}|&.*;))'"
color constant "'([^\']|\\(['"?\abfnrtv]|x[[:xdigit:]]{2}|[0-7]{1,3}|u[[:xdigit:]]{4}|U[[:xdigit:]]{8}|&.*;))'"
## Keywords
## a-e
color brightwhite "\b(abstract|alias|align|asm|assert|auto|body|break|case|cast|catch|class|const|continue|debug|default|delegate|do|else|enum|export|extern)\b"
color statement "\b(abstract|alias|align|asm|assert|auto|body|break|case|cast|catch|class|const|continue|debug|default|delegate|do|else|enum|export|extern)\b"
## f-l
color brightwhite "\b(false|final|finally|for|foreach|foreach_reverse|function|goto|if|immutable|import|in|inout|interface|invariant|is|lazy)\b"
color statement "\b(false|final|finally|for|foreach|foreach_reverse|function|goto|if|immutable|import|in|inout|interface|invariant|is|lazy)\b"
## m-r
color brightwhite "\b(macro|mixin|module|new|nothrow|null|out|override|package|pragma|private|protected|public|pure|ref|return)\b"
color statement "\b(macro|mixin|module|new|nothrow|null|out|override|package|pragma|private|protected|public|pure|ref|return)\b"
## s-w
color brightwhite "\b(scope|shared|static|struct|super|switch|synchronized|template|this|throw|true|try|typeid|typeof|union|unittest|version|while|with)\b"
color statement "\b(scope|shared|static|struct|super|switch|synchronized|template|this|throw|true|try|typeid|typeof|union|unittest|version|while|with)\b"
## __
color brightwhite "\b(__FILE__|__MODULE__|__LINE__|__FUNCTION__|__PRETTY_FUNCTION__|__gshared|__traits|__vector|__parameters)\b"
color statement "\b(__FILE__|__MODULE__|__LINE__|__FUNCTION__|__PRETTY_FUNCTION__|__gshared|__traits|__vector|__parameters)\b"
## Deprecated keywords
color ,red "\b(delete|deprecated|typedef|volatile)\b"
color error "\b(delete|deprecated|typedef|volatile)\b"
## Primitive types
color cyan "\b(bool|byte|cdouble|cent|cfloat|char|creal|dchar|double|float|idouble|ifloat|int|ireal|long|real|short|ubyte|ucent|uint|ulong|ushort|void|wchar)\b"
color type "\b(bool|byte|cdouble|cent|cfloat|char|creal|dchar|double|float|idouble|ifloat|int|ireal|long|real|short|ubyte|ucent|uint|ulong|ushort|void|wchar)\b"
## Globally defined symbols
color cyan "\b(string|wstring|dstring|size_t|ptrdiff_t)\b"
color type "\b(string|wstring|dstring|size_t|ptrdiff_t)\b"
## Special tokens
color ,blue "\b(__DATE__|__EOF__|__TIME__|__TIMESTAMP__|__VENDOR__|__VERSION__)\b"
## Special directives, etc.
color magenta "\\s *#\\s *"
color constant "\b(__DATE__|__EOF__|__TIME__|__TIMESTAMP__|__VENDOR__|__VERSION__)\b"
## String literals
## TODO: multiline backtick and doublequote string. (Unlikely possible at all with nano.)
### DoubleQuotedString
color yellow ""(\\.|[^"])*""
color constant ""(\\.|[^"])*""
### WysiwygString
color yellow (s) "r".*?""
color yellow "`[^`]*`"
color constant (s) "r".*?""
color constant "`[^`]*`"
### HexString
color ,yellow "x"([[:space:]]*[[:xdigit:]][[:space:]]*[[:xdigit:]])*[[:space:]]*""
color ,constant "x"([[:space:]]*[[:xdigit:]][[:space:]]*[[:xdigit:]])*[[:space:]]*""
### DelimitedString
color yellow "q"\(.*\)""
color yellow "q"\{.*\}""
color yellow "q"\[.*\]""
color yellow "q"<.*>""
color yellow (s) "q"[^({[<"][^"]*$.*?^[^"]+""
color yellow "q"([^({[<"]).*\1""
color constant "q"\(.*\)""
color constant "q"\{.*\}""
color constant "q"\[.*\]""
color constant "q"<.*>""
color constant (s) "q"[^({[<"][^"]*$.*?^[^"]+""
color constant "q"([^({[<"]).*\1""
### TokenString
### True token strings require nesting, so, again, they can't be implemented accurately here.
@@ -89,11 +85,7 @@ color yellow "q"([^({[<"]).*\1""
## color ,magenta (s) "q\{.*?\}"
## Comments
## NB: true nested comments are impossible to implement with plain regex
color brightblack "//.*"
color brightblack (s) "/\*.*?\*/"
color brightblack (s) "/\+.*?\+/"
## Trailing whitespace
color ,green "^[[:space:]]+$"
## NB: true nested brightblacks are impossible to implement with plain regex
color comment "//.*"
color comment (s) "/\*.*?\*/"
color comment (s) "/\+.*?\+/"

View File

@@ -10,7 +10,7 @@ color white (s) "<%.*?%>"
color red "&[^;[[:space:]]]*;"
color yellow "\b(BEGIN|END|alias|and|begin|break|case|class|def|defined\?|do|else|elsif|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\b"
color brightblue "(\$|@|@@)?\b[A-Z]+[0-9A-Z_a-z]*"
magenta (i) "([ ]|^):[0-9A-Z_]+\b"
color magenta (i) "([ ]|^):[0-9A-Z_]+\b"
color brightyellow "\b(__FILE__|__LINE__)\b"
color brightmagenta "!/([^/]|(\\/))*/[iomx]*" "%r\{([^}]|(\\}))*\}[iomx]*"
color brightblue "`[^`]*`" "%x\{[^}]*\}"

View File

@@ -1,14 +1,14 @@
## Here is an example for Fish shell scripts.
##
syntax "Fish" "\.fish$"
brightgreen (i) "^[0-9A-Z_]+\(\)"
color brightgreen (i) "^[0-9A-Z_]+\(\)"
color green "\b(alias|begin|break|case|continue|contains|else|end|for|function|if|math|return|set|switch|test|while)\b"
color green "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
color green "\b(and|isatty|not|or|in)\b"
color yellow "--[a-z-]+"
color brightmagenta "\ -[a-z]+"
color brightblue "\b(bg|bind|block|breakpoint|builtin|cd|command|commandline|complete|dirh|dirs|echo|emit|eval|exec|exit|fg|fish|fish_config|fish_ident|fish_pager|fish_prompt|fish_right_prompt|fish_update_completions|fishd|funced|funcsave|functions|help|history|jobs|mimedb|nextd|open|popd|prevd|psub|pushd|pwd|random|read|set_color|status|trap|type|ulimit|umask|vared)\b"
brightred (i) "\$\{?[0-9A-Z_!@#$*?-]+\}?"
color brightred (i) "\$\{?[0-9A-Z_!@#$*?-]+\}?"
color cyan "(^|[[:space:]])#.*$"
color brightyellow ""(\\.|[^"])*"" "'(\\.|[^'])*'"
color ,green "[[:space:]]+$"

View File

@@ -5,33 +5,33 @@ syntax "Fortran" "\.([Ff]|[Ff]90|[Ff]95|[Ff][Oo][Rr])$"
#color red "\b[A-Z_]a[0-9A-Z_]+\b"
color red "\b[0-9]+\b"
green (i) "\b(action|advance|all|allocatable|allocated|any|apostrophe)\b"
green (i) "\b(append|asis|assign|assignment|associated|character|common)\b"
green (i) "\b(complex|data|default|delim|dimension|double precision)\b"
green (i) "\b(elemental|epsilon|external|file|fmt|form|format|huge)\b"
green (i) "\b(implicit|include|index|inquire|integer|intent|interface)\b"
green (i) "\b(intrinsic|iostat|kind|logical|module|none|null|only)\b"
green (i) "\b(operator|optional|pack|parameter|pointer|position|private)\b"
green (i) "\b(program|public|real|recl|recursive|selected_int_kind)\b"
green (i) "\b(selected_real_kind|subroutine|status)\b"
color green (i) "\b(action|advance|all|allocatable|allocated|any|apostrophe)\b"
color green (i) "\b(append|asis|assign|assignment|associated|character|common)\b"
color green (i) "\b(complex|data|default|delim|dimension|double precision)\b"
color green (i) "\b(elemental|epsilon|external|file|fmt|form|format|huge)\b"
color green (i) "\b(implicit|include|index|inquire|integer|intent|interface)\b"
color green (i) "\b(intrinsic|iostat|kind|logical|module|none|null|only)\b"
color green (i) "\b(operator|optional|pack|parameter|pointer|position|private)\b"
color green (i) "\b(program|public|real|recl|recursive|selected_int_kind)\b"
color green (i) "\b(selected_real_kind|subroutine|status)\b"
cyan (i) "\b(abs|achar|adjustl|adjustr|allocate|bit_size|call|char)\b"
cyan (i) "\b(close|contains|count|cpu_time|cshift|date_and_time)\b"
cyan (i) "\b(deallocate|digits|dot_product|eor|eoshift|function|iachar)\b"
cyan (i) "\b(iand|ibclr|ibits|ibset|ichar|ieor|iolength|ior|ishft|ishftc)\b"
cyan (i) "\b(lbound|len|len_trim|matmul|maxexponent|maxloc|maxval|merge)\b"
cyan (i) "\b(minexponent|minloc|minval|mvbits|namelist|nearest|nullify)\b"
cyan (i) "\b(open|pad|present|print|product|pure|quote|radix)\b"
cyan (i) "\b(random_number|random_seed|range|read|readwrite|replace)\b"
cyan (i) "\b(reshape|rewind|save|scan|sequence|shape|sign|size|spacing)\b"
cyan (i) "\b(spread|sum|system_clock|target|transfer|transpose|trim)\b"
cyan (i) "\b(ubound|unpack|verify|write|tiny|type|use|yes)\b"
color cyan (i) "\b(abs|achar|adjustl|adjustr|allocate|bit_size|call|char)\b"
color cyan (i) "\b(close|contains|count|cpu_time|cshift|date_and_time)\b"
color cyan (i) "\b(deallocate|digits|dot_product|eor|eoshift|function|iachar)\b"
color cyan (i) "\b(iand|ibclr|ibits|ibset|ichar|ieor|iolength|ior|ishft|ishftc)\b"
color cyan (i) "\b(lbound|len|len_trim|matmul|maxexponent|maxloc|maxval|merge)\b"
color cyan (i) "\b(minexponent|minloc|minval|mvbits|namelist|nearest|nullify)\b"
color cyan (i) "\b(open|pad|present|print|product|pure|quote|radix)\b"
color cyan (i) "\b(random_number|random_seed|range|read|readwrite|replace)\b"
color cyan (i) "\b(reshape|rewind|save|scan|sequence|shape|sign|size|spacing)\b"
color cyan (i) "\b(spread|sum|system_clock|target|transfer|transpose|trim)\b"
color cyan (i) "\b(ubound|unpack|verify|write|tiny|type|use|yes)\b"
yellow (i) "\b(.and.|case|do|else|else?if|else?where|end|end?do|end?if)\b"
yellow (i) "\b(end?select|.eqv.|forall|if|lge|lgt|lle|llt|.neqv.|.not.)\b"
yellow (i) "\b(.or.|repeat|select case|then|where|while)\b"
color yellow (i) "\b(.and.|case|do|else|else?if|else?where|end|end?do|end?if)\b"
color yellow (i) "\b(end?select|.eqv.|forall|if|lge|lgt|lle|llt|.neqv.|.not.)\b"
color yellow (i) "\b(.or.|repeat|select case|then|where|while)\b"
magenta (i) "\b(continue|cycle|exit|go?to|result|return)\b"
color magenta (i) "\b(continue|cycle|exit|go?to|result|return)\b"
#Operator Color
color yellow "[.:;,+*|=!\%]" "<" ">" "/" "-" "&"
@@ -43,9 +43,10 @@ color magenta "[(){}]" "\[" "\]"
color brightcyan "^[[:space:]]*#[[:space:]]*(define|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
## String highlighting.
cyan (i) "<[^= ]*>" ""(\\.|[^"])*""
cyan (i) "<[^= ]*>" "'(\\.|[^"])*'"
color cyan (i) "<[^= ]*>" ""(\\.|[^"])*""
color cyan (i) "<[^= ]*>" "'(\\.|[^"])*'"
## Comment highlighting
brightred (i) "!.*$" "(^[Cc]| [Cc]) .*$"
color brightred (i) "!.*$" "(^[Cc]| [Cc]) .*$"

View File

@@ -22,7 +22,7 @@ color brightblue "prepall(docs|info|man|strip)" "prep(info|lib|lib\.(so|a)|man|s
color brightblue "\b(doc|ins|exe)into\b" "\bf(owners|perms)\b" "\b(exe|ins|dir)opts\b"
## Highlight common commands used in ebuilds
color blue "\bmake\b" "\b(cat|cd|chmod|chown|cp|echo|env|export|grep|let|ln|mkdir|mv|rm|sed|set|tar|touch|unset)\b"
## Highlight comments (doesnt work that well)
## Highlight brightblacks (doesnt work that well)
color yellow "#.*$"
## Highlight strings (doesnt work that well)
color brightyellow ""(\\.|[^\"])*"" "'(\\.|[^'])*'"

View File

@@ -1,22 +1,20 @@
syntax "Go" "\.go$"
color brightblue "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[()]"
color brightblue "\b(append|cap|close|complex|copy|delete|imag|len)\b"
color brightblue "\b(make|new|panic|print|println|protect|real|recover)\b"
color green "\b(u?int(8|16|32|64)?|float(32|64)|complex(64|128))\b"
color green "\b(uintptr|byte|rune|string|interface|bool|map|chan|error)\b"
color cyan "\b(package|import|const|var|type|struct|func|go|defer|nil|iota)\b"
color cyan "\b(for|range|if|else|case|default|switch|return)\b"
color brightred "\b(go|goto|break|continue)\b"
color brightcyan "\b(true|false)\b"
color red "[-+/*=<>!~%&|^]|:="
color blue "\b([0-9]+|0x[0-9a-fA-F]*)\b|'.'"
color yellow ""(\\.|[^"])*"|'(\\.|[^'])*'"
color magenta "\\[abfnrtv'\"\\]"
color magenta "\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
color yellow "`[^`]*`"
color brightblack "(^|[[:space:]])//.*"
color green (s) "/\*.*?\*/"
color brightwhite,cyan "TODO:?"
color ,green "[[:space:]]+$"
color ,red " + +| + +"
color identifier "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[()]"
color statement "\b(append|cap|close|complex|copy|delete|imag|len)\b"
color statement "\b(make|new|panic|print|println|protect|real|recover)\b"
color type "\b(u?int(8|16|32|64)?|float(32|64)|complex(64|128))\b"
color type "\b(uintptr|byte|rune|string|interface|bool|map|chan|error)\b"
color statement "\b(package|import|const|var|type|struct|func|go|defer|nil|iota)\b"
color statement "\b(for|range|if|else|case|default|switch|return)\b"
color statement "\b(go|goto|break|continue)\b"
color constant "\b(true|false)\b"
color statement "[-+/*=<>!~%&|^]|:="
color constant "\b([0-9]+|0x[0-9a-fA-F]*)\b|'.'"
color constant ""(\\.|[^"])*"|'(\\.|[^'])*'"
color constant "\\[abfnrtv'\"\\]"
color constant "\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
color constant "`[^`]*`"
color comment "(^|[[:space:]])//.*"
color comment (s) "/\*.*?\*/"
color todo "TODO:?"

View File

@@ -2,9 +2,9 @@ syntax "Haml" "\.haml$"
color cyan "-|="
color white "->|=>"
cyan (i) "([ ]|^)%[0-9A-Z_]+\b"
magenta (i) ":[0-9A-Z_]+\b"
yellow (i) "\.[A-Z_]+\b"
color cyan (i) "([ ]|^)%[0-9A-Z_]+\b"
color magenta (i) ":[0-9A-Z_]+\b"
color yellow (i) "\.[A-Z_]+\b"
## Double quote & single quote
color green ""([^"]|(\\"))*"" "%[QW]?\{[^}]*\}" "%[QW]?\([^)]*\)" "%[QW]?<[^>]*>" "%[QW]?\$[^$]*\$" "%[QW]?\^[^^]*\^" "%[QW]?![^!]*!"
color green "'([^']|(\\'))*'" "%[qw]\{[^}]*\}" "%[qw]\([^)]*\)" "%[qw]<[^>]*>" "%[qw]\[[^]]*\]" "%[qw]\$[^$]*\$" "%[qw]\^[^^]*\^" "%[qw]![^!]*!"

View File

@@ -1,7 +1,7 @@
## Here is a short improved example for HTML.
##
syntax "HTML" "\.htm[l]?$"
color brightblue (s) "<.*?>"
color red "&[^;[[:space:]]]*;"
color yellow ""[^"]*"|qq\|.*\|"
color red "(alt|bgcolor|height|href|label|longdesc|name|onclick|onfocus|onload|onmouseover|size|span|src|style|target|type|value|width)="
color identifier (s) "<.*?>"
color special "&[^;[[:space:]]]*;"
color constant ""[^"]*"|qq\|.*\|"
color statement "(alt|bgcolor|height|href|label|longdesc|name|onclick|onfocus|onload|onmouseover|size|span|src|style|target|type|value|width)="

View File

@@ -1,13 +1,11 @@
## Here is an example for Java.
##
syntax "Java" "\.java$"
color green "\b(boolean|byte|char|double|float|int|long|new|short|this|transient|void)\b"
color red "\b(break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while)\b"
color cyan "\b(abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\b"
color red ""[^"]*""
color yellow "\b(true|false|null)\b"
color blue "//.*"
color blue (s) "/\*.*?\*/"
color brightblue (s) "/\*\*.*?\*/"
color ,green "[[:space:]]+$"
color type "\b(boolean|byte|char|double|float|int|long|new|short|this|transient|void)\b"
color statement "\b(break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while)\b"
color type "\b(abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\b"
color constant ""[^"]*""
color constant "\b(true|false|null)\b"
color comment "//.*"
color comment (s) "/\*.*?\*/"
color comment (s) "/\*\*.*?\*/"

View File

@@ -4,19 +4,17 @@ color blue "\b[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\
color blue "\b[-+]?([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?"
color blue "\b[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?"
color brightblue "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]"
color cyan "\b(break|case|catch|continue|default|delete|do|else|finally)\b"
color cyan "\b(for|function|get|if|in|instanceof|new|return|set|switch)\b"
color cyan "\b(switch|this|throw|try|typeof|var|void|while|with)\b"
color cyan "\b(null|undefined|NaN)\b"
color brightcyan "\b(true|false)\b"
color green "\b(Array|Boolean|Date|Enumerator|Error|Function|Math)\b"
color green "\b(Number|Object|RegExp|String)\b"
color red "[-+/*=<>!~%?:&|]"
color magenta "/[^*]([^/]|(\\/))*[^\\]/[gim]*"
color magenta "\\[0-7][0-7]?[0-7]?|\\x[0-9a-fA-F]+|\\[bfnrt'"\?\\]"
color brightblack "(^|[[:space:]])//.*"
color brightblack "/\*.+\*/"
color brightwhite,cyan "TODO:?"
color yellow ""(\\.|[^"])*"|'(\\.|[^'])*'"
color ,green "[[:space:]]+$"
color ,red " + +| + +"
color statement "\b(break|case|catch|continue|default|delete|do|else|finally)\b"
color statement "\b(for|function|get|if|in|instanceof|new|return|set|switch)\b"
color statement "\b(switch|this|throw|try|typeof|var|void|while|with)\b"
color constant "\b(null|undefined|NaN)\b"
color constant "\b(true|false)\b"
color type "\b(Array|Boolean|Date|Enumerator|Error|Function|Math)\b"
color type "\b(Number|Object|RegExp|String)\b"
color statement "[-+/*=<>!~%?:&|]"
color constant "/[^*]([^/]|(\\/))*[^\\]/[gim]*"
color constant "\\[0-7][0-7]?[0-7]?|\\x[0-9a-fA-F]+|\\[bfnrt'"\?\\]"
color comment "(^|[[:space:]])//.*"
color comment "/\*.+\*/"
color todo "TODO:?"
color constant ""(\\.|[^"])*"|'(\\.|[^'])*'"

View File

@@ -1,47 +0,0 @@
### all *js files ( e.g. Firefox user.js, prefs.js )
## Old version
#syntax "JavaScript" "(\.|/|)js$"
#color green "//.*$" (s) "\/\*.*?\*\/"
#color blue "'(\\.|[^'])*'"
#color red ""(\\.|[^\"])*""
#color brightgreen "\b(true)\b"
#color brightred "\b(false)\b" "http\:\/\/.*$"
#color brightmagenta "[0-9](\\.|[^\"])*)"
## New updated taken from http://wiki.linuxhelp.net/index.php/Nano_Syntax_Highlighting
syntax "JavaScript" "\.(js)$"
## Default
color white "^.+$"
## Decimal, cotal and hexadecimal numbers
color yellow "\b[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\b"
## Floating point number with at least one digit before decimal point
color yellow "\b[-+]?([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?"
color yellow "\b[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?"
## Keywords
color green "\b(break|case|catch|continue|default|delete|do|else|finally)\b"
color green "\b(for|function|if|in|instanceof|new|null|return|switch)\b"
color green "\b(switch|this|throw|try|typeof|undefined|var|void|while|with)\b"
## Type specifiers
color red "\b(Array|Boolean|Date|Enumerator|Error|Function|Math)\b"
color red "\b(Number|Object|RegExp|String)\b"
color red "\b(true|false)\b"
## String
color brightyellow "L?\"(\\"|[^"])*\""
color brightyellow "L?'(\'|[^'])*'"
## Escapes
color red "\\[0-7][0-7]?[0-7]?|\\x[0-9a-fA-F]+|\\[bfnrt'"\?\\]"
## Comments
color brightblue (s) "/\*.*?\*/"
color brightblue "//.*$"

View File

@@ -3,7 +3,7 @@ syntax "Lisp" "(emacs|zile)$" "\.(el|li?sp|scm|ss)$"
color brightblue "\([a-z-]+"
color red "\(([-+*/<>]|<=|>=)|'"
color blue "\b[0-9]+\b"
cyan (i) "\bnil\b"
color cyan (i) "\bnil\b"
color brightcyan "\b[tT]\b"
color yellow "\"(\\.|[^"])*\""
color magenta "'[A-Za-z][A-Za-z0-9_-]+"

View File

@@ -14,61 +14,58 @@
# Automatically use for '.lua' files
syntax "Lua" ".*\.lua$"
# General
color brightwhite ".+"
# Operators
color brightyellow ":|\*\*|\*|/|%|\+|-|\^|>|>=|<|<=|~=|=|\.\.|\b(not|and|or)\b"
color statement ":|\*\*|\*|/|%|\+|-|\^|>|>=|<|<=|~=|=|\.\.|\b(not|and|or)\b"
# Statements
color brightblue "\b(do|end|while|repeat|until|if|elseif|then|else|for|in|function|local|return)\b"
color statement "\b(do|end|while|repeat|until|if|elseif|then|else|for|in|function|local|return)\b"
# Keywords
color brightyellow "\b(debug|string|math|table|io|coroutine|os|utf8|bit32)\b\."
color brightyellow "\b(_ENV|_G|_VERSION|assert|collectgarbage|dofile|error|getfenv|getmetatable|ipairs|load|loadfile|module|next|pairs|pcall|print|rawequal|rawget|rawlen|rawset|require|select|setfenv|setmetatable|tonumber|tostring|type|unpack|xpcall)\s*\("
color statement "\b(debug|string|math|table|io|coroutine|os|utf8|bit32)\b\."
color statement "\b(_ENV|_G|_VERSION|assert|collectgarbage|dofile|error|getfenv|getmetatable|ipairs|load|loadfile|module|next|pairs|pcall|print|rawequal|rawget|rawlen|rawset|require|select|setfenv|setmetatable|tonumber|tostring|type|unpack|xpcall)\s*\("
# Standard library
color brightyellow "io\.\b(close|flush|input|lines|open|output|popen|read|tmpfile|type|write)\b"
color brightyellow "math\.\b(abs|acos|asin|atan2|atan|ceil|cosh|cos|deg|exp|floor|fmod|frexp|huge|ldexp|log10|log|max|maxinteger|min|mininteger|modf|pi|pow|rad|random|randomseed|sinh|sqrt|tan|tointeger|type|ult)\b"
color brightyellow "os\.\b(clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)\b"
color brightyellow "package\.\b(config|cpath|loaded|loadlib|path|preload|seeall|searchers|searchpath)\b"
color brightyellow "string\.\b(byte|char|dump|find|format|gmatch|gsub|len|lower|match|pack|packsize|rep|reverse|sub|unpack|upper)\b"
color brightyellow "table\.\b(concat|insert|maxn|move|pack|remove|sort|unpack)\b"
color brightyellow "utf8\.\b(char|charpattern|codes|codepoint|len|offset)\b"
color brightyellow "coroutine\.\b(create|isyieldable|resume|running|status|wrap|yield)\b"
color brightyellow "debug\.\b(debug|getfenv|gethook|getinfo|getlocal|getmetatable|getregistry|getupvalue|getuservalue|setfenv|sethook|setlocal|setmetatable|setupvalue|setuservalue|traceback|upvalueid|upvaluejoin)\b"
color brightyellow "bit32\.\b(arshift|band|bnot|bor|btest|bxor|extract|replace|lrotate|lshift|rrotate|rshift)\b"
color identifier "io\.\b(close|flush|input|lines|open|output|popen|read|tmpfile|type|write)\b"
color identifier "math\.\b(abs|acos|asin|atan2|atan|ceil|cosh|cos|deg|exp|floor|fmod|frexp|huge|ldexp|log10|log|max|maxinteger|min|mininteger|modf|pi|pow|rad|random|randomseed|sinh|sqrt|tan|tointeger|type|ult)\b"
color identifier "os\.\b(clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)\b"
color identifier "package\.\b(config|cpath|loaded|loadlib|path|preload|seeall|searchers|searchpath)\b"
color identifier "string\.\b(byte|char|dump|find|format|gmatch|gsub|len|lower|match|pack|packsize|rep|reverse|sub|unpack|upper)\b"
color identifier "table\.\b(concat|insert|maxn|move|pack|remove|sort|unpack)\b"
color identifier "utf8\.\b(char|charpattern|codes|codepoint|len|offset)\b"
color identifier "coroutine\.\b(create|isyieldable|resume|running|status|wrap|yield)\b"
color identifier "debug\.\b(debug|getfenv|gethook|getinfo|getlocal|getmetatable|getregistry|getupvalue|getuservalue|setfenv|sethook|setlocal|setmetatable|setupvalue|setuservalue|traceback|upvalueid|upvaluejoin)\b"
color identifier "bit32\.\b(arshift|band|bnot|bor|btest|bxor|extract|replace|lrotate|lshift|rrotate|rshift)\b"
# File handle methods
color brightyellow "\:\b(close|flush|lines|read|seek|setvbuf|write)\b"
color identifier "\:\b(close|flush|lines|read|seek|setvbuf|write)\b"
# false, nil, true
color brightmagenta "\b(false|nil|true)\b"
color constant "\b(false|nil|true)\b"
# External files
color brightgreen "(\b(dofile|require|include)|%q|%!|%Q|%r|%x)\b"
color statement "(\b(dofile|require|include)|%q|%!|%Q|%r|%x)\b"
# Numbers
color red "\b([0-9]+)\b"
color constant "\b([0-9]+)\b"
# Symbols
color brightmagenta "(\(|\)|\[|\]|\{|\})"
color statement "(\(|\)|\[|\]|\{|\})"
# Strings
color red "\"(\\.|[^\\\"])*\"|'(\\.|[^\\'])*'"
color constant "\"(\\.|[^\\\"])*\"|'(\\.|[^\\'])*'"
# Multiline strings
color red (s) "\s*\[\[.*?\]\]"
color constant (s) "\s*\[\[.*?\]\]"
# Escapes
color red "\\[0-7][0-7][0-7]|\\x[0-9a-fA-F][0-9a-fA-F]|\\[abefnrs]|(\\c|\\C-|\\M-|\\M-\\C-)."
color special "\\[0-7][0-7][0-7]|\\x[0-9a-fA-F][0-9a-fA-F]|\\[abefnrs]|(\\c|\\C-|\\M-|\\M-\\C-)."
# Shebang
color brightcyan "^#!.*"
color comment "^#!.*"
# Simple comments
color green "\-\-.*$"
# Simple brightblacks
color comment "\-\-.*$"
# Multiline comments
color green (s) "\s*\-\-\s*\[\[.*?\]\]"
# Multiline brightblacks
color comment (s) "\s*\-\-\s*\[\[.*?\]\]"

View File

@@ -2,16 +2,17 @@
##
syntax "Nanorc" "\.?nanorc$"
## Possible errors and parameters
brightwhite (i) "^[[:space:]]*((un)?set|include|syntax|i?color).*$"
color brightwhite (i) "^[[:space:]]*((un)?set|include|syntax|i?color).*$"
## Keywords
brightgreen (i) "^[[:space:]]*(set|unset)[[:space:]]+(autoindent|backup|backupdir|backwards|boldtext|brackets|casesensitive|const|cut|fill|historylog|matchbrackets|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|operatingdir|preserve|punct)\b" "^[[:space:]]*(set|unset)[[:space:]]+(quickblank|quotestr|rebinddelete|rebindkeypad|regexp|smarthome|smooth|speller|suspend|tabsize|tabstospaces|tempfile|undo|view|whitespace|wordbounds)\b"
green (i) "^[[:space:]]*(set|unset|include|syntax|header)\b"
color brightgreen (i) "^[[:space:]]*(set|unset)[[:space:]]+(autoindent|backup|backupdir|backwards|boldtext|brackets|casesensitive|const|cut|fill|historylog|matchbrackets|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|operatingdir|preserve|punct)\b" "^[[:space:]]*(set|unset)[[:space:]]+(quickblank|quotestr|rebinddelete|rebindkeypad|regexp|smarthome|smooth|speller|suspend|tabsize|tabstospaces|tempfile|undo|view|whitespace|wordbounds)\b"
color green (i) "^[[:space:]]*(set|unset|include|syntax|header)\b"
## Colors
yellow (i) "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\b"
magenta (i) "^[[:space:]]*i?color\b" "\b(start|end)="
color yellow (i) "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\b"
color magenta (i) "^[[:space:]]*i?color\b" "\b(start|end)="
## Strings
white (i) ""(\\.|[^"])*""
color white (i) ""(\\.|[^"])*""
## Comments
brightblue (i) "^[[:space:]]*#.*$"
cyan (i) "^[[:space:]]*##.*$"
color brightblue (i) "^[[:space:]]*#.*$"
color cyan (i) "^[[:space:]]*##.*$"

View File

@@ -19,7 +19,7 @@ color green "\b(true|false)\b"
color green "\b(include|inherit|initializer)\b"
#expr modifiers
color yellow "\b(new|ref|mutable|lazy|assert|raise)\b"
#comments
#brightblacks
color white (s) "\(\*.*?\*\)"
#strings (no multiline handling yet)
color brightblack ""[^\"]*""

View File

@@ -36,6 +36,6 @@ color red "(<\?(php)?|\?>)"
color red (s) "\?>.*?<\?(php|=)?"
# trailing whitespace
color ,green "[^[:space:]]{1}[[:space:]]+$"
# multi-line comments
# multi-line brightblacks
color brightyellow (s) "/\*.*?\*/"

View File

@@ -4,43 +4,43 @@ syntax "Python" "\.py$"
header "^#!.*/(env +)?python( |$)"
## built-in objects
color cyan "\b(None|self|True|False)\b"
color constant "\b(None|self|True|False)\b"
## built-in attributes
color cyan "\b(__builtin__|__dict__|__methods__|__members__|__class__|__bases__|__import__|__name__|__doc__|__self__|__debug__)\b"
color constant "\b(__builtin__|__dict__|__methods__|__members__|__class__|__bases__|__import__|__name__|__doc__|__self__|__debug__)\b"
## built-in functions
color cyan "\b(abs|append|apply|buffer|callable|chr|clear|close|closed|cmp|coerce|compile|complex|conjugate|copy|count|delattr|dir|divmod|eval|execfile|extend|fileno|filter|float|flush|get|getattr|globals|has_key|hasattr|hash|hex|id|index|input|insert|int|intern|isatty|isinstance|issubclass|items|keys|len|list|locals|long|map|max|min|mode|name|oct|open|ord|pop|pow|range|raw_input|read|readline|readlines|reduce|reload|remove|repr|reverse|round|seek|setattr|slice|softspace|sort|str|tell|truncate|tuple|type|unichr|unicode|update|values|vars|write|writelines|xrange|zip)\b"
color identifier "\b(abs|append|apply|buffer|callable|chr|clear|close|closed|cmp|coerce|compile|complex|conjugate|copy|count|delattr|dir|divmod|eval|execfile|extend|fileno|filter|float|flush|get|getattr|globals|has_key|hasattr|hash|hex|id|index|input|insert|int|intern|isatty|isinstance|issubclass|items|keys|len|list|locals|long|map|max|min|mode|name|oct|open|ord|pop|pow|range|raw_input|read|readline|readlines|reduce|reload|remove|repr|reverse|round|seek|setattr|slice|softspace|sort|str|tell|truncate|tuple|type|unichr|unicode|update|values|vars|write|writelines|xrange|zip)\b"
## special method names
color cyan "\b(__abs__|__add__|__and__|__call__|__cmp__|__coerce__|__complex__|__concat__|__contains__|__del__|__delattr__|__delitem__|__delslice__|__div__|__divmod__|__float__|__getattr__|__getitem__|__getslice__|__hash__|__hex__|__init__|__int__|__inv__|__invert__|__len__|__long__|__lshift__|__mod__|__mul__|__neg__|__nonzero__|__oct__|__or__|__pos__|__pow__|__radd__|__rand__|__rcmp__|__rdiv__|__rdivmod__|__repeat__|__repr__|__rlshift__|__rmod__|__rmul__|__ror__|__rpow__|__rrshift__|__rshift__|__rsub__|__rxor__|__setattr__|__setitem__|__setslice__|__str__|__sub__|__xor__)\b"
color identifier "\b(__abs__|__add__|__and__|__call__|__cmp__|__coerce__|__complex__|__concat__|__contains__|__del__|__delattr__|__delitem__|__delslice__|__div__|__divmod__|__float__|__getattr__|__getitem__|__getslice__|__hash__|__hex__|__init__|__int__|__inv__|__invert__|__len__|__long__|__lshift__|__mod__|__mul__|__neg__|__nonzero__|__oct__|__or__|__pos__|__pow__|__radd__|__rand__|__rcmp__|__rdiv__|__rdivmod__|__repeat__|__repr__|__rlshift__|__rmod__|__rmul__|__ror__|__rpow__|__rrshift__|__rshift__|__rsub__|__rxor__|__setattr__|__setitem__|__setslice__|__str__|__sub__|__xor__)\b"
## exception classes
# color cyan "\b(Exception|StandardError|ArithmeticError|LookupError|EnvironmentError|AssertionError|AttributeError|EOFError|FloatingPointError|IOError|ImportError|IndexError|KeyError|KeyboardInterrupt|MemoryError|NameError|NotImplementedError|OSError|OverflowError|RuntimeError|SyntaxError|SystemError|SystemExit|TypeError|UnboundLocalError|UnicodeError|ValueError|WindowsError|ZeroDivisionError)\b"
## types
color brightcyan "\b(NoneType|TypeType|IntType|LongType|FloatType|ComplexType|StringType|UnicodeType|BufferType|TupleType|ListType|DictType|FunctionType|LambdaType|CodeType|ClassType|UnboundMethodType|InstanceType|MethodType|BuiltinFunctionType|BuiltinMethodType|ModuleType|FileType|XRangeType|TracebackType|FrameType|SliceType|EllipsisType)\b"
color type "\b(NoneType|TypeType|IntType|LongType|FloatType|ComplexType|StringType|UnicodeType|BufferType|TupleType|ListType|DictType|FunctionType|LambdaType|CodeType|ClassType|UnboundMethodType|InstanceType|MethodType|BuiltinFunctionType|BuiltinMethodType|ModuleType|FileType|XRangeType|TracebackType|FrameType|SliceType|EllipsisType)\b"
## definitions
color brightcyan "def [a-zA-Z_0-9]+"
color identifier "def [a-zA-Z_0-9]+"
## keywords
color brightblue "\b(and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|map|not|or|pass|print|raise|return|try|with|while|yield)\b"
color statement "\b(and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|map|not|or|pass|print|raise|return|try|with|while|yield)\b"
## decorators
color brightgreen "@.*[(]"
## operators
color magenta "[.:;,+*|=!\%@]" "<" ">" "/" "-" "&"
color statement "[.:;,+*|=!\%@]" "<" ">" "/" "-" "&"
## parentheses
color magenta "[(){}]" "\[" "\]"
color statement "[(){}]" "\[" "\]"
## numbers
color brightyellow "\b[0-9]+\b"
color constant "\b[0-9]+\b"
## strings
color yellow "['][^']*[^\\][']" "[']{3}.*[^\\][']{3}"
color yellow "["][^"]*[^\\]["]" "["]{3}.*[^\\]["]{3}"
color constant "['][^']*[^\\][']" "[']{3}.*[^\\][']{3}"
color constant "["][^"]*[^\\]["]" "["]{3}.*[^\\]["]{3}"
## comments
color green "#.*$"
## brightblacks
color comment "#.*$"
## block comments
color green (s) """"([^"]|$).*?"""" (s) "'''([^']|$).*?'''"
## block brightblacks
color comment (s) """"([^"]|$).*?"""" (s) "'''([^']|$).*?'''"
#color cyan (s) """"[^"].*?"""" (s) "'''[^'].*?'''"
#color cyan (s) "([[:space:]]"""|^""").*?"""" (s) "'''[^'].*?'''"
#color cyan (s) """".*?"""" (s) "'''.*?'''"

View File

@@ -10,7 +10,7 @@ color brightred "::"
color blue "`[^`]+`_{1,2}"
# code
color yellow "``[^`]+``"
# directives or comments
# directives or brightblacks
color cyan "^\.\. .*$"
# anon link targets
color cyan "^__ .*$"

View File

@@ -4,30 +4,30 @@ syntax "Ruby" "\.rb$" "Gemfile" "config.ru" "Rakefile" "Capfile" "Vagrantfile"
header "^#!.*/(env +)?ruby( |$)"
## Asciibetical list of reserved words
color yellow "\b(BEGIN|END|alias|and|begin|break|case|class|def|defined\?|do|else|elsif|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\b"
color statement "\b(BEGIN|END|alias|and|begin|break|case|class|def|defined\?|do|else|elsif|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\b"
## Constants
color brightblue "(\$|@|@@)?\b[A-Z]+[0-9A-Z_a-z]*"
color constant "(\$|@|@@)?\b[A-Z]+[0-9A-Z_a-z]*"
## Ruby "symbols"
magenta (i) "([ ]|^):[0-9A-Z_]+\b"
color constant (i) "([ ]|^):[0-9A-Z_]+\b"
## Some unique things we want to stand out
color brightyellow "\b(__FILE__|__LINE__)\b"
color constant "\b(__FILE__|__LINE__)\b"
## Regular expressions
color brightmagenta "/([^/]|(\\/))*/[iomx]*" "%r\{([^}]|(\\}))*\}[iomx]*"
color constant "/([^/]|(\\/))*/[iomx]*" "%r\{([^}]|(\\}))*\}[iomx]*"
## Shell command expansion is in `backticks` or like %x{this}. These are
## "double-quotish" (to use a perlism).
color brightblue "`[^`]*`" "%x\{[^}]*\}"
color constant "`[^`]*`" "%x\{[^}]*\}"
## Strings, double-quoted
color green ""([^"]|(\\"))*"" "%[QW]?\{[^}]*\}" "%[QW]?\([^)]*\)" "%[QW]?<[^>]*>" "%[QW]?\[[^]]*\]" "%[QW]?\$[^$]*\$" "%[QW]?\^[^^]*\^" "%[QW]?![^!]*!"
color constant ""([^"]|(\\"))*"" "%[QW]?\{[^}]*\}" "%[QW]?\([^)]*\)" "%[QW]?<[^>]*>" "%[QW]?\[[^]]*\]" "%[QW]?\$[^$]*\$" "%[QW]?\^[^^]*\^" "%[QW]?![^!]*!"
## Expression substitution. These go inside double-quoted strings,
## "like #{this}".
color brightgreen "#\{[^}]*\}"
color special "#\{[^}]*\}"
## Strings, single-quoted
color green "'([^']|(\\'))*'" "%[qw]\{[^}]*\}" "%[qw]\([^)]*\)" "%[qw]<[^>]*>" "%[qw]\[[^]]*\]" "%[qw]\$[^$]*\$" "%[qw]\^[^^]*\^" "%[qw]![^!]*!"
color constant "'([^']|(\\'))*'" "%[qw]\{[^}]*\}" "%[qw]\([^)]*\)" "%[qw]<[^>]*>" "%[qw]\[[^]]*\]" "%[qw]\$[^$]*\$" "%[qw]\^[^^]*\^" "%[qw]![^!]*!"
## Comments
color cyan "#[^{].*$" "#$"
color brightcyan "##[^{].*$" "##$"
color comment "#[^{].*$" "#$"
color comment "##[^{].*$" "##$"
## "Here" docs
color green (s) "<<-?'?EOT'?.*?^EOT"
color constant (s) "<<-?'?EOT'?.*?^EOT"
## Some common markers
color brightcyan "(XXX|TODO|FIXME|\?\?\?)"
color todo "(XXX|TODO|FIXME|\?\?\?)"

View File

@@ -5,32 +5,32 @@
syntax "Rust" "\.rs"
# function definition
color magenta "fn [a-z0-9_]+"
color identifier "fn [a-z0-9_]+"
# Reserved words
color yellow "\b(abstract|alignof|as|become|box|break|const|continue|crate|do|else|enum|extern|false|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|offsetof|override|priv|pub|pure|ref|return|sizeof|static|self|struct|super|true|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\b"
color statement "\b(abstract|alignof|as|become|box|break|const|continue|crate|do|else|enum|extern|false|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|offsetof|override|priv|pub|pure|ref|return|sizeof|static|self|struct|super|true|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\b"
# macros
color red "[a-z_]+!"
color special "[a-z_]+!"
# Constants
color magenta "[A-Z][A-Z_]+"
color constant "[A-Z][A-Z_]+"
# Traits/Enums/Structs/Types/etc.
color magenta "[A-Z][a-z]+"
color type "[A-Z][a-z]+"
# Strings
color green "\".*\""
color green (s) "\".*\\$.*?.*\""
color constant "\".*\""
color constant (s) "\".*?\""
# NOTE: This isn't accurate but matching "#{0,} for the end of the string is too liberal
color green (s) "r#+\".*?\"#+"
color constant (s) "r#+\".*?\"#+"
# Comments
color blue "//.*"
color blue (s) "/\*.*?\*/"
color comment "//.*"
color comment (s) "/\*.*?\*/"
# Attributes
color magenta (s) "#!\[.*?\]"
color special (s) "#!\[.*?\]"
# Some common markers
color brightcyan "(XXX|TODO|FIXME|\?\?\?)"
color todo "(XXX|TODO|FIXME|\?\?\?)"

View File

@@ -3,13 +3,13 @@
syntax "SH" "\.sh$" "\.bash" "\.bashrc" "bashrc" "\.bash_aliases" "bash_aliases" "\.bash_functions" "bash_functions" "\.bash_profile" "bash_profile"
header "^#!.*/(env +)?(ba)?sh( |$)"
color green "\b(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)\b"
color green "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
color green "-[Ldefgruwx]\b"
color green "-(eq|ne|gt|lt|ge|le|s|n|z)\b"
color brightblue "\b(cat|cd|chmod|chown|cp|echo|env|export|grep|install|let|ln|make|mkdir|mv|rm|sed|set|tar|touch|umask|unset)\b"
brightgreen (i) "^\s+[0-9A-Z_]+\s+\(\)"
brightred (i) "\$\{?[0-9A-Z_!@#$*?-]+\}?"
color brightyellow ""(\\.|[^"])*"" "'(\\.|[^'])*'"
color cyan "(^|[[:space:]])#.*$"
color statement "\b(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)\b"
color special "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
color special "-[Ldefgruwx]\b"
color statement "-(eq|ne|gt|lt|ge|le|s|n|z)\b"
color statement "\b(cat|cd|chmod|chown|cp|echo|env|export|grep|install|let|ln|make|mkdir|mv|rm|sed|set|tar|touch|umask|unset)\b"
color color constant (i) "^\s+[0-9A-Z_]+\s+\(\)"
color color constant (i) "\$\{?[0-9A-Z_!@#$*?-]+\}?"
color constant ""(\\.|[^"])*"" "'(\\.|[^'])*'"
color comment "(^|[[:space:]])#.*$"
#color ,green "[[:space:]]+$"

View File

@@ -1,29 +1,29 @@
syntax "SQL" "\.sql$" "sqliterc$"
cyan (i) "\b(ALL|ASC|AS|ALTER|AND|ADD|AUTO_INCREMENT)\b"
cyan (i) "\b(BETWEEN|BINARY|BOTH|BY|BOOLEAN)\b"
cyan (i) "\b(CHANGE|CHECK|COLUMNS|COLUMN|CROSS|CREATE)\b"
cyan (i) "\b(DATABASES|DATABASE|DATA|DELAYED|DESCRIBE|DESC|DISTINCT|DELETE|DROP|DEFAULT)\b"
cyan (i) "\b(ENCLOSED|ESCAPED|EXISTS|EXPLAIN)\b"
cyan (i) "\b(FIELDS|FIELD|FLUSH|FOR|FOREIGN|FUNCTION|FROM)\b"
cyan (i) "\b(GROUP|GRANT|HAVING)\b"
cyan (i) "\b(IGNORE|INDEX|INFILE|INSERT|INNER|INTO|IDENTIFIED|IN|IS|IF)\b"
cyan (i) "\b(JOIN|KEYS|KILL|KEY)\b"
cyan (i) "\b(LEADING|LIKE|LIMIT|LINES|LOAD|LOCAL|LOCK|LOW_PRIORITY|LEFT|LANGUAGE)\b"
cyan (i) "\b(MODIFY|NATURAL|NOT|NULL|NEXTVAL)\b"
cyan (i) "\b(OPTIMIZE|OPTION|OPTIONALLY|ORDER|OUTFILE|OR|OUTER|ON)\b"
cyan (i) "\b(PROCEDURE|PROCEDURAL|PRIMARY)\b"
cyan (i) "\b(READ|REFERENCES|REGEXP|RENAME|REPLACE|RETURN|REVOKE|RLIKE|RIGHT)\b"
cyan (i) "\b(SHOW|SONAME|STATUS|STRAIGHT_JOIN|SELECT|SETVAL|SET)\b"
cyan (i) "\b(TABLES|TERMINATED|TO|TRAILING|TRUNCATE|TABLE|TEMPORARY|TRIGGER|TRUSTED)\b"
cyan (i) "\b(UNIQUE|UNLOCK|USE|USING|UPDATE|VALUES|VARIABLES|VIEW)\b"
cyan (i) "\b(WITH|WRITE|WHERE|ZEROFILL|TYPE|XOR)\b"
color cyan (i) "\b(ALL|ASC|AS|ALTER|AND|ADD|AUTO_INCREMENT)\b"
color cyan (i) "\b(BETWEEN|BINARY|BOTH|BY|BOOLEAN)\b"
color cyan (i) "\b(CHANGE|CHECK|COLUMNS|COLUMN|CROSS|CREATE)\b"
color cyan (i) "\b(DATABASES|DATABASE|DATA|DELAYED|DESCRIBE|DESC|DISTINCT|DELETE|DROP|DEFAULT)\b"
color cyan (i) "\b(ENCLOSED|ESCAPED|EXISTS|EXPLAIN)\b"
color cyan (i) "\b(FIELDS|FIELD|FLUSH|FOR|FOREIGN|FUNCTION|FROM)\b"
color cyan (i) "\b(GROUP|GRANT|HAVING)\b"
color cyan (i) "\b(IGNORE|INDEX|INFILE|INSERT|INNER|INTO|IDENTIFIED|IN|IS|IF)\b"
color cyan (i) "\b(JOIN|KEYS|KILL|KEY)\b"
color cyan (i) "\b(LEADING|LIKE|LIMIT|LINES|LOAD|LOCAL|LOCK|LOW_PRIORITY|LEFT|LANGUAGE)\b"
color cyan (i) "\b(MODIFY|NATURAL|NOT|NULL|NEXTVAL)\b"
color cyan (i) "\b(OPTIMIZE|OPTION|OPTIONALLY|ORDER|OUTFILE|OR|OUTER|ON)\b"
color cyan (i) "\b(PROCEDURE|PROCEDURAL|PRIMARY)\b"
color cyan (i) "\b(READ|REFERENCES|REGEXP|RENAME|REPLACE|RETURN|REVOKE|RLIKE|RIGHT)\b"
color cyan (i) "\b(SHOW|SONAME|STATUS|STRAIGHT_JOIN|SELECT|SETVAL|SET)\b"
color cyan (i) "\b(TABLES|TERMINATED|TO|TRAILING|TRUNCATE|TABLE|TEMPORARY|TRIGGER|TRUSTED)\b"
color cyan (i) "\b(UNIQUE|UNLOCK|USE|USING|UPDATE|VALUES|VARIABLES|VIEW)\b"
color cyan (i) "\b(WITH|WRITE|WHERE|ZEROFILL|TYPE|XOR)\b"
color green "\b(VARCHAR|TINYINT|TEXT|DATE|SMALLINT|MEDIUMINT|INT|INTEGER|BIGINT|FLOAT|DOUBLE|DECIMAL|DATETIME|TIMESTAMP|TIME|YEAR|UNSIGNED|CHAR|TINYBLOB|TINYTEXT|BLOB|MEDIUMBLOB|MEDIUMTEXT|LONGBLOB|LONGTEXT|ENUM|BOOL|BINARY|VARBINARY)\b"
# SQLite meta commands
cyan (i) "\.\b(databases|dump|echo|exit|explain|header(s)?|help)\b"
cyan (i) "\.\b(import|indices|mode|nullvalue|output|prompt|quit|read)\b"
cyan (i) "\.\b(schema|separator|show|tables|timeout|width)\b"
color cyan (i) "\.\b(databases|dump|echo|exit|explain|header(s)?|help)\b"
color cyan (i) "\.\b(import|indices|mode|nullvalue|output|prompt|quit|read)\b"
color cyan (i) "\.\b(schema|separator|show|tables|timeout|width)\b"
color brightcyan "\b(ON|OFF)\b"
color blue "\b([0-9]+)\b"

View File

@@ -4,37 +4,31 @@
syntax "Swift" "\.swift$"
# Default
color white ".+"
# Operators
color yellow "[.:;,+*|=!?\%]" "<" ">" "/" "-" "&"
color statement "[.:;,+*|=!?\%]" "<" ">" "/" "-" "&"
# Statements
color magenta "(class|import|let|var|struct|enum|func|if|else|switch|case|default|for|in|internal|external|unowned|private|public|throws)\ "
color magenta "(prefix|postfix|operator|extension|lazy|get|set|self|willSet|didSet|override|super|convenience|weak|strong|mutating|return|guard)\ "
color statement "(class|import|let|var|struct|enum|func|if|else|switch|case|default|for|in|internal|external|unowned|private|public|throws)\ "
color statement "(prefix|postfix|operator|extension|lazy|get|set|self|willSet|didSet|override|super|convenience|weak|strong|mutating|return|guard)\ "
# Keywords
color cyan "(print)"
color magenta "(init)"
color statement "(print)"
color statement "(init)"
# Numbers
color blue "([0-9]+)"
color constant "([0-9]+)"
# Standard Types
color brightmagenta "\ ((U)?Int(8|16|32|64))"
color brightmagenta "(true|false|nil)"
color brightmagenta "\ (Double|String|Float|Boolean|Dictionary|Array|Int)"
color magenta "\ (AnyObject)"
color type "\ ((U)?Int(8|16|32|64))"
color constant "(true|false|nil)"
color type "\ (Double|String|Float|Boolean|Dictionary|Array|Int)"
color type "\ (AnyObject)"
# Text
color red ""[^"]*""
color constant ""[^"]*""
# Comments
color green "//.*"
color brightgreen "///.*"
color green (s) "/\*\*.*?\*/"
color green "[/**]"
# Trailing whitespace
color ,green "[[:space:]]+$"
color comment "//.*"
color comment "///.*"
color comment (s) "/\*\*.*?\*/"
color comment "[/**]"

View File

@@ -17,7 +17,7 @@ color brightyellow "\b[0-9]+(\.[0-9]+)?\b"
## Strings
color yellow ""(\\.|[^"])*"" "'(\\.|[^'])*'"
## Variables
brightred (i) "\$\{?[0-9A-Z_!@#$*?-]+\}?"
color brightred (i) "\$\{?[0-9A-Z_!@#$*?-]+\}?"
## Comments
color magenta "(^|;)[[:space:]]*#.*"
## Trailing whitespace

View File

@@ -2,8 +2,8 @@
##
syntax "TeX" "\.tex$" "bib" "\.bib$" "cls" "\.cls$"
color yellow "\$[^$]*\$"
green (i) "\\.|\\[A-Z]*"
color green (i) "\\.|\\[A-Z]*"
color magenta "[{}]"
color blue "%.*"
color blue (s) "\\begin\{comment\}.*?\\end\{comment\}"
color blue (s) "\\begin\{brightblack\}.*?\\end\{brightblack\}"

View File

@@ -1,10 +1,8 @@
syntax "VI" "(^|/|\.)(ex|vim)rc$|\.vim"
color brightblue "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[()]"
color cyan "\b([nvxsoilc]?(nore|un)?map|[nvlx]n|[ico]?no|[cilovx][um]|s?unm)\b"
color cyan "\b(snor|nun|nm|set|if|endif|let|unlet)\b"
color red "[!&=]"
color yellow ""(\\.|[^"])*"|'(\\.|[^'])*'"
color brightblack "(^|[[:space:]])\"[^"]*$"
color ,green "[[:space:]]+$"
color ,red " + +| + +"
color identifier "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[()]"
color statement "\b([nvxsoilc]?(nore|un)?map|[nvlx]n|[ico]?no|[cilovx][um]|s?unm)\b"
color statement "\b(snor|nun|nm|set|if|endif|let|unlet)\b"
color statement "[!&=]"
color constant ""(\\.|[^"])*"|'(\\.|[^'])*'"
color comment "(^|[[:space:]])\"[^"]*$"

View File

@@ -25,10 +25,10 @@ color brightmagenta "\b((g|ig)?awk|find|\w{0,4}grep|kill|killall|\w{0,4}less|mak
color brightmagenta "\b(base64|basename|cat|chcon|chgrp|chmod|chown|chroot|cksum|comm|cp|csplit|cut|date|dd|df|dir|dircolors|dirname|du|echo|env|expand|expr|factor|false|fmt|fold|head|hostid|id|install|join|link|ln|logname|ls|md5sum|mkdir|mkfifo|mknod|mktemp|mv|nice|nl|nohup|nproc|numfmt|od|paste|pathchk|pinky|pr|printenv|printf|ptx|pwd|readlink|realpath|rm|rmdir|runcon|seq|(sha1|sha224|sha256|sha384|sha512)sum|shred|shuf|sleep|sort|split|stat|stdbuf|stty|sum|sync|tac|tail|tee|test|timeout|touch|tr|true|truncate|tsort|tty|uname|unexpand|uniq|unlink|users|vdir|wc|who|whoami|yes)\b"
## Function definition
brightgreen (i) "^\s+(function\s+)[0-9A-Z_]+\s+\(\)"
color brightgreen (i) "^\s+(function\s+)[0-9A-Z_]+\s+\(\)"
## Variables
brightred (i) "\$\{?[0-9A-Z_!@#$*?-]+\}?"
color brightred (i) "\$\{?[0-9A-Z_!@#$*?-]+\}?"
## Strings
color yellow ""(\\.|[^"])*""