多光标插件

This commit is contained in:
a770 2025-01-21 16:45:37 +08:00
parent 04a6c1a384
commit 0927c2e32d
3 changed files with 52 additions and 3 deletions

View file

@ -83,12 +83,14 @@ require("lazy").setup({
require("lazy.plugins.suda"),
-- jump使用flash.nvim插件实现f单个字母时按f下一处建议先esc退出再可视模式此时才可以继续使用f斜杠粘贴整个单词查找的时候不好用
require("lazy.plugins.jump"),
-- 多光标
require("lazy.plugins.multicursor"),
-- which-key使用多个字母快捷键停留时会提示
-- require("lazy.plugins.whichkey"),
require("lazy.plugins.whichkey"),
-- cw推荐的indent缩进线hlchunk可以根据线条的款式来分辨缩进
-- require("lazy.plugins.indent"),
-- ai编程助手supermaven
-- require("lazy.plugins.supermaven"),
-- 自动补全插件
-- 自动补全插件nvim-cmp
-- require("lazy.plugins.autocomplete").config,
})

View file

@ -11,7 +11,7 @@ return {
color_transparency = 0.15,
-- The 24-bit colors to mix with the background. Specified in hex.
-- { 0xffff40, 0x79ff79, 0xff79ff, 0x4fecec, } by default
colors = { 0xff0000, 0x00ff00, 0x0000ff, 0xffff40, 0x79ff79, 0xff79ff, 0x4fecec},
colors = {"0xff0000","0x00ff00","0x0000ff","0xffff40","0x79ff79","0xff79ff","0x4fecec"},
}))
-- local highlight = {

View file

@ -0,0 +1,47 @@
return {
"jake-stewart/multicursor.nvim",
event = "VeryLazy",
branch = "1.0",
config = function()
local mc = require("multicursor-nvim")
mc.setup()
local set = vim.keymap.set
-- 在主光标上方/下方添加或跳过光标。
set({ "n", "v" }, "<c-up>",
function() mc.lineAddCursor(-1) end)
set({ "n", "v" }, "<c-down>",
function() mc.lineAddCursor(1) end)
set({ "n", "v" }, "<leader><up>",
function() mc.lineSkipCursor(-1) end)
set({ "n", "v" }, "<leader><down>",
function() mc.lineSkipCursor(1) end)
-- 主光标在多光标之间移动。
set({ "n", "v" }, "<c-left>", mc.nextCursor)
set({ "n", "v" }, "<c-right>", mc.prevCursor)
-- 通过匹配单词/选择来添加或跳过添加新光标
set({ "n", "v" }, "<c-k>",
function() mc.matchAddCursor(1) end)
set({ "n", "v" }, "<leader>k",
function() mc.matchSkipCursor(1) end)
set({ "n", "v" }, "<c-s-k>",
function() mc.matchAddCursor(-1) end)
set({ "n", "v" }, "<leader>K",
function() mc.matchSkipCursor(-1) end)
-- 使用 Control + 左键单击添加和删除光标。
set("n", "<c-leftmouse>", mc.handleMouse)
-- 使用主光标添加和删除光标的简单方法。
set({ "n", "v" }, "<leader>m", mc.toggleCursor)
-- 通过正则表达式匹配视觉选择中的新光标。
set("v", "<leader>m", mc.matchCursors)
-- 启用/禁用多光标。
set("n", "<esc>", function()
if not mc.cursorsEnabled() then
mc.enableCursors()
elseif mc.hasCursors() then
mc.clearCursors()
else
-- Default <esc> handler.
end
end)
end
}