diff options
author | Marc Coquand <marc@mccd.space> | 2024-05-24 08:28:57 -0500 |
---|---|---|
committer | Marc Coquand <marc@mccd.space> | 2024-05-24 08:28:57 -0500 |
commit | 0a91d2af155c1a3a2835d4e03699b73085a4352f (patch) | |
tree | 720ebf61e80d62f2a8385ed1558bcb79e20b8f5d /config | |
parent | 57777a1aa586f23d9060596f8ac70ef3830e6d0c (diff) | |
download | rcm-0a91d2af155c1a3a2835d4e03699b73085a4352f.tar.gz rcm-0a91d2af155c1a3a2835d4e03699b73085a4352f.tar.bz2 rcm-0a91d2af155c1a3a2835d4e03699b73085a4352f.zip |
Updates
Diffstat (limited to 'config')
-rw-r--r-- | config/vis/visrc.lua | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/config/vis/visrc.lua b/config/vis/visrc.lua index 3ac1042..2085df7 100644 --- a/config/vis/visrc.lua +++ b/config/vis/visrc.lua @@ -1,23 +1,52 @@ require('vis') require('plugins/vis-pairs') -require('plugins/vis-lspc') +local lsp = require('plugins/vis-lspc') local format = require('plugins/vis-format') format.formatters.caml = format.stdio_formatter("ocamlformat --impl -") +lsp.highlight_diagnostics = 'range' +lsp.menu_cmd = 'vis-menu' + +vis:command_register("spell", function(argv, force, cur_win, selection, range) + vis:feedkeys(":!aspell -t -c $vis_filepath<Enter>") +end, 'Spell check file with aspell') vis:command_register("fd", function(argv, force, cur_win, selection, range) - local out = io.popen("fd . | vis-menu"):read() + local out = io.popen("fd . | vis-menu -i"):read() if out then vis:command(string.format('e'..' "%s"', out)) vis:feedkeys("<vis-redraw>") end end, 'fuzzy file search') +vis:command_register("grep", function(argv, force, cur_win, selection, range) + local out = io.popen("ugrep "..argv[1].." | vis-menu | cut -d: -f1"):read() + if out then + vis:command(string.format('e'..' "%s"', out)) + vis:feedkeys("<vis-redraw>") + end +end, 'Grep') + +vis:command_register("todo", function(argv, force, cur_win, selection, range) + vis:feedkeys("i* TODO ") +end, 'Add TODO item') + +vis:command_register("journal", function(argv, force, cur_win, selection, range) + vis:insert("* :journal:") + vis:feedkeys("11h") +end, 'Add journal entry') + vis.events.subscribe(vis.events.INIT, function() -- Your global configuration options + + vis:map(vis.modes.NORMAL, 'Y', ':> wl-copy 2>/dev/null -n<Enter>') + vis:map(vis.modes.VISUAL, 'y', ':> wl-copy 2>/dev/null -n<Enter>') vis:command('set theme minimal-light') vis:map(vis.modes.NORMAL, '=', format.apply) vis:map(vis.modes.NORMAL, ',', ":") - vis:map(vis.modes.VISUAL, 'gq', ":|fmt -w 80") + vis:map(vis.modes.VISUAL, ',', ":") + vis:map(vis.modes.VISUAL, 'gq', function() + vis:feedkeys(":|fmt -w 80<Enter>") + end) end) vis.events.subscribe(vis.events.WIN_OPEN, function(win) -- luacheck: no unused args |