1
0
Fork 0

.config/vis: update editor and theme options

main
urosm 2024-08-03 15:51:25 +02:00
parent 517bc58b8f
commit a711baa763
2 changed files with 33 additions and 26 deletions

View File

@ -34,12 +34,11 @@ vis.events.subscribe(vis.events.WIN_STATUS, function(win)
end end
end) end)
local lexers = vis.lexers local lexers = vis.lexers
lexers.STYLE_LINENUMBER = 'fore:blue' lexers.STYLE_LINENUMBER = 'fore:blue'
lexers.STYLE_LINENUMBER_CURSOR = 'fore:magenta' lexers.STYLE_LINENUMBER_CURSOR = 'fore:magenta'
lexers.STYLE_CURSOR = 'fore:black,back:blue' lexers.STYLE_CURSOR = 'fore:black,back:white'
lexers.STYLE_CURSOR_PRIMARY = 'fore:black,back:magenta' lexers.STYLE_CURSOR_PRIMARY = 'fore:black,back:blue'
lexers.STYLE_CURSOR_LINE = 'underlined' lexers.STYLE_CURSOR_LINE = 'underlined'
lexers.STYLE_COLOR_COLUMN = 'fore:black,back:blue' lexers.STYLE_COLOR_COLUMN = 'fore:black,back:blue'
lexers.STYLE_SELECTION = 'fore:black,back:white' lexers.STYLE_SELECTION = 'fore:black,back:white'
@ -64,11 +63,11 @@ lexers.STYLE_ERROR = 'fore:red,italics'
lexers.STYLE_PREPROCESSOR = 'fore:magenta,bold' lexers.STYLE_PREPROCESSOR = 'fore:magenta,bold'
lexers.STYLE_CONSTANT = 'fore:cyan,bold' lexers.STYLE_CONSTANT = 'fore:cyan,bold'
lexers.STYLE_CONSTANT_BUILTIN = 'fore:cyan,bold' lexers.STYLE_CONSTANT_BUILTIN = 'fore:cyan,bold'
lexers.STYLE_VARIABLE = 'fore:blue,bold' lexers.STYLE_VARIABLE = 'fore:white,bold'
lexers.STYLE_VARIABLE_BUILTIN = 'fore:blue,bold' lexers.STYLE_VARIABLE_BUILTIN = 'fore:blue,bold'
lexers.STYLE_FUNCTION = 'fore:blue,bold' lexers.STYLE_FUNCTION = 'fore:white,bold'
lexers.STYLE_FUNCTION_BUILTIN = 'fore:blue,bold' lexers.STYLE_FUNCTION_BUILTIN = 'fore:white,bold'
lexers.STYLE_FUNCTION_METHOD = 'fore:blue,bold' lexers.STYLE_FUNCTION_METHOD = 'fore:white,bold'
lexers.STYLE_CLASS = 'fore:yellow,bold' lexers.STYLE_CLASS = 'fore:yellow,bold'
lexers.STYLE_TYPE = 'fore:green,bold' lexers.STYLE_TYPE = 'fore:green,bold'
lexers.STYLE_LABEL = 'fore:green,bold' lexers.STYLE_LABEL = 'fore:green,bold'
@ -77,9 +76,9 @@ lexers.STYLE_EMBEDDED = 'back:blue,bold'
lexers.STYLE_ANNOTATION = '' lexers.STYLE_ANNOTATION = ''
-- markup languages -- markup languages
lexers.STYLE_TAG = 'fore:red,bold' lexers.STYLE_TAG = lexers.STYLE_KEYWORD
lexers.STYLE_ATTRIBUTE = 'fore:green,bold' lexers.STYLE_ATTRIBUTE = 'fore:green,bold'
lexers.STYLE_HEADING = 'fore:magenta,bold' lexers.STYLE_HEADING = 'fore:white,bold'
lexers.STYLE_BOLD = 'bold' lexers.STYLE_BOLD = 'bold'
lexers.STYLE_ITALIC = 'italics' lexers.STYLE_ITALIC = 'italics'
lexers.STYLE_UNDERLINE = 'underlined' lexers.STYLE_UNDERLINE = 'underlined'

View File

@ -1,5 +1,15 @@
require('vis') require('vis')
local mode_strings = {
[vis.modes.NORMAL] = 'NORMAL',
[vis.modes.OPERATOR_PENDING] = 'OPERATOR-PENDING',
[vis.modes.VISUAL] = 'VISUAL',
[vis.modes.VISUAL_LINE] = 'VISUAL-LINE',
[vis.modes.INSERT] = 'INSERT',
[vis.modes.REPLACE] = 'REPLACE',
}
-- editor options
vis.events.subscribe(vis.events.INIT, function() vis.events.subscribe(vis.events.INIT, function()
vis.options.theme = require("themes.basic") vis.options.theme = require("themes.basic")
@ -20,24 +30,24 @@ vis.events.subscribe(vis.events.INIT, function()
vis.options.ignorecase = true vis.options.ignorecase = true
end) end)
-- window options
vis.events.subscribe(vis.events.WIN_OPEN, function(win) vis.events.subscribe(vis.events.WIN_OPEN, function(win)
win.options.breakat = " .])}_"
win.options.colorcolumn = 81 win.options.colorcolumn = 81
win.options.relativenumbers = true win.options.relativenumbers = true
if win.syntax == 'markdown' then
win.options.breakat = " .])}_"
win.options.expandtab = true
win.options.tabwidth = 2 win.options.tabwidth = 2
win.options.wrapcolumn = 81 win.options.wrapcolumn = 81
end
end) end)
local modes = {
[vis.modes.NORMAL] = 'NORMAL',
[vis.modes.OPERATOR_PENDING] = 'OPERATOR-PENDING',
[vis.modes.VISUAL] = 'VISUAL',
[vis.modes.VISUAL_LINE] = 'VISUAL-LINE',
[vis.modes.INSERT] = 'INSERT',
[vis.modes.REPLACE] = 'REPLACE',
}
vis.events.subscribe(vis.events.WIN_STATUS, function(win) vis.events.subscribe(vis.events.WIN_STATUS, function(win)
set_statusline(win, mode_strings[vis.mode])
end)
function set_statusline(win, mode_string)
local left_parts = {} local left_parts = {}
local right_parts = {} local right_parts = {}
local file = win.file local file = win.file
@ -47,7 +57,7 @@ vis.events.subscribe(vis.events.WIN_STATUS, function(win)
if vis.win == win then if vis.win == win then
-- mode -- mode
table.insert(left_parts, modes[vis.mode]) table.insert(left_parts, mode_string)
-- selection -- selection
table.insert(left_parts, selection.number..'/'..#win.selections) table.insert(left_parts, selection.number..'/'..#win.selections)
@ -73,7 +83,5 @@ vis.events.subscribe(vis.events.WIN_STATUS, function(win)
table.insert(right_parts, #file.lines..'/'..selection.line) table.insert(right_parts, #file.lines..'/'..selection.line)
table.insert(right_parts, selection.col) table.insert(right_parts, selection.col)
local left = table.concat(left_parts, " ") win:status(table.concat(left_parts, " "), table.concat(right_parts, " "));
local right = table.concat(right_parts, " ") end
win:status(left, right);
end)