aboutsummaryrefslogtreecommitdiff
path: root/lua/vis-std.lua
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2017-02-22 18:33:57 +0100
committerMarc André Tanner <mat@brain-dump.org>2017-02-22 18:59:05 +0100
commitb8b374702e7f24401baa883a969eb7f4165ac696 (patch)
tree8ddf5f3648ee708f4147b6a1e0dca594ec8a1ef6 /lua/vis-std.lua
parent335814c9caef5a25430e9493cbc7d4f806c1f715 (diff)
downloadvis-b8b374702e7f24401baa883a969eb7f4165ac696.tar.gz
vis-b8b374702e7f24401baa883a969eb7f4165ac696.tar.xz
lua: expose vis:module_exist method, load lexer and lpeg module during startup
Diffstat (limited to 'lua/vis-std.lua')
-rw-r--r--lua/vis-std.lua20
1 files changed, 1 insertions, 19 deletions
diff --git a/lua/vis-std.lua b/lua/vis-std.lua
index 6c42a0c..55d37d2 100644
--- a/lua/vis-std.lua
+++ b/lua/vis-std.lua
@@ -1,24 +1,6 @@
-- standard vis event handlers
vis.events.subscribe(vis.events.INIT, function()
- local package_exist = function(name)
- for _, searcher in ipairs(package.searchers or package.loaders) do
- local loader = searcher(name)
- if type(loader) == 'function' then
- return true
- end
- end
- return false
- end
-
- if not package_exist('lpeg') then
- vis:info('WARNING: could not find lpeg module')
- elseif not package_exist('lexer') then
- vis:info('WARNING: could not find lexer module')
- else
- vis.lexers = require('lexer')
- end
-
if os.getenv("TERM_PROGRAM") == "Apple_Terminal" then
vis:command("set change-256colors false");
end
@@ -41,7 +23,7 @@ end)
vis.events.subscribe(vis.events.WIN_SYNTAX, function(win, name)
local lexers = vis.lexers
- if not lexers.load then return false end
+ if not lexers then return false end
win:style_define(win.STYLE_DEFAULT, lexers.STYLE_DEFAULT or '')
win:style_define(win.STYLE_CURSOR, lexers.STYLE_CURSOR or '')