clp

command line syntax highlighter
git clone git://jeskin.net/clp.git
README | Log | Files | Refs | LICENSE

commit a469b090f4a01f99397b3c5cc963c7c5c1de1c8a
parent 2537cc756d56cd3b0207ec624aaaf91503d80ae1
Author: Jon Eskin <eskinjp@gmail.com>
Date:   Mon, 18 Jul 2022 11:47:50 -0400

Change highlighted line styling from inverted to black on white

Diffstat:
Mclp.c | 6+++---
Mlua/theme.lua | 69++++++++++++++++++++++++++++++++++++++++++++++++---------------------
2 files changed, 51 insertions(+), 24 deletions(-)

diff --git a/clp.c b/clp.c @@ -11,7 +11,6 @@ #include <libgen.h> #include <signal.h> - #define OPTPARSE_IMPLEMENTATION #include "optparse.h" @@ -126,6 +125,7 @@ int main(int argc, char *argv[]) { printf("WARNING: failed to load clp.lua\n"); exit(1); } + lua_getglobal(L, "require"); lua_pushstring(L, "clp"); status = lua_pcall(L, 1, 1, 0); @@ -140,7 +140,6 @@ int main(int argc, char *argv[]) { char *filetype_override = ""; int highlight_line = 0; struct optparse options; - optparse_init(&options, argv); while ((option = optparse_long(&options, longopts, NULL)) != -1) { switch (option) { @@ -174,15 +173,16 @@ int main(int argc, char *argv[]) { printf("Usage: clp [options] file\n"); return 1; } + lua_pushliteral(L, "filename"); lua_pushstring(L, filename); lua_settable(L, -3); - ret = lua_pcall(L, 1, 0, 0); if (ret != 0) { fprintf(stderr, "%s\n", lua_tostring(L, -1)); return 1; } + lua_close(L); return 0; } diff --git a/lua/theme.lua b/lua/theme.lua @@ -28,32 +28,59 @@ local default_theme = { ['identifier'] = colors.white, } +-- local highlight_theme = { + -- -- bold => bright + -- -- italics => underscore + -- ['default'] = colors.white .. colors.reverse, + -- ['nothing'] = '' .. colors.reverse, + -- ['class'] = colors.yellow .. colors.bright .. colors.reverse, + -- ['comment'] = colors.blue .. colors.bright .. colors.reverse, + -- ['constant'] = colors.cyan .. colors.bright .. colors.reverse, + -- ['definition'] = colors.blue .. colors.bright .. colors.reverse, + -- ['error'] = colors.red .. colors.underscore .. colors.reverse, + -- ['function'] = colors.blue .. colors.bright .. colors.reverse, + -- ['keyword'] = colors.yellow .. colors.bright .. colors.reverse, + -- ['label'] = colors.green .. colors.bright .. colors.reverse, + -- ['number'] = colors.red .. colors.bright .. colors.reverse, + -- ['operator'] = colors.cyan .. colors.bright .. colors.reverse, + -- ['regex'] = colors.green .. colors.bright .. colors.reverse, + -- ['string'] = colors.red .. colors.bright .. colors.reverse, + -- ['preprocessor'] = colors.magenta .. colors.bright .. colors.reverse, + -- ['tag'] = colors.red .. colors.bright .. colors.reverse, + -- ['type'] = colors.green .. colors.bright .. colors.reverse, + -- ['variable'] = colors.blue .. colors.bright .. colors.reverse, + -- ['whitespace'] = '' .. colors.reverse, + -- ['embedded'] = colors.onblue .. colors.bright .. colors.reverse, + -- ['identifier'] = colors.white .. colors.reverse, +-- } + local highlight_theme = { -- bold => bright -- italics => underscore - ['default'] = colors.white .. colors.reverse, - ['nothing'] = '' .. colors.reverse, - ['class'] = colors.yellow .. colors.bright .. colors.reverse, - ['comment'] = colors.blue .. colors.bright .. colors.reverse, - ['constant'] = colors.cyan .. colors.bright .. colors.reverse, - ['definition'] = colors.blue .. colors.bright .. colors.reverse, - ['error'] = colors.red .. colors.underscore .. colors.reverse, - ['function'] = colors.blue .. colors.bright .. colors.reverse, - ['keyword'] = colors.yellow .. colors.bright .. colors.reverse, - ['label'] = colors.green .. colors.bright .. colors.reverse, - ['number'] = colors.red .. colors.bright .. colors.reverse, - ['operator'] = colors.cyan .. colors.bright .. colors.reverse, - ['regex'] = colors.green .. colors.bright .. colors.reverse, - ['string'] = colors.red .. colors.bright .. colors.reverse, - ['preprocessor'] = colors.magenta .. colors.bright .. colors.reverse, - ['tag'] = colors.red .. colors.bright .. colors.reverse, - ['type'] = colors.green .. colors.bright .. colors.reverse, - ['variable'] = colors.blue .. colors.bright .. colors.reverse, - ['whitespace'] = '' .. colors.reverse, - ['embedded'] = colors.onblue .. colors.bright .. colors.reverse, - ['identifier'] = colors.white .. colors.reverse, + ['default'] = colors.black .. colors.onwhite, + ['nothing'] = '' .. colors.onwhite, + ['class'] = colors.black .. colors.onwhite, + ['comment'] = colors.black .. colors.onwhite, + ['constant'] = colors.black .. colors.onwhite, + ['definition'] = colors.black .. colors.onwhite, + ['error'] = colors.black .. colors.onwhite, + ['function'] = colors.black .. colors.onwhite, + ['keyword'] = colors.black .. colors.onwhite, + ['label'] = colors.black .. colors.onwhite, + ['number'] = colors.black .. colors.onwhite, + ['operator'] = colors.black .. colors.onwhite, + ['regex'] = colors.black .. colors.onwhite, + ['string'] = colors.black .. colors.onwhite, + ['preprocessor'] = colors.black .. colors.onwhite, + ['tag'] = colors.black .. colors.onwhite, + ['type'] = colors.black .. colors.onwhite, + ['variable'] = colors.black .. colors.onwhite, + ['whitespace'] = '' .. colors.onwhite, + ['embedded'] = colors.black .. colors.onwhite, + ['identifier'] = colors.black .. colors.onwhite, } + theme['default_theme'] = default_theme theme['highlight_theme'] = highlight_theme theme['colors'] = colors