From ae450f738c0ed07b3b892449463c817a2125c2e7 Mon Sep 17 00:00:00 2001 From: Randy Palamar Date: Sun, 27 Aug 2023 10:08:19 -0600 Subject: lua: make sure lpeg is in fact optional fixes #1119: lua: lpeg module isn't actually optional --- lua/plugins/filetype.lua | 1 + lua/vis-std.lua | 1 + 2 files changed, 2 insertions(+) (limited to 'lua') diff --git a/lua/plugins/filetype.lua b/lua/plugins/filetype.lua index a5ab056..074b7f2 100644 --- a/lua/plugins/filetype.lua +++ b/lua/plugins/filetype.lua @@ -500,6 +500,7 @@ vis.events.subscribe(vis.events.WIN_OPEN, function(win) for _, cmd in pairs(filetype.cmd or {}) do vis:command(cmd) end + if not vis.lexers.property then return end local path = vis.lexers.property['lexer.lpeg.home']:gsub(';', '/?.lua;') .. '/?.lua' local lexpath = package.searchpath('lexers/'..syntax, path) if lexpath ~= nil then diff --git a/lua/vis-std.lua b/lua/vis-std.lua index af2b196..4a6bfdf 100644 --- a/lua/vis-std.lua +++ b/lua/vis-std.lua @@ -17,6 +17,7 @@ vis:option_register("theme", "string", function(name) local lexers = vis.lexers lexers.lexers = {} + if not lexers.load then return false end if not lexers.property then lexers.load("text") end local colors = lexers.colors local default_colors = { "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white" } -- cgit v1.2.3