summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Mora Unie Youer <[email protected]>2025-05-08 12:57:13 +0300
committerLibravatar Mora Unie Youer <[email protected]>2025-05-08 12:57:13 +0300
commitb2a2120e780506e88d73b87af5bb5f46aa68e368 (patch)
treed4451a6052d413f2b93f4b16fb78f9f5d2259cb6
parentfeat: add `yanky.nvim` (diff)
downloadneovim-configuration-b2a2120e780506e88d73b87af5bb5f46aa68e368.tar.gz
neovim-configuration-b2a2120e780506e88d73b87af5bb5f46aa68e368.tar.bz2
neovim-configuration-b2a2120e780506e88d73b87af5bb5f46aa68e368.tar.lz
neovim-configuration-b2a2120e780506e88d73b87af5bb5f46aa68e368.tar.xz
neovim-configuration-b2a2120e780506e88d73b87af5bb5f46aa68e368.tar.zst
neovim-configuration-b2a2120e780506e88d73b87af5bb5f46aa68e368.zip
feat: add `multicursor-nvim`
Diffstat (limited to '')
-rw-r--r--flake.lock17
-rw-r--r--flake.nix9
-rw-r--r--lua/config/plugins/extra.lua54
3 files changed, 80 insertions, 0 deletions
diff --git a/flake.lock b/flake.lock
index 26fc91d..d83ab51 100644
--- a/flake.lock
+++ b/flake.lock
@@ -244,6 +244,22 @@
"type": "github"
}
},
+ "plugins-multicursor-nvim": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1746157028,
+ "narHash": "sha256-ZV4/QolvzaxV0SoPwO3Orf3HCJGD2+J15WKRUe0Hauw=",
+ "owner": "jake-stewart",
+ "repo": "multicursor.nvim",
+ "rev": "0e00ce4c272e3191b5e07cab36bd49aa32fca675",
+ "type": "github"
+ },
+ "original": {
+ "owner": "jake-stewart",
+ "repo": "multicursor.nvim",
+ "type": "github"
+ }
+ },
"plugins-telepath-nvim": {
"flake": false,
"locked": {
@@ -266,6 +282,7 @@
"nixCats": "nixCats",
"nixpkgs": "nixpkgs_2",
"plugins-leap-spooky-nvim": "plugins-leap-spooky-nvim",
+ "plugins-multicursor-nvim": "plugins-multicursor-nvim",
"plugins-telepath-nvim": "plugins-telepath-nvim"
}
},
diff --git a/flake.nix b/flake.nix
index 525edf1..e54c461 100644
--- a/flake.nix
+++ b/flake.nix
@@ -47,6 +47,11 @@
url = "github:rasulomaroff/telepath.nvim";
flake = false;
};
+
+ plugins-multicursor-nvim = {
+ url = "github:jake-stewart/multicursor.nvim";
+ flake = false;
+ };
};
# see :help nixCats.flake.outputs
@@ -197,6 +202,10 @@
leap-spooky-nvim
telepath-nvim
];
+
+ extra = [
+ multicursor-nvim
+ ];
};
general = with pkgs.vimPlugins; {
diff --git a/lua/config/plugins/extra.lua b/lua/config/plugins/extra.lua
index 4bbc381..03748fb 100644
--- a/lua/config/plugins/extra.lua
+++ b/lua/config/plugins/extra.lua
@@ -1,5 +1,59 @@
return {
{
+ "multicursor-nvim",
+ event = "DeferredUIEnter",
+ after = function(_)
+ local mc = require("multicursor-nvim")
+ mc.setup({
+ signs = false,
+ })
+
+ -- Keybindings would be a lot better as <localleader>
+ local map = vim.keymap.set
+
+ -- NOTE: this required for "repeatable" commands
+ -- I'd like to use `2<localleader>cn` for example (and that doesn't work out of box)
+ local map_rep = function(modes, bind, action)
+ map(modes, bind, function()
+ for _ = 1, vim.v.count1, 1 do
+ action()
+ end
+ end)
+ end
+
+ -- stylua: ignore start
+ map({ "n", "x" }, "<localleader><localleader>", function() mc.clearCursors() end)
+ map({ "n", "x" }, "<localleader>R", function() mc.restoreCursors() end)
+
+ map_rep({ "n", "x" }, "<localleader>j", function() mc.lineAddCursor(1) end)
+ map_rep({ "n", "x" }, "<localleader>k", function() mc.lineAddCursor(-1) end)
+ map_rep({ "n", "x" }, "<localleader>J", function() mc.lineSkipCursor(1) end)
+ map_rep({ "n", "x" }, "<localleader>K", function() mc.lineSkipCursor(-1) end)
+
+ map_rep({ "n", "x" }, "<localleader>cn", function() mc.matchAddCursor(1) end)
+ map_rep({ "n", "x" }, "<localleader>cN", function() mc.matchAddCursor(-1) end)
+ map_rep({ "n", "x" }, "<localleader>cs", function() mc.matchSkipCursor(1) end)
+ map_rep({ "n", "x" }, "<localleader>cS", function() mc.matchSkipCursor(-1) end)
+ map({ "n", "x" }, "<localleader>cM", mc.matchAllAddCursors)
+ map("x", "<localleader>m", mc.matchCursors)
+ map("x", "<localleader>s", mc.splitCursors)
+
+ -- map("n", "<localleader>g", mc.addCursorOperator)
+ map({ "n", "x" }, "<localleader>g", mc.operator)
+ -- stylua: ignore end
+
+ -- Customize how cursors look.
+ local hl = vim.api.nvim_set_hl
+ hl(0, "MultiCursorCursor", { reverse = true })
+ hl(0, "MultiCursorVisual", { link = "Visual" })
+ hl(0, "MultiCursorSign", { link = "SignColumn" })
+ hl(0, "MultiCursorMatchPreview", { link = "Search" })
+ hl(0, "MultiCursorDisabledCursor", { reverse = true })
+ hl(0, "MultiCursorDisabledVisual", { link = "Visual" })
+ hl(0, "MultiCursorDisabledSign", { link = "SignColumn" })
+ end,
+ },
+ {
"yanky.nvim",
event = "DeferredUIEnter",
after = function(_)