diff --git a/.config/vis/themes/basic.lua b/.config/vis/themes/basic.lua index f365693..89723d5 100644 --- a/.config/vis/themes/basic.lua +++ b/.config/vis/themes/basic.lua @@ -34,12 +34,11 @@ vis.events.subscribe(vis.events.WIN_STATUS, function(win) end end) - local lexers = vis.lexers lexers.STYLE_LINENUMBER = 'fore:blue' lexers.STYLE_LINENUMBER_CURSOR = 'fore:magenta' -lexers.STYLE_CURSOR = 'fore:black,back:blue' -lexers.STYLE_CURSOR_PRIMARY = 'fore:black,back:magenta' +lexers.STYLE_CURSOR = 'fore:black,back:white' +lexers.STYLE_CURSOR_PRIMARY = 'fore:black,back:blue' lexers.STYLE_CURSOR_LINE = 'underlined' lexers.STYLE_COLOR_COLUMN = 'fore:black,back:blue' 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_CONSTANT = '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_FUNCTION = 'fore:blue,bold' -lexers.STYLE_FUNCTION_BUILTIN = 'fore:blue,bold' -lexers.STYLE_FUNCTION_METHOD = 'fore:blue,bold' +lexers.STYLE_FUNCTION = 'fore:white,bold' +lexers.STYLE_FUNCTION_BUILTIN = 'fore:white,bold' +lexers.STYLE_FUNCTION_METHOD = 'fore:white,bold' lexers.STYLE_CLASS = 'fore:yellow,bold' lexers.STYLE_TYPE = 'fore:green,bold' lexers.STYLE_LABEL = 'fore:green,bold' @@ -77,9 +76,9 @@ lexers.STYLE_EMBEDDED = 'back:blue,bold' lexers.STYLE_ANNOTATION = '' -- markup languages -lexers.STYLE_TAG = 'fore:red,bold' +lexers.STYLE_TAG = lexers.STYLE_KEYWORD lexers.STYLE_ATTRIBUTE = 'fore:green,bold' -lexers.STYLE_HEADING = 'fore:magenta,bold' +lexers.STYLE_HEADING = 'fore:white,bold' lexers.STYLE_BOLD = 'bold' lexers.STYLE_ITALIC = 'italics' lexers.STYLE_UNDERLINE = 'underlined' diff --git a/.config/vis/visrc.lua b/.config/vis/visrc.lua index 72fb879..364617b 100644 --- a/.config/vis/visrc.lua +++ b/.config/vis/visrc.lua @@ -1,5 +1,15 @@ 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.options.theme = require("themes.basic") @@ -20,24 +30,24 @@ vis.events.subscribe(vis.events.INIT, function() vis.options.ignorecase = true end) +-- window options vis.events.subscribe(vis.events.WIN_OPEN, function(win) - win.options.breakat = " .])}_" win.options.colorcolumn = 81 win.options.relativenumbers = true - win.options.tabwidth = 2 - win.options.wrapcolumn = 81 + + if win.syntax == 'markdown' then + win.options.breakat = " .])}_" + win.options.expandtab = true + win.options.tabwidth = 2 + win.options.wrapcolumn = 81 + 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) + set_statusline(win, mode_strings[vis.mode]) +end) + +function set_statusline(win, mode_string) local left_parts = {} local right_parts = {} local file = win.file @@ -47,7 +57,7 @@ vis.events.subscribe(vis.events.WIN_STATUS, function(win) if vis.win == win then -- mode - table.insert(left_parts, modes[vis.mode]) + table.insert(left_parts, mode_string) -- selection 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, selection.col) - local left = table.concat(left_parts, " ") - local right = table.concat(right_parts, " ") - win:status(left, right); -end) + win:status(table.concat(left_parts, " "), table.concat(right_parts, " ")); +end