.config/vis: implement mode-based cursor styling in personal theme config
parent
5c92109015
commit
6bdbaea817
|
@ -1,3 +1,40 @@
|
|||
-- define additional cursor styles on WIN_OPEN
|
||||
vis.events.subscribe(vis.events.WIN_OPEN, function(win)
|
||||
win['STYLE_CURSOR_'..vis.modes.OPERATOR_PENDING] = win.STYLE_LEXER_MAX - 1
|
||||
win['STYLE_CURSOR_'..vis.modes.VISUAL] = win.STYLE_LEXER_MAX - 2
|
||||
win['STYLE_CURSOR_'..vis.modes.VISUAL_LINE] = win.STYLE_LEXER_MAX - 3
|
||||
win['STYLE_CURSOR_'..vis.modes.INSERT] = win.STYLE_LEXER_MAX - 4
|
||||
win['STYLE_CURSOR_'..vis.modes.REPLACE] = win.STYLE_LEXER_MAX - 5
|
||||
win:style_define(
|
||||
win['STYLE_CURSOR_'..vis.modes.OPERATOR_PENDING],
|
||||
'fore:black,back:red')
|
||||
win:style_define(
|
||||
win['STYLE_CURSOR_'..vis.modes.VISUAL],
|
||||
'fore:black,back:yellow')
|
||||
win:style_define(
|
||||
win['STYLE_CURSOR_'..vis.modes.VISUAL_LINE],
|
||||
'fore:black,back:yellow')
|
||||
win:style_define(
|
||||
win['STYLE_CURSOR_'..vis.modes.INSERT],
|
||||
'fore:black,back:magenta')
|
||||
win:style_define(
|
||||
win['STYLE_CURSOR_'..vis.modes.REPLACE],
|
||||
'fore:black,back:green')
|
||||
end)
|
||||
|
||||
-- apply additional cursor styles on WIN_STATUS
|
||||
vis.events.subscribe(vis.events.WIN_STATUS, function(win)
|
||||
local pos = win.selection.pos
|
||||
win:style(win['STYLE_CURSOR'], pos, pos)
|
||||
if win == vis.win then
|
||||
local mode_style_id =
|
||||
win['STYLE_CURSOR_'..vis.mode] or
|
||||
win['STYLE_CURSOR_PRIMARY']
|
||||
win:style(mode_style_id, pos, pos)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
local lexers = vis.lexers
|
||||
lexers.STYLE_LINENUMBER = 'fore:blue'
|
||||
lexers.STYLE_LINENUMBER_CURSOR = 'fore:magenta'
|
||||
|
|
Loading…
Reference in New Issue