commit 6e172618cd196cd8e6ca8bfe99ea4769c2d5b809
parent 32e6ba2a9f62ecf4c2741defbdeb796762013edf
Author: mrgrouse <mrgrouse@mrgrouse.com>
Date: Thu, 22 Oct 2026 22:24:04 -0400
visrc.lua: add & configure vis-format plugin and format with lua-formatter
Diffstat:
| M | visrc.lua | | | 31 | ++++++++++++++++++------------- |
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/visrc.lua b/visrc.lua
@@ -2,18 +2,18 @@
require("vis")
vis.events.subscribe(vis.events.INIT, function()
- -- functions to be ran on INIT event
- background = "dark"
- vis:command("set theme base16-vis/themes/base16-summerfruit-dark")
+ -- functions to be ran on INIT event
+ background = "dark"
+ vis:command("set theme base16-vis/themes/base16-summerfruit-dark")
end)
-- functions ran on window opening
vis.events.subscribe(vis.events.WIN_OPEN, function(win)
- vis:command("set number")
- vis:command("set autoindent on")
- vis:command("set tabwidth 2")
- vis:command("set autoindent true")
- vis:command("set shell /usr/local/bin/lksh")
+ vis:command("set number")
+ vis:command("set autoindent on")
+ vis:command("set tabwidth 2")
+ vis:command("set autoindent true")
+ vis:command("set shell /bin/sh")
end)
-- initializing plugin manager
@@ -21,15 +21,20 @@ local plug = require("plugins/vis-plug")
-- configure plugins in an array of tables with git urls and options
local plugins = {
- {"thimc/vis-colorizer"},
- {"e-zk/vis-shebang"},
- {"nomarian/vis-remove-trailing-whitespace", alias = "rtw"},
- {"https://codeberg.org/luxanna/vis-autoclose"},
- {"https://git.symlinx.net/vis-modal"}
+ { "thimc/vis-colorizer" },
+ { "e-zk/vis-shebang" },
+ { "nomarian/vis-remove-trailing-whitespace", alias = "rtw" },
+ { "https://codeberg.org/luxanna/vis-autoclose" },
+ { "https://git.symlinx.net/vis-modal" },
+ { "milhnl/vis-format", alias = "fmt" },
}
-- initialize vis-plug and plugins
plug.init(plugins, true)
+vis:map(vis.modes.NORMAL, "=", plug.plugins.fmt.apply)
-- initialize remove-trailing-whitespace plugin
plug.plugins.rtw.Subscribe()
+
+-- formatter
+plug.plugins.fmt.formatters.ansi_c = plug.plugins.fmt.stdio_formatter("clang-format")