sandy

text editor
git clone git://git.suckless.org/sandy
Log | Files | Refs | README | LICENSE

commit 848baf4bd63dfe149e05de70ecbcd3f4c63a1195
parent 64a32ce687def5bd7dc4d5ac3a4e398daa5e4bf6
Author: Rafael Garcia <rafael.garcia.gallego@gmail.com>
Date:   Wed, 13 Apr 2011 01:12:58 +0200

Added a couple of syntaxes I use (plus java). Also oops when adding Ctrl-o in 18a0c253b234
Diffstat:
config.def.h | 45+++++++++++++++++++++++++++++++++++++++++++++
sandy.c | 2+-
2 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/config.def.h b/config.def.h @@ -99,6 +99,7 @@ static const Key stdkeys[] = { { META('x'), { 0, 0, 0, 0 }, f_extsel, { .i = ExtAll } }, { CONTROL('G'), { t_sel, 0, 0, 0 }, f_select, { .m = m_stay } }, { CONTROL('G'), { 0, 0, 0, 0 }, f_toggle, { .i = S_Selecting } }, +{ CONTROL('O'), { t_sel, 0, 0, 0 }, f_select, { .m = m_tosel } }, /* Swap fsel and fcur */ { META('i'), { 0, 0, 0, 0 }, f_toggle, { .i = S_CaseIns } }, { META('s'), { t_sel, 0, 0, 0 }, f_pipero, { .v = "(sed 's/$/\\n/;2q' | (read arg && echo find \"$arg\" > ${SANDY_FIFO}))" } }, { META('r'), { t_sel, 0, 0, 0 }, f_pipero, { .v = "(sed 's/$/\\n/;2q' | (read arg && echo findbw \"$arg\" > ${SANDY_FIFO}))" } }, @@ -181,6 +182,50 @@ static Syntax syntaxes[] = { /* LoRed */ "(\\<[A-Z_][0-9A-Z_]+\\>|\"(\\.|[^\"])*\")", /* LoBlue */ "(//.*|/\\*([^*]|\\*[^/])*\\*/|/\\*([^*]|\\*[^/])*$|^([^/]|/[^*])*\\*/)", } }, + +{"sh", NULL, "\\.sh$", { NULL }, { + /* HiRed */ "", + /* HiGreen */ "^[0-9A-Z_]+\\(\\)", + /* LoGreen */ "\\<(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)\\>", + /* HiMag */ "", + /* LoMag */ "\"(\\.|[^\"])*\"", + /* HiBlue */ "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|!|=|&|\\|)", + /* LoRed */ "\\$\\{?[0-9A-Z_!@#$*?-]+\\}?", + /* LoBlue */ "#.*$", + } }, + +{"makefile", NULL, "(Makefile[^/]*|\\.mk)$", { NULL }, { + /* HiRed */ "", + /* HiGreen */ "", + /* LoGreen */ "\\$+[{(][a-zA-Z0-9_-]+[})]", + /* HiMag */ "\\<(if|ifeq|else|endif)\\>", + /* LoMag */ "", + /* HiBlue */ "^[^ ]+:", + /* LoRed */ "[:=]", + /* LoBlue */ "#.*$", + } }, + +{"man", NULL, "\\.[1-9]x?$", { NULL }, { + /* HiRed */ "\\.(BR?|I[PR]?).*$", + /* HiGreen */ "", + /* LoGreen */ "\\.(S|T)H.*$", + /* HiMag */ "\\.(br|DS|RS|RE|PD)", + /* LoMag */ "(\\.(S|T)H|\\.TP)", + /* HiBlue */ "\\.(BR?|I[PR]?|PP)", + /* LoRed */ "", + /* LoBlue */ "\\\\f[BIPR]", + } }, + +{"java", NULL, "\\.java$", { NULL }, { + /* HiRed */ "\\<[A-Z_][0-9A-Z_]+\\>", + /* HiGreen */ "\\<(for|if|while|do|else|case|default|switch)\\>", + /* LoGreen */ "\\<(boolean|byte|char|double|float|int|long|new|short|this|transient|void|true|false|null)\\>", + /* HiMag */ "\\<(try|catch|throw|finally|continue|break|return)\\>", + /* LoMag */ "\\<(abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\\>", + /* HiBlue */ "(\\(|\\)|\\{|\\}|\\[|\\])", + /* LoRed */ "\"(\\.|[^\"])*\"", + /* LoBlue */ "(//.*|/\\*([^*]|\\*[^/])*\\*/|/\\*([^*]|\\*[^/])*$|^([^/]|/[^*])*\\*/)", + } }, }; /* Colors */ diff --git a/sandy.c b/sandy.c @@ -432,7 +432,7 @@ void f_syntax(const Arg *arg) { int i, j; - statusflags&=~S_Selecting; + statusflags=(statusflags|S_DirtyScr)&~S_Selecting; for(i=0; i<LENGTH(syntaxes); i++) if((arg && arg->v) ? !strcmp(arg->v, syntaxes[i].name) : !regexec(syntaxes[i].file_re, filename, 1, NULL, 0)) {