From 4fdebf47fd52d5aacf4b157bb7d51041d10f04c9 Mon Sep 17 00:00:00 2001 From: Noah Pederson Date: Mon, 30 Jun 2025 06:31:35 -0500 Subject: [PATCH] FIX: visrc --- vis/visrc.lua | 76 +++++++++++++++++++++++++++------------------------ 1 file changed, 41 insertions(+), 35 deletions(-) diff --git a/vis/visrc.lua b/vis/visrc.lua index 7ad234f..22aea0d 100644 --- a/vis/visrc.lua +++ b/vis/visrc.lua @@ -1,7 +1,5 @@ require('vis') - -local plug = require('plugins/vis-plug') - +local plugin_manager = 'plugins/vis-plug' local plugins = { { 'timoha/vis-acme', theme = true, file = 'acme' }, { 'milhnl/vis-format' }, @@ -10,49 +8,57 @@ local plugins = { { url = 'https://repo.or.cz/vis-parkour.git', alias = 'vis-parkour' } } +function setup_plug() + if not pcall(require, 'plugins/vis-plug') then + os.execute('git clone --quiet https://github.com/erf/vis-plug ' .. + (os.getenv('XDG_CONFIG_HOME') or os.getenv('HOME') .. '/.config') + .. '/vis/plugins/vis-plug') + end + return require('plugins/vis-plug') +end +local plug = setup_plug() + plug.init(plugins, true) +function configure_plugin(name, config) + if vis:module_exist(name) then + local module = require(name) + config(module) + end +end + vis.events.subscribe(vis.events.INIT, function() - vis:command('set theme zenburn') - local format = require('plugins/vis-format') - vis:map(vis.modes.NORMAL, '', ':fzf') - vis:map(vis.modes.NORMAL, '=', format.apply) - local lspc = require('plugins/vis-lspc') - if next(lspc) then - lspc.logging = true - lspc.log_file = "/tmp/lspc.log" + configure_plugin('plugins/vis-format', function(format) + vis:map(vis.modes.NORMAL, '', ':fzf') + vis:map(vis.modes.NORMAL, '=', format.apply) + end) + configure_plugin('plugins/vis-lspc', function(lspc) + if next(lspc) then + lspc.logging = true + lspc.log_file = "/tmp/lspc.log" - lspc.ls_map.rust = { - name = "rust", - cmd = "rust-analyzer", - formatting_options = {tabSize = 4, insertSpaces = true} - } - lspc.ls_map.nix = { - name = "nix", - cmd = "nil", - formatting_options = {tabSize = 2, insertSpace = true} - } - lspc.ls_map.python = { - name = "python", - cmd = "python-lsp-server", - formatting_options = {tabSize = 4, insertSpaces = true}, - roots = {"pyproject.toml", "requirements.txt", "setup.py"} - } - end + lspc.ls_map.rust = { + name = "rust", + cmd = "rust-analyzer", + formatting_options = {tabSize = 4, insertSpaces = true} + } + lspc.ls_map.lua = { + name = "lua", + cmd = "lua-language-server", + formatting_options = { insertSpaces = false } + } + end + end) end) -vis.events.subscribe(vis.events.WIN_OPEN, function(win) +vis.events.subscribe(vis.events.WIN_OPEN, function() --per-window configuration-- --vis:command('set number') - vis:command('set showtab off') + --vis:command('set showtab on') vis:command('set showspace off') vis:command('set autoindent on') vis:command('set cursorline on') vis:command('set tabwidth 4') - vis:command('set expandtab on') end) - - - - +return nil -- 2.51.2