refactor: improve multicursor config

This commit is contained in:
2024-10-04 14:00:41 -04:00
parent 1bdab9638f
commit 3cbae67bbd
2 changed files with 24 additions and 9 deletions
+17 -3
View File
@@ -1202,15 +1202,19 @@ end
function M.mc_statusline()
local mc = require("multicursor-nvim")
local status = {}
if mc.hasCursors() then
if mc.numEnabledCursors() > 1 then
status.enabled = true
status.cursors = mc.numEnabledCursors()
status.disabled = mc.numDisabledCursors()
if vim.fn.mode() == "v" then
status.icon = "󰚕 "
-- status.icon = "󰚕 "
status.icon = "󰆿"
status.short_text = "V"
status.text = "VISUAL"
status.color = "lualine_a_visual"
else
status.icon = "󰬸 "
-- status.icon = "󰬸 "
status.icon = "󰇀"
status.short_text = "N"
status.text = "NORMAL"
status.color = "lualine_a_normal"
@@ -1221,9 +1225,19 @@ function M.mc_statusline()
status.short_text = "NO"
status.text = "SINGLE"
status.color = "lualine_a_normal"
status.cursors = 1
status.disabled = 0
end
status.icon_short_text = status.icon .. status.short_text
status.icon_text = status.icon .. status.text
if status.cursors > 1 and status.disabled > 0 then
status.count = status.cursors .. "/" .. status.disabled
elseif status.cursors > 1 and status.disabled <= 0 then
status.count = status.cursors
else
status.count = ""
end
return status
end
+7 -6
View File
@@ -194,13 +194,14 @@ return {
config = function()
local mc = require("multicursor-nvim")
mc.setup()
mc.setup({
-- set to true if you want multicursor undo history
-- to clear when clearing cursors
shallowUndo = false,
-- Customize how cursors look.
vim.api.nvim_set_hl(0, "MultiCursorCursor", { link = "Cursor" })
vim.api.nvim_set_hl(0, "MultiCursorVisual", { link = "Visual" })
vim.api.nvim_set_hl(0, "MultiCursorDisabledCursor", { link = "Visual" })
vim.api.nvim_set_hl(0, "MultiCursorDisabledVisual", { link = "Visual" })
-- set to empty table to disable signs
signs = { "", "󰇀", "" },
})
end,
},
}