multicursor.nvim
multicursor.nvim copied to clipboard
oil.nvim incompatibilities, an issue with conceal & forced cursor positioning?
Hello!
I noticed an issue with oil.nvim when trying to go to the beginning of the line, Oil will force re-position the main cursor but not the other cursors.
With this `repro.lua` neovim config
---@diagnostic disable: missing-fields, unused-local
vim.env.LAZY_STDPATH = "/tmp/nvim-mini-repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()
vim.keymap.set("n", "Q", function() vim.cmd[[quit]] end, {desc="Quit neovim o/"})
-- Example minimal config for `multicursor.nvim`
local plugin_specs = {
{
"stevearc/oil.nvim",
config = function()
require"oil".setup()
end,
},
{
"jake-stewart/multicursor.nvim",
config = function()
local mc = require"multicursor-nvim"
mc.setup()
vim.api.nvim_set_hl(0, "MultiCursorCursor", { reverse = true })
vim.api.nvim_set_hl(0, "MultiCursorVisual", { link = "Visual" })
vim.api.nvim_set_hl(0, "MultiCursorMatchPreview", { link = "Search" })
vim.keymap.set({"n", "x"}, "<M-Space><M-j>", function() mc.lineAddCursor(1) end, {desc="Add cursor below"})
vim.keymap.set({"n", "x"}, "<M-Space>n", function() mc.matchAddCursor(1) end, {desc="Add cursor on next match"})
vim.keymap.set("n", "<M-Space><M-esc>", function() mc.clearCursors() end, {desc="Clear all cursors"})
end,
},
}
require"lazy.minit".repro { spec = plugin_specs }
Repro steps
- Run
nvim -u repro.lua lua/multicursor-nvim/ - Place a few cursors using
lineAddCursor(1) - Hit
^to go the beginning of the line - See that only the main cursor stays visible, they are in fact hidden in the sort of 'virtual gutter' that Oil makes with conceal as moving them all to the rights makes them visible again.
https://github.com/user-attachments/assets/b73850f4-4057-4012-b9a2-29d7b640bb30
think all we need to do is edit this part of oil.nvim to check if multicursor.nvim is in package.loaded and if so apply to each cursor.
not sure if i can do anything outside of this. i will try make a pr for oil today.
https://github.com/stevearc/oil.nvim/pull/696
You can wait for merge or use my fork for time being.