From d42afdbcb29d07ac72e46ddc401951612df30d17 Mon Sep 17 00:00:00 2001 From: dacctal Date: Tue, 28 Apr 2026 10:11:46 +0000 Subject: changed some display stuff and added simple template to README.md --- README.md | 47 ++++++++++++++++++++++++++++++++++++++++++++++- init.lua | 4 ++-- 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index aa9d4d0..fecffae 100644 --- a/README.md +++ b/README.md @@ -6,4 +6,49 @@ modal is a status line colorizer for vis -right now, it's very opinionated, but I will eventually add the ability to customize it \ No newline at end of file +# Installation +To install vis-modal, clone this repository in your `~/.config/vis/plugins/` directory +Then, you can use it with the default configuration by putting this into your `~/.config/vis/visrc.lua`: +``` +local modal = require('plugins/modal') +``` + +# Customization +You can change the colors and mode descriptors in vis-modal to your liking, with this template: +``` +local modal = require('plugins/modal') +modal.MODES = { + [vis.modes.NORMAL] = ' NORMAL ', + [vis.modes.INSERT] = ' INSERT ', + [vis.modes.VISUAL] = ' VISUAL ', + [vis.modes.REPLACE] = ' REPLACE ', + [vis.modes.VISUAL_LINE] = ' VISUAL_LINE ', + [vis.modes.OPERATOR_PENDING] = ' OPERATOR_PENDING ' +} +modal.STYLES = { + [vis.modes.NORMAL] = { + REGULAR = 'fore:default,back:yellow', + INVERTED = 'fore:yellow,back:black', + }, + [vis.modes.INSERT] = { + REGULAR = 'fore:default,back:green', + INVERTED = 'fore:green,back:black', + }, + [vis.modes.VISUAL] = { + REGULAR = 'fore:default,back:magenta', + INVERTED = 'fore:magenta,back:black', + }, + [vis.modes.REPLACE] = { + REGULAR = 'fore:default,back:blue', + INVERTED = 'fore:blue,back:black', + }, + [vis.modes.VISUAL_LINE] = { + REGULAR = 'fore:default,back:magenta', + INVERTED = 'fore:magenta,back:black', + }, + [vis.modes.OPERATOR_PENDING] = { + REGULAR = 'fore:default,back:blue', + INVERTED = 'fore:blue,back:black', + }, +} +``` diff --git a/init.lua b/init.lua index 3d91d3d..9d1f859 100644 --- a/init.lua +++ b/init.lua @@ -67,10 +67,10 @@ vis.events.subscribe(vis.events.WIN_STATUS, function(win) cursors = 0 for _ in win:selections_iterator() do cursors = cursors+1 end selection_size = "SELECTION_SIZE: ".. - win.selection.range.finish-win.selection.range.start + win.selection.range.finish - win.selection.range.start cursor_amount = "CURSORS: "..cursors cursor_pos = win.selection.line..":"..win.selection.col - status_right = selection_size.." | "..cursor_amount.." @ "..cursor_pos + status_right = selection_size.." | "..cursor_amount.." | "..cursor_pos win:status(status_left, status_right) -- cgit v1.2.3