diff options
| author | Randy Palamar <randy@rnpnr.xyz> | 2024-04-28 12:53:05 -0600 |
|---|---|---|
| committer | Randy Palamar <randy@rnpnr.xyz> | 2024-04-29 08:27:30 -0600 |
| commit | 8be1f68ec8a8310109a9204ec9a8599614d8d623 (patch) | |
| tree | d123c9b1e120f20b383155c5fe75783ab81db349 /lua/vis.lua | |
| parent | 1fc175627f3afe938be0b5daa6a864b281725fec (diff) | |
| download | vis-8be1f68ec8a8310109a9204ec9a8599614d8d623.tar.gz vis-8be1f68ec8a8310109a9204ec9a8599614d8d623.tar.xz | |
lua: small filetype/style setting cleanup
Filetype extension mapping already needs to match regular
expressions so we might as well us it to simplify things.
set_syntax doesn't need to handle pseudo scintilla style
definitions. I couldn't even find any examples of table style
definitions anywhere let alone references to other definitions as
$(style.myvarname) (hint: variables in lua already handle this).
Diffstat (limited to 'lua/vis.lua')
| -rw-r--r-- | lua/vis.lua | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/lua/vis.lua b/lua/vis.lua index 2432c72..32fb2a1 100644 --- a/lua/vis.lua +++ b/lua/vis.lua @@ -283,12 +283,8 @@ vis.types.window.set_syntax = function(win, syntax) local style = lexers['STYLE_' .. token_name:upper():gsub("%.", "_")] or '' if type(style) == 'table' then local s = '' - if style.bold then - s = string.format("%s,bold", s) - elseif style.italics then - s = string.format("%s,italics", s) - elseif style.underlined then - s = string.format("%s,underlined", s) + if style.attr then + s = string.format("%s,%s", s, attr) elseif style.fore then s = string.format("%s,fore:%s", s, style.fore) elseif style.back then @@ -296,12 +292,6 @@ vis.types.window.set_syntax = function(win, syntax) end style = s end - local pattern = "%$%(style%..*%)" - local prop_name = style:match(pattern) - if prop_name ~= nil then - local real_value = tostring(lexers["STYLE_" .. string.upper(prop_name:sub(9,string.len(prop_name)-1))]) - style = string.gsub(style, pattern, real_value) - end if style ~= nil then win:style_define(id, style) end end |
