From e29a0da9deef521694247421e82448c0a9ab3d73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Mon, 14 Nov 2016 17:36:41 +0100 Subject: vis: move initial theme loading code to lua --- README.md | 6 ------ ui-curses.c | 10 ---------- vis.1 | 3 --- vis.lua | 2 ++ 4 files changed, 2 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 8bd7b82..ec576a8 100644 --- a/README.md +++ b/README.md @@ -480,12 +480,6 @@ highlighting. `VIS_PATH` defaults (in this order) to - `/usr/local/share/vis` - `/usr/share/vis` -The environment variable `VIS_THEME` can be set to specify the -theme used by `vis` e.g. - - VIS_THEME=dark-16 - export VIS_THEME - ### Runtime Configurable Key Bindings Vis supports run time key bindings via the `:{un,}map{,-window}` set of diff --git a/ui-curses.c b/ui-curses.c index d9981e0..b8f1e05 100644 --- a/ui-curses.c +++ b/ui-curses.c @@ -1055,16 +1055,6 @@ static bool ui_init(Ui *ui, Vis *vis) { } static bool ui_start(Ui *ui) { - Vis *vis = ((UiCurses*)ui)->vis; - const char *theme = getenv("VIS_THEME"); - if (theme && theme[0]) { - if (!vis_theme_load(vis, theme)) - vis_info_show(vis, "Warning: failed to load theme `%s'", theme); - } else { - theme = COLORS <= 16 ? "default-16" : "default-256"; - if (!vis_theme_load(vis, theme)) - vis_info_show(vis, "Warning: failed to load theme `%s' set $VIS_PATH", theme); - } return true; } diff --git a/vis.1 b/vis.1 index b655921..5dca32f 100644 --- a/vis.1 +++ b/vis.1 @@ -38,9 +38,6 @@ if unset .B /usr/share/vis .RE .RE -.TP -.B VIS_THEME -Override syntax highlighting theme to use. .SH HELP Type .B :help diff --git a/vis.lua b/vis.lua index df7b485..0d14f8e 100644 --- a/vis.lua +++ b/vis.lua @@ -416,3 +416,5 @@ vis.events.win_status = function(win) local right = ' ' .. table.concat(right_parts, " « ") .. ' ' win:status(left, right); end + +vis.events.theme_change((not vis.ui or vis.ui.colors <= 16) and "default-16" or "default-256") -- cgit v1.2.3