diff options
| -rw-r--r-- | lua/vis-std.lua | 5 | ||||
| -rw-r--r-- | lua/vis.lua | 2 | ||||
| -rw-r--r-- | sam.c | 6 | ||||
| -rw-r--r-- | vis-cmds.c | 6 | ||||
| -rw-r--r-- | vis-lua.c | 19 | ||||
| -rw-r--r-- | vis.h | 2 |
6 files changed, 3 insertions, 37 deletions
diff --git a/lua/vis-std.lua b/lua/vis-std.lua index 845785d..86f8f46 100644 --- a/lua/vis-std.lua +++ b/lua/vis-std.lua @@ -7,7 +7,7 @@ vis.events.subscribe(vis.events.INIT, function() vis:command("set theme ".. (vis.ui.colors <= 16 and "default-16" or "default-256")) end) -vis.events.subscribe(vis.events.THEME_CHANGE, function(name) +vis:option_register("theme", "string", function(name) if name ~= nil then local theme = 'themes/'..name package.loaded[theme] = nil @@ -19,7 +19,8 @@ vis.events.subscribe(vis.events.THEME_CHANGE, function(name) for win in vis:windows() do win:set_syntax(win.syntax) end -end) + return true +end, "Color theme to use, filename without extension") vis:option_register("syntax", "string", function(name) if not vis.win then return false end diff --git a/lua/vis.lua b/lua/vis.lua index 9b45483..93a3e5d 100644 --- a/lua/vis.lua +++ b/lua/vis.lua @@ -109,7 +109,6 @@ local events = { INPUT = "Event::INPUT", -- see @{input} QUIT = "Event::QUIT", -- see @{quit} START = "Event::START", -- see @{start} - THEME_CHANGE = "Event::THEME_CHANGE", -- see @{theme_change} WIN_CLOSE = "Event::WIN_CLOSE", -- see @{win_close} WIN_HIGHLIGHT = "Event::WIN_HIGHLIGHT", -- see @{win_highlight} WIN_OPEN = "Event::WIN_OPEN", -- see @{win_open} @@ -124,7 +123,6 @@ events.init = function(...) events.emit(events.INIT, ...) end events.input = function(...) return events.emit(events.INPUT, ...) end events.quit = function(...) events.emit(events.QUIT, ...) end events.start = function(...) events.emit(events.START, ...) end -events.theme_change = function(...) events.emit(events.THEME_CHANGE, ...) end events.win_close = function(...) events.emit(events.WIN_CLOSE, ...) end events.win_highlight = function(...) events.emit(events.WIN_HIGHLIGHT, ...) end events.win_open = function(...) events.emit(events.WIN_OPEN, ...) end @@ -280,7 +280,6 @@ enum { OPTION_AUTOINDENT, OPTION_EXPANDTAB, OPTION_TABWIDTH, - OPTION_THEME, OPTION_SHOW_SPACES, OPTION_SHOW_TABS, OPTION_SHOW_NEWLINES, @@ -319,11 +318,6 @@ static const OptionDef options[] = { VIS_OPTION_TYPE_NUMBER, VIS_HELP("Number of spaces to display (and insert if `expandtab` is enabled) for a tab") }, - [OPTION_THEME] = { - { "theme" }, - VIS_OPTION_TYPE_STRING, - VIS_HELP("Color theme to use filename without extension") - }, [OPTION_SHOW_SPACES] = { { "show-spaces" }, VIS_OPTION_TYPE_BOOL|VIS_OPTION_NEED_WINDOW, @@ -310,12 +310,6 @@ static bool cmd_set(Vis *vis, Win *win, Command *cmd, const char *argv[], Cursor view_options_set(win->view, opt); break; } - case OPTION_THEME: - if (!vis_theme_load(vis, arg.s)) { - vis_info_show(vis, "Failed to load theme: `%s'", arg.s); - return false; - } - break; case OPTION_COLOR_COLUMN: view_colorcolumn_set(win->view, arg.i); break; @@ -160,7 +160,6 @@ void vis_lua_file_close(Vis *vis, File *file) { } void vis_lua_win_open(Vis *vis, Win *win) { } void vis_lua_win_close(Vis *vis, Win *win) { } void vis_lua_win_highlight(Vis *vis, Win *win, size_t horizon) { } -bool vis_theme_load(Vis *vis, const char *name) { return true; } void vis_lua_win_status(Vis *vis, Win *win) { window_status_update(vis, win); } #else @@ -2746,22 +2745,4 @@ void vis_lua_win_status(Vis *vis, Win *win) { lua_pop(L, 1); } -/*** - * Theme change. - * @function theme_change - * @tparam string theme the name of the new theme to load - */ -bool vis_theme_load(Vis *vis, const char *name) { - lua_State *L = vis->lua; - vis_lua_event_get(L, "theme_change"); - if (lua_isfunction(L, -1)) { - lua_pushstring(L, name); - pcall(vis, L, 1, 0); - } - lua_pop(L, 1); - /* package.loaded['themes/'..name] = nil - * require 'themes/'..name */ - return true; -} - #endif @@ -548,8 +548,6 @@ Text *vis_text(Vis*); View *vis_view(Vis*); Win *vis_window(Vis*); -bool vis_theme_load(Vis*, const char *name); - /* Get value of autoindent */ bool vis_get_autoindent(const Vis*); |
