1
0
Fork 0
mirror of https://github.com/nix-community/nixvim.git synced 2025-11-20 09:19:41 +01:00

plugins/multicursors: migrate to mkNeovimPlugin

This commit is contained in:
Austin Horstman 2025-10-04 12:14:38 -05:00 committed by Gaétan Lepage
parent ce149cac11
commit 2f8fbcdfd0
3 changed files with 213 additions and 284 deletions

View file

@ -1,9 +1,44 @@
{
lib,
...
}:
{
empty = {
# ERROR: [Hydra.nvim] Option "hint.border" has been deprecated and will be removed on 2024-02-01 -- See hint.float_opts
# Will be fixed by:
# https://github.com/smoka7/multicursors.nvim/pull/91
plugins.multicursors.enable = false;
plugins.multicursors.enable = true;
};
defaults = {
plugins.multicursors = {
enable = true;
settings = {
DEBUG_MODE = false;
create_commands = true;
updatetime = 50;
nowait = true;
mode_keys = {
append = "a";
change = "c";
extend = "e";
insert = "i";
};
hint_config = {
float_opts = {
border = "none";
};
position = "bottom";
};
generate_hints = {
normal = true;
insert = true;
extend = true;
config = {
column_count = null;
max_hint_length = 25;
};
};
};
};
};
example = {
@ -13,53 +48,55 @@
# https://github.com/smoka7/multicursors.nvim/pull/91
enable = false;
debugMode = false;
createCommands = true;
updatetime = 50;
nowait = true;
normalKeys = {
# to change default lhs of key mapping, change the key
"," = {
# assigning `null` to method exits from multi cursor mode
# assigning `false` to method removes the binding
method = "require 'multicursors.normal_mode'.clear_others";
settings = {
DEBUG_MODE = false;
create_commands = true;
updatetime = 50;
nowait = true;
normal_keys = {
# to change default lhs of key mapping, change the key
"," = {
# assigning `null` to method exits from multi cursor mode
# assigning `false` to method removes the binding
method = lib.nixvim.mkRaw "require('multicursors.normal_mode').clear_others";
# you can pass :map-arguments here
opts = {
desc = "Clear others";
# you can pass :map-arguments here
opts = {
desc = "Clear others";
};
};
"<C-/>" = {
method = lib.nixvim.mkRaw ''
function()
require('multicursors.utils').call_on_selections(
function(selection)
vim.api.nvim_win_set_cursor(0, { selection.row + 1, selection.col + 1 })
local line_count = selection.end_row - selection.row + 1
vim.cmd('normal ' .. line_count .. 'gcc')
end
)
end
'';
opts = {
desc = "comment selections";
};
};
};
"<C-/>" = {
method = ''
function()
require('multicursors.utils').call_on_selections(
function(selection)
vim.api.nvim_win_set_cursor(0, { selection.row + 1, selection.col + 1 })
local line_count = selection.end_row - selection.row + 1
vim.cmd('normal ' .. line_count .. 'gcc')
end
)
end
'';
opts = {
desc = "comment selections";
};
insert_keys = null;
extend_keys = null;
hint_config = {
type = "window";
position = "bottom";
offset = 0;
border = "none";
show_name = true;
funcs = null;
};
generate_hints = {
normal = false;
insert = false;
extend = false;
};
};
insertKeys = null;
extendKeys = null;
hintConfig = {
type = "window";
position = "bottom";
offset = 0;
border = "none";
showName = true;
funcs = null;
};
generateHints = {
normal = false;
insert = false;
extend = false;
};
};
};