-
-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(editing-support): add vim-visual-multi (#797)
* feat(editing-support): add vim-visual-multi * Apply suggestions from code review Co-authored-by: Micah Halter <micah@mehalter.com> --------- Co-authored-by: Micah Halter <micah@mehalter.com>
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
lua/astrocommunity/editing-support/vim-visual-multi/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# vim-visual-multi | ||
|
||
Multiple cursors plugin for vim/neovim. | ||
|
||
**Repository:** <https://github.com/mg979/vim-visual-multi> |
32 changes: 32 additions & 0 deletions
32
lua/astrocommunity/editing-support/vim-visual-multi/init.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
return { | ||
"mg979/vim-visual-multi", | ||
event = { "User AstroFile", "InsertEnter" }, | ||
dependencies = { | ||
"astronvim/astrocore", | ||
---@param opts astrocoreopts | ||
opts = function(_, opts) | ||
if not opts.options then opts.options = {} end | ||
if not opts.options.g then opts.options.g = {} end | ||
opts.options.g.VM_silent_exit = 1 | ||
opts.options.g.VM_show_warnings = 0 | ||
|
||
if not opts.autocmds then opts.autocmds = {} end | ||
opts.autocmds.visual_multi_exit = { | ||
{ | ||
event = "User", | ||
pattern = "visual_multi_exit", | ||
desc = "Avoid spurious 'hit-enter-prompt' when exiting vim-visual-multi", | ||
callback = function() | ||
vim.o.cmdheight = 1 | ||
vim.schedule(function() vim.o.cmdheight = opts.options.opt.cmdheight end) | ||
end, | ||
}, | ||
} | ||
|
||
if not opts.mappings then opts.mappings = require("astrocore").empty_map_table() end | ||
local maps = assert(opts.mappings) | ||
maps.n["<C-up>"] = { "<C-u>call vm#commands#add_cursor_up(0, v:count1)<cr>", desc = "Add cursor above" } | ||
maps.n["<C-down>"] = { "<C-u>call vm#commands#add_cursor_down(0, v:count1)<cr>", desc = "Add cursor below" } | ||
end, | ||
}, | ||
} |