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")
|
vim.api.nvim_command("wqall")
|
||||||
end
|
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
|
-- Export the module
|
||||||
return M
|
return M
|
||||||
|
|||||||
+17
-12
@@ -561,6 +561,11 @@ M.group = {
|
|||||||
group = "New Commits",
|
group = "New Commits",
|
||||||
icon = { icon = "", color = "green" },
|
icon = { icon = "", color = "green" },
|
||||||
},
|
},
|
||||||
|
{ -- MultiCursor
|
||||||
|
lhs = "<leader>m",
|
||||||
|
group = "MultiCursor",
|
||||||
|
icon = { icon = "", color = "green" },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -590,7 +595,7 @@ M.multicursor = {
|
|||||||
desc = "Add Cursor Below",
|
desc = "Add Cursor Below",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<c-n>",
|
"<leader><c-n>",
|
||||||
function()
|
function()
|
||||||
require("multicursor-nvim").addCursor("*")
|
require("multicursor-nvim").addCursor("*")
|
||||||
end,
|
end,
|
||||||
@@ -598,7 +603,7 @@ M.multicursor = {
|
|||||||
mode = { "n", "v" },
|
mode = { "n", "v" },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<c-s>",
|
"<leader><c-s>",
|
||||||
function()
|
function()
|
||||||
require("multicursor-nvim").skipCursor("*")
|
require("multicursor-nvim").skipCursor("*")
|
||||||
end,
|
end,
|
||||||
@@ -622,7 +627,7 @@ M.multicursor = {
|
|||||||
mode = { "n", "v" },
|
mode = { "n", "v" },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>x",
|
"<leader>mx",
|
||||||
function()
|
function()
|
||||||
require("multicursor-nvim").deleteCursor()
|
require("multicursor-nvim").deleteCursor()
|
||||||
end,
|
end,
|
||||||
@@ -638,7 +643,7 @@ M.multicursor = {
|
|||||||
mode = "n",
|
mode = "n",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<c-q>",
|
"<leader><c-q>",
|
||||||
function()
|
function()
|
||||||
if require("multicursor-nvim").cursorsEnabled() then
|
if require("multicursor-nvim").cursorsEnabled() then
|
||||||
require("multicursor-nvim").disableCursors() -- Stop other cursors from moving, allowing main cursor repositioning.
|
require("multicursor-nvim").disableCursors() -- Stop other cursors from moving, allowing main cursor repositioning.
|
||||||
@@ -664,7 +669,7 @@ M.multicursor = {
|
|||||||
mode = "n",
|
mode = "n",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>a",
|
"<leader>ma",
|
||||||
function()
|
function()
|
||||||
require("multicursor-nvim").alignCursors()
|
require("multicursor-nvim").alignCursors()
|
||||||
end,
|
end,
|
||||||
@@ -672,7 +677,7 @@ M.multicursor = {
|
|||||||
mode = "n",
|
mode = "n",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"S",
|
"<leader>mS",
|
||||||
function()
|
function()
|
||||||
require("multicursor-nvim").splitCursors()
|
require("multicursor-nvim").splitCursors()
|
||||||
end,
|
end,
|
||||||
@@ -680,7 +685,7 @@ M.multicursor = {
|
|||||||
mode = "v",
|
mode = "v",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"I",
|
"<leader>mI",
|
||||||
function()
|
function()
|
||||||
require("multicursor-nvim").insertVisual()
|
require("multicursor-nvim").insertVisual()
|
||||||
end,
|
end,
|
||||||
@@ -688,7 +693,7 @@ M.multicursor = {
|
|||||||
mode = "v",
|
mode = "v",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"A",
|
"<leader>mA",
|
||||||
function()
|
function()
|
||||||
require("multicursor-nvim").appendVisual()
|
require("multicursor-nvim").appendVisual()
|
||||||
end,
|
end,
|
||||||
@@ -696,7 +701,7 @@ M.multicursor = {
|
|||||||
mode = "v",
|
mode = "v",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"M",
|
"<leader>mM",
|
||||||
function()
|
function()
|
||||||
require("multicursor-nvim").matchCursors()
|
require("multicursor-nvim").matchCursors()
|
||||||
end,
|
end,
|
||||||
@@ -704,7 +709,7 @@ M.multicursor = {
|
|||||||
mode = "v",
|
mode = "v",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>t",
|
"<leader>mt",
|
||||||
function()
|
function()
|
||||||
require("multicursor-nvim").transposeCursors(1)
|
require("multicursor-nvim").transposeCursors(1)
|
||||||
end,
|
end,
|
||||||
@@ -712,7 +717,7 @@ M.multicursor = {
|
|||||||
mode = "v",
|
mode = "v",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>T",
|
"<leader>mT",
|
||||||
function()
|
function()
|
||||||
require("multicursor-nvim").transposeCursors(-1)
|
require("multicursor-nvim").transposeCursors(-1)
|
||||||
end,
|
end,
|
||||||
@@ -1174,7 +1179,7 @@ M.substitute = {
|
|||||||
mode = "x",
|
mode = "x",
|
||||||
},
|
},
|
||||||
{ -- Substitute visual selection in visual mode
|
{ -- Substitute visual selection in visual mode
|
||||||
"<leader>r",
|
"<leader>m",
|
||||||
function()
|
function()
|
||||||
require("substitute").visual()
|
require("substitute").visual()
|
||||||
end,
|
end,
|
||||||
|
|||||||
@@ -138,12 +138,25 @@ return { -- Lualine
|
|||||||
},
|
},
|
||||||
sections = { -- Sections
|
sections = { -- Sections
|
||||||
lualine_a = {
|
lualine_a = {
|
||||||
{
|
{ -- Mode
|
||||||
-- Calls the current.lualine() function to get the mode string
|
|
||||||
function()
|
function()
|
||||||
return data.types.mode.current.lualine()
|
return data.types.mode.current.lualine()
|
||||||
end,
|
end,
|
||||||
padding = { left = 1, right = 0 },
|
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 = {
|
lualine_b = {
|
||||||
@@ -405,6 +418,7 @@ return { -- Lualine
|
|||||||
on_click = function()
|
on_click = function()
|
||||||
vim.cmd("Telescope oldfiles")
|
vim.cmd("Telescope oldfiles")
|
||||||
end,
|
end,
|
||||||
|
separator = { left = "", right = "" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user