aboutsummaryrefslogtreecommitdiff
path: root/lua/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'lua/plugins')
-rw-r--r--lua/plugins/filetype.lua10
-rw-r--r--lua/plugins/textobject-lexer.lua6
2 files changed, 6 insertions, 10 deletions
diff --git a/lua/plugins/filetype.lua b/lua/plugins/filetype.lua
index 553e79d..d643f82 100644
--- a/lua/plugins/filetype.lua
+++ b/lua/plugins/filetype.lua
@@ -506,15 +506,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['scintillua.lexers']:gsub(';', '/?.lua;')
- local lexname = filetype.alt_name or syntax
- local lexpath = package.searchpath(lexname, path)
- if lexpath ~= nil then
- win:set_syntax(lexname)
- else
- win:set_syntax(nil)
- end
+ win:set_syntax(filetype.alt_name or syntax)
end
local path = win.file.name -- filepath
diff --git a/lua/plugins/textobject-lexer.lua b/lua/plugins/textobject-lexer.lua
index 2f9d757..eba65e2 100644
--- a/lua/plugins/textobject-lexer.lua
+++ b/lua/plugins/textobject-lexer.lua
@@ -8,13 +8,17 @@ vis:textobject_new("ii", function(win, pos)
return nil
end
+ local lexer = vis.lexers.load(win.syntax, nil, true)
+ if not lexer then
+ return nil
+ end
+
local before, after = pos - MAX_CONTEXT, pos + MAX_CONTEXT
if before < 0 then
before = 0
end
-- TODO make sure we start at a line boundary?
- local lexer = vis.lexers.load(win.syntax, nil, true)
local data = win.file:content(before, after - before)
local tokens = lexer:lex(data)
local cur = before