refactor: unify MultiCursor keybindings under <leader>m prefix
This commit is contained in:
@@ -1197,5 +1197,35 @@ function M.exit()
|
||||
vim.api.nvim_command("wqall")
|
||||
end
|
||||
|
||||
---@function Function to render the MultiCursor statusline
|
||||
---@return table status The MultiCursor status object
|
||||
function M.mc_statusline()
|
||||
local mc = require("multicursor-nvim")
|
||||
local status = {}
|
||||
if mc.hasCursors() then
|
||||
status.enabled = true
|
||||
if vim.fn.mode() == "v" then
|
||||
status.icon = " "
|
||||
status.short_text = "V"
|
||||
status.text = "VISUAL"
|
||||
status.color = "lualine_a_visual"
|
||||
else
|
||||
status.icon = " "
|
||||
status.short_text = "N"
|
||||
status.text = "NORMAL"
|
||||
status.color = "lualine_a_normal"
|
||||
end
|
||||
else
|
||||
status.enabled = false
|
||||
status.icon = " "
|
||||
status.short_text = "NO"
|
||||
status.text = "SINGLE"
|
||||
status.color = "lualine_a_normal"
|
||||
end
|
||||
status.icon_short_text = status.icon .. status.short_text
|
||||
status.icon_text = status.icon .. status.text
|
||||
return status
|
||||
end
|
||||
|
||||
-- Export the module
|
||||
return M
|
||||
|
||||
+17
-12
@@ -561,6 +561,11 @@ M.group = {
|
||||
group = "New Commits",
|
||||
icon = { icon = "", color = "green" },
|
||||
},
|
||||
{ -- MultiCursor
|
||||
lhs = "<leader>m",
|
||||
group = "MultiCursor",
|
||||
icon = { icon = "", color = "green" },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -590,7 +595,7 @@ M.multicursor = {
|
||||
desc = "Add Cursor Below",
|
||||
},
|
||||
{
|
||||
"<c-n>",
|
||||
"<leader><c-n>",
|
||||
function()
|
||||
require("multicursor-nvim").addCursor("*")
|
||||
end,
|
||||
@@ -598,7 +603,7 @@ M.multicursor = {
|
||||
mode = { "n", "v" },
|
||||
},
|
||||
{
|
||||
"<c-s>",
|
||||
"<leader><c-s>",
|
||||
function()
|
||||
require("multicursor-nvim").skipCursor("*")
|
||||
end,
|
||||
@@ -622,7 +627,7 @@ M.multicursor = {
|
||||
mode = { "n", "v" },
|
||||
},
|
||||
{
|
||||
"<leader>x",
|
||||
"<leader>mx",
|
||||
function()
|
||||
require("multicursor-nvim").deleteCursor()
|
||||
end,
|
||||
@@ -638,7 +643,7 @@ M.multicursor = {
|
||||
mode = "n",
|
||||
},
|
||||
{
|
||||
"<c-q>",
|
||||
"<leader><c-q>",
|
||||
function()
|
||||
if require("multicursor-nvim").cursorsEnabled() then
|
||||
require("multicursor-nvim").disableCursors() -- Stop other cursors from moving, allowing main cursor repositioning.
|
||||
@@ -664,7 +669,7 @@ M.multicursor = {
|
||||
mode = "n",
|
||||
},
|
||||
{
|
||||
"<leader>a",
|
||||
"<leader>ma",
|
||||
function()
|
||||
require("multicursor-nvim").alignCursors()
|
||||
end,
|
||||
@@ -672,7 +677,7 @@ M.multicursor = {
|
||||
mode = "n",
|
||||
},
|
||||
{
|
||||
"S",
|
||||
"<leader>mS",
|
||||
function()
|
||||
require("multicursor-nvim").splitCursors()
|
||||
end,
|
||||
@@ -680,7 +685,7 @@ M.multicursor = {
|
||||
mode = "v",
|
||||
},
|
||||
{
|
||||
"I",
|
||||
"<leader>mI",
|
||||
function()
|
||||
require("multicursor-nvim").insertVisual()
|
||||
end,
|
||||
@@ -688,7 +693,7 @@ M.multicursor = {
|
||||
mode = "v",
|
||||
},
|
||||
{
|
||||
"A",
|
||||
"<leader>mA",
|
||||
function()
|
||||
require("multicursor-nvim").appendVisual()
|
||||
end,
|
||||
@@ -696,7 +701,7 @@ M.multicursor = {
|
||||
mode = "v",
|
||||
},
|
||||
{
|
||||
"M",
|
||||
"<leader>mM",
|
||||
function()
|
||||
require("multicursor-nvim").matchCursors()
|
||||
end,
|
||||
@@ -704,7 +709,7 @@ M.multicursor = {
|
||||
mode = "v",
|
||||
},
|
||||
{
|
||||
"<leader>t",
|
||||
"<leader>mt",
|
||||
function()
|
||||
require("multicursor-nvim").transposeCursors(1)
|
||||
end,
|
||||
@@ -712,7 +717,7 @@ M.multicursor = {
|
||||
mode = "v",
|
||||
},
|
||||
{
|
||||
"<leader>T",
|
||||
"<leader>mT",
|
||||
function()
|
||||
require("multicursor-nvim").transposeCursors(-1)
|
||||
end,
|
||||
@@ -1174,7 +1179,7 @@ M.substitute = {
|
||||
mode = "x",
|
||||
},
|
||||
{ -- Substitute visual selection in visual mode
|
||||
"<leader>r",
|
||||
"<leader>m",
|
||||
function()
|
||||
require("substitute").visual()
|
||||
end,
|
||||
|
||||
@@ -138,12 +138,25 @@ return { -- Lualine
|
||||
},
|
||||
sections = { -- Sections
|
||||
lualine_a = {
|
||||
{
|
||||
-- Calls the current.lualine() function to get the mode string
|
||||
{ -- Mode
|
||||
function()
|
||||
return data.types.mode.current.lualine()
|
||||
end,
|
||||
padding = { left = 1, right = 0 },
|
||||
separator = { left = "", right = "" },
|
||||
},
|
||||
{ -- MultiCursors
|
||||
function()
|
||||
return data.func.mc_statusline().icon
|
||||
end,
|
||||
cond = function()
|
||||
return data.func.mc_statusline().enabled
|
||||
end,
|
||||
color = function()
|
||||
return data.func.mc_statusline().color
|
||||
end,
|
||||
padding = { left = 0, right = 0 },
|
||||
separator = { left = "", right = "" },
|
||||
},
|
||||
},
|
||||
lualine_b = {
|
||||
@@ -405,6 +418,7 @@ return { -- Lualine
|
||||
on_click = function()
|
||||
vim.cmd("Telescope oldfiles")
|
||||
end,
|
||||
separator = { left = "", right = "" },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user