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