Configuration for my NixOS based systems and Home Manager
1require('vis')
2local plugins = {
3 --{ 'timoha/vis-acme', theme = true, file = 'acme' },
4 { 'milhnl/vis-format' },
5 { url = 'https://git.cepl.eu/cgit/vis/vis-fzf-open' },
6 { url = 'https://gitlab.com/muhq/vis-lspc.git' },
7 { url = 'https://repo.or.cz/vis-parkour.git', alias = 'vis-parkour' },
8}
9
10local function setup_plug()
11 if not pcall(require, 'plugins/vis-plug') then
12 os.execute('git clone --quiet https://github.com/erf/vis-plug ' ..
13 (os.getenv('XDG_CONFIG_HOME') or os.getenv('HOME') .. '/.config')
14 .. '/vis/plugins/vis-plug')
15 end
16 return require('plugins/vis-plug')
17end
18local plug = setup_plug()
19
20plug.init(plugins, true)
21
22local function configure_plugin(name, config)
23 if vis:module_exist(name) then
24 local module = require(name)
25 config(module)
26 end
27end
28
29vis.events.subscribe(vis.events.INIT, function()
30 configure_plugin('plugins/vis-format', function(format)
31 vis:map(vis.modes.NORMAL, '<C-p>', ':fzf<Enter>')
32 vis:map(vis.modes.NORMAL, '=', format.apply)
33 end)
34 configure_plugin('plugins/vis-lspc', function(lspc)
35 if next(lspc) then
36 lspc.logging = true
37 lspc.log_file = "/tmp/lspc.log"
38
39 lspc.ls_map.rust = {
40 name = "rust",
41 cmd = "rust-analyzer",
42 formatting_options = {tabSize = 4, insertSpaces = true}
43 }
44 lspc.ls_map.lua = {
45 name = "lua",
46 cmd = "lua-language-server",
47 formatting_options = { insertSpaces = false }
48 }
49 end
50 end)
51end)
52
53
54vis.events.subscribe(vis.events.WIN_OPEN, function()
55 --per-window configuration--
56 --vis:command('set number')
57 --vis:command('set showtab on')
58 vis:command('set showspace off')
59 vis:command('set autoindent on')
60 vis:command('set cursorline on')
61 vis:command('set tabwidth 4')
62 vis:command('set theme zenburn')
63end)
64return nil