Skip to content

Commit

Permalink
feat(editing-support): add multiple-cursors.nvim (#911)
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter committed Apr 23, 2024
1 parent 6bb14a2 commit 0a9b35e
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# multiple-cursors.nvim

A multi-cursor plugin for Neovim that works in normal, insert/replace, or visual modes, and with almost every command

**Repository:** <https://github.com/brenton-leighton/multiple-cursors.nvim>
39 changes: 39 additions & 0 deletions lua/astrocommunity/editing-support/multiple-cursors-nvim/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
return {
"brenton-leighton/multiple-cursors.nvim",
cmd = {
"MultipleCursorsAddDown",
"MultipleCursorsAddUp",
"MultipleCursorsMouseAddDelete",
"MultipleCursorsAddMatches",
"MultipleCursorsAddMatchesV",
"MultipleCursorsAddJumpNextMatch",
"MultipleCursorsJumpNextMatch",
"MultipleCursorsLock",
},
dependencies = {
"AstroNvim/astrocore",
opts = function(_, opts)
local maps = opts.mappings
for lhs, map in pairs {
["<C-Down>"] = { "<Cmd>MultipleCursorsAddDown<CR>", desc = "Add cursor down" },
["<C-Up>"] = { "<Cmd>MultipleCursorsAddUp<CR>", desc = "Add cursor up" },
["<C-LeftMouse>"] = { "<Cmd>MultipleCursorsMouseAddDelete<CR>", desc = "Add cursor with mouse" },
} do
maps.n[lhs] = map
maps.i[lhs] = map
end
local prefix = "<Leader>c"
for lhs, map in pairs {
[prefix .. "a"] = { "<Cmd>MultipleCursorsAddMatches<CR>", desc = "Add cursor matches" },
[prefix .. "A"] = { "<Cmd>MultipleCursorsAddMatchesV<CR>", desc = "Add cursor matches in previous visual area" },
[prefix .. "j"] = { "<Cmd>MultipleCursorsAddJumpNextMatch<CR>", desc = "Add cursor and jump to next match" },
[prefix .. "J"] = { "<Cmd>MultipleCursorsJumpNextMatch<CR>", desc = "Move cursor to next match" },
[prefix .. "l"] = { "<Cmd>MultipleCursorsLock<CR>", desc = "Lock virtual cursors" },
} do
maps.n[lhs] = map
maps.x[lhs] = map
end
end,
},
opts = {},
}

0 comments on commit 0a9b35e

Please sign in to comment.