summaryrefslogtreecommitdiff
path: root/arch/lightvim/.config
diff options
context:
space:
mode:
authorsteven-na <noreply.github@stvnc.dev>2026-06-30 19:55:05 -0700
committersteven-na <noreply.github@stvnc.dev>2026-06-30 19:55:05 -0700
commit3bb4ec6ec4d5d4adaf15d22899788c3db407bdad (patch)
tree727b08af1d963e697dbc28f9fa72ce98a9effd6f /arch/lightvim/.config
parent77f8963a603824f3f67ebadfe085b10b9026f378 (diff)
2 different vim versions
Diffstat (limited to 'arch/lightvim/.config')
-rw-r--r--arch/lightvim/.config/lightvim/lua/plugins.lua128
1 files changed, 73 insertions, 55 deletions
diff --git a/arch/lightvim/.config/lightvim/lua/plugins.lua b/arch/lightvim/.config/lightvim/lua/plugins.lua
index d9b563b..2f737b2 100644
--- a/arch/lightvim/.config/lightvim/lua/plugins.lua
+++ b/arch/lightvim/.config/lightvim/lua/plugins.lua
@@ -102,64 +102,82 @@ return {
config = function()
local mc = require("multicursor-nvim")
mc.setup()
- local set = vim.keymap.set
local nv = { "n", "v" }
- -- Adding cursors (Alt+Shift+arrow — Ctrl+Shift+arrow is move-line)
- set(nv, "<M-S-Down>", function() mc.lineAddCursor(1) end, { desc = "Add cursor down" })
- set(nv, "<M-S-Up>", function() mc.lineAddCursor(-1) end, { desc = "Add cursor up" })
-
- -- Skipping (advance without dropping a cursor)
- set(nv, "<leader>m<Down>", function() mc.lineSkipCursor(1) end, { desc = "Skip line down" })
- set(nv, "<leader>m<Up>", function() mc.lineSkipCursor(-1) end, { desc = "Skip line up" })
-
- -- Match-based add / skip
- set(nv, "<leader>mn", function() mc.matchAddCursor(1) end, { desc = "Add cursor: next match" })
- set(nv, "<leader>mp", function() mc.matchAddCursor(-1) end, { desc = "Add cursor: prev match" })
- set(nv, "<leader>ms", function() mc.matchSkipCursor(1) end, { desc = "Skip match, advance" })
- set(nv, "<leader>mA", mc.matchAllAddCursors, { desc = "Cursors for all matches" })
-
- -- Repeat keys: ;/, add or skip when cursors active; default f/F/t/T otherwise
- set("n", ";", function()
- if mc.hasCursors() then mc.matchAddCursor(1) else vim.cmd("normal! ;") end
- end, { desc = "Repeat f/F/t/T · next-match cursor when active" })
- set("n", ",", function()
- if mc.hasCursors() then mc.matchSkipCursor(1) else vim.cmd("normal! ,") end
- end, { desc = "Reverse f/F/t/T · skip-match when active" })
-
- -- Manual toggle / delete
- set(nv, "<leader>mt", mc.toggleCursor, { desc = "Toggle cursor here" })
- set(nv, "<leader>mx", mc.deleteCursor, { desc = "Delete cursor under main" })
-
- -- Rotate / jump main focus through cursor list (arrows)
- set(nv, "<leader>m<Right>", mc.nextCursor, { desc = "Rotate to next cursor" })
- set(nv, "<leader>m<Left>", mc.prevCursor, { desc = "Rotate to prev cursor" })
- set(nv, "<leader>mF", mc.firstCursor, { desc = "Jump to first cursor" })
- set(nv, "<leader>mL", mc.lastCursor, { desc = "Jump to last cursor" })
-
- -- Bulk ops
- set(nv, "<leader>m=", mc.alignCursors, { desc = "Align cursors" })
- set(nv, "<leader>mu", mc.restoreCursors, { desc = "Restore last cursors" })
- set(nv, "<leader>md", function()
- if mc.cursorsEnabled() then mc.disableCursors() else mc.enableCursors() end
- end, { desc = "Freeze/unfreeze cursors" })
- set(nv, "<leader>m.", function() mc.transposeCursors(1) end, { desc = "Transpose forward" })
- set(nv, "<leader>m,", function() mc.transposeCursors(-1) end, { desc = "Transpose back" })
-
- -- Pattern-based (visual mode — needs a selection)
- set("x", "<leader>m/", mc.matchCursors, { desc = "Cursors at regex matches" })
- set("x", "<leader>mS", mc.splitCursors, { desc = "Split selection by pattern" })
-
- -- Esc: re-enable / clear / nohlsearch
- set("n", "<esc>", function()
- if not mc.cursorsEnabled() then
- mc.enableCursors()
- elseif mc.hasCursors() then
- mc.clearCursors()
- else
- vim.cmd("nohlsearch")
+ -- Bind everything via a function so we can re-apply per-buffer
+ -- (oil buffers set their own buffer-local maps that would otherwise
+ -- shadow these globals).
+ local function bind(buf)
+ local opts_base = buf and { buffer = buf } or {}
+ local function set(mode, lhs, rhs, opts)
+ local o = vim.tbl_extend("force", opts_base, opts or {})
+ vim.keymap.set(mode, lhs, rhs, o)
end
- end)
+
+ -- Adding cursors (Alt+Shift+arrow — Ctrl+Shift+arrow is move-line)
+ set(nv, "<M-S-Down>", function() mc.lineAddCursor(1) end, { desc = "Add cursor down" })
+ set(nv, "<M-S-Up>", function() mc.lineAddCursor(-1) end, { desc = "Add cursor up" })
+
+ -- Skipping (advance without dropping a cursor)
+ set(nv, "<leader>m<Down>", function() mc.lineSkipCursor(1) end, { desc = "Skip line down" })
+ set(nv, "<leader>m<Up>", function() mc.lineSkipCursor(-1) end, { desc = "Skip line up" })
+
+ -- Match-based add / skip
+ set(nv, "<leader>mn", function() mc.matchAddCursor(1) end, { desc = "Add cursor: next match" })
+ set(nv, "<leader>mp", function() mc.matchAddCursor(-1) end, { desc = "Add cursor: prev match" })
+ set(nv, "<leader>ms", function() mc.matchSkipCursor(1) end, { desc = "Skip match, advance" })
+ set(nv, "<leader>mA", mc.matchAllAddCursors, { desc = "Cursors for all matches" })
+
+ -- Repeat keys: ;/, add or skip when cursors active; default f/F/t/T otherwise
+ set("n", ";", function()
+ if mc.hasCursors() then mc.matchAddCursor(1) else vim.cmd("normal! ;") end
+ end, { desc = "Repeat f/F/t/T · next-match cursor when active" })
+ set("n", ",", function()
+ if mc.hasCursors() then mc.matchSkipCursor(1) else vim.cmd("normal! ,") end
+ end, { desc = "Reverse f/F/t/T · skip-match when active" })
+
+ -- Manual toggle / delete
+ set(nv, "<leader>mt", mc.toggleCursor, { desc = "Toggle cursor here" })
+ set(nv, "<leader>mx", mc.deleteCursor, { desc = "Delete cursor under main" })
+
+ -- Rotate / jump main focus through cursor list (arrows)
+ set(nv, "<leader>m<Right>", mc.nextCursor, { desc = "Rotate to next cursor" })
+ set(nv, "<leader>m<Left>", mc.prevCursor, { desc = "Rotate to prev cursor" })
+ set(nv, "<leader>mF", mc.firstCursor, { desc = "Jump to first cursor" })
+ set(nv, "<leader>mL", mc.lastCursor, { desc = "Jump to last cursor" })
+
+ -- Bulk ops
+ set(nv, "<leader>m=", mc.alignCursors, { desc = "Align cursors" })
+ set(nv, "<leader>mu", mc.restoreCursors, { desc = "Restore last cursors" })
+ set(nv, "<leader>md", function()
+ if mc.cursorsEnabled() then mc.disableCursors() else mc.enableCursors() end
+ end, { desc = "Freeze/unfreeze cursors" })
+ set(nv, "<leader>m.", function() mc.transposeCursors(1) end, { desc = "Transpose forward" })
+ set(nv, "<leader>m,", function() mc.transposeCursors(-1) end, { desc = "Transpose back" })
+
+ -- Pattern-based (visual mode — needs a selection)
+ set("x", "<leader>m/", mc.matchCursors, { desc = "Cursors at regex matches" })
+ set("x", "<leader>mS", mc.splitCursors, { desc = "Split selection by pattern" })
+
+ -- Esc: re-enable / clear / nohlsearch
+ set("n", "<esc>", function()
+ if not mc.cursorsEnabled() then
+ mc.enableCursors()
+ elseif mc.hasCursors() then
+ mc.clearCursors()
+ else
+ vim.cmd("nohlsearch")
+ end
+ end)
+ end
+
+ bind(nil)
+
+ -- Re-bind buffer-local for oil so its keymaps don't shadow ours.
+ vim.api.nvim_create_autocmd("FileType", {
+ pattern = "oil",
+ callback = function(args) bind(args.buf) end,
+ })
end,
},