diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2017-03-19 12:06:30 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2017-03-19 14:58:06 +0100 |
| commit | 0102293b417d2adc5c4eeff78a9d31f61c9dd6ff (patch) | |
| tree | eb0ba8e8f16b6097f363a44314272e1f6a76265b /lua | |
| parent | 42f04699d6df2d5b144533737a8f2f7e0814ad85 (diff) | |
| download | vis-0102293b417d2adc5c4eeff78a9d31f61c9dd6ff.tar.gz vis-0102293b417d2adc5c4eeff78a9d31f61c9dd6ff.tar.xz | |
Move :set theme option implementation to lua
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/vis-std.lua | 5 | ||||
| -rw-r--r-- | lua/vis.lua | 2 |
2 files changed, 3 insertions, 4 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 |
