vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 7ab142f0d9c80b257b8987ed8befb19d01cab51e
parent 2f0fef757ba7ba93748f301d6492d0db86612cec
Author: Randy Palamar <randy@rnpnr.xyz>
Date: Fri, 11 Aug 2023 11:44:53 -0600
lua: update default plugins to work with scintillua 6.2
vis{,-std}.lua:
* replace removed _TOKENSTYLES with _TAGS
* don't add default styles to the lexer. lexers no longer
define their own styles
filetype.lua: update path detection for scintillua 6.2
Diffstat:
| M | lua/plugins/filetype.lua | | | 2 | +- |
| M | lua/vis-std.lua | | | 13 | +------------ |
| M | lua/vis.lua | | | 4 | ++-- |
3 files changed, 4 insertions(+), 15 deletions(-)
diff --git a/lua/plugins/filetype.lua b/lua/plugins/filetype.lua @@ -512,7 +512,7 @@ vis.events.subscribe(vis.events.WIN_OPEN, function(win) vis:command(cmd) end if not vis.lexers.property then return end - local path = vis.lexers.property['lexer.lpeg.home']:gsub(';', '/?.lua;') .. '/?.lua' + local path = vis.lexers.property['scintillua.lexers'] local lexname = filetype.alt_name or syntax local lexpath = package.searchpath('lexers/'..lexname, path) if lexpath ~= nil then diff --git a/lua/vis-std.lua b/lua/vis-std.lua @@ -27,17 +27,6 @@ vis:option_register("theme", "string", function(name) end end - local styles = lexers.styles - local default_styles = { - 'nothing', 'whitespace', 'comment', 'string', 'number', 'keyword', - 'identifier', 'operator', 'error', 'preprocessor', 'constant', 'variable', - 'function', 'class', 'type', 'label', 'regex', 'embedded' - } - - for _, s in ipairs(default_styles) do - styles[s] = lexers['STYLE_' .. s:upper()] - end - for win in vis:windows() do win:set_syntax(win.syntax) end @@ -73,7 +62,7 @@ vis.events.subscribe(vis.events.WIN_HIGHLIGHT, function(win) local lex_start = viewport.start - horizon viewport.start = lex_start local data = win.file:content(viewport) - local token_styles = lexer._TOKENSTYLES + local token_styles = lexer._TAGS local tokens = lexer:lex(data, 1) local token_end = lex_start + (tokens[#tokens] or 1) - 1 diff --git a/lua/vis.lua b/lua/vis.lua @@ -265,8 +265,8 @@ vis.types.window.set_syntax = function(win, syntax) local lexer = lexers.load(syntax) if not lexer then return false end - for token_name, id in pairs(lexer._TOKENSTYLES) do - local style = lexers['STYLE_' .. token_name:upper()] or lexer._EXTRASTYLES[token_name] + for id, token_name in ipairs(lexer._TAGS) do + local style = lexers['STYLE_' .. token_name:upper()] or '' if type(style) == 'table' then local s = '' if style.bold then