Open pgosar opened 6 months ago
Min repo.
local uv = vim.uv or vim.loop
-- Auto-install lazy.nvim if not present
if not uv.fs_stat(lazypath) then
print("Installing lazy.nvim....")
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
print("Done.")
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
{ "VonHeikemen/lsp-zero.nvim", branch = "v3.x" },
{ "williamboman/mason.nvim" },
{ "williamboman/mason-lspconfig.nvim" },
{ "neovim/nvim-lspconfig" },
{ "hrsh7th/cmp-nvim-lsp" },
{ "hrsh7th/nvim-cmp" },
{
"brenton-leighton/multiple-cursors.nvim",
version = "*", -- Use the latest tagged version
opts = {}, -- This causes the plugin setup function to be called
pre_hook = function()
require("cmp").setup({ enabled = false })
end,
post_hook = function()
require("cmp").setup({ enabled = true })
end,
keys = {
{ "<C-j>", "<Cmd>MultipleCursorsAddDown<CR>", mode = { "n", "x" }, desc = "Add cursor and move down" },
{ "<C-k>", "<Cmd>MultipleCursorsAddUp<CR>", mode = { "n", "x" }, desc = "Add cursor and move up" },
},
},
})
local lsp_zero = require("lsp-zero")
lsp_zero.on_attach(function(client, bufnr)
lsp_zero.default_keymaps({ buffer = bufnr })
end)
require("mason").setup({})
require("mason-lspconfig").setup({
handlers = {
function(server_name)
require("lspconfig")[server_name].setup({})
end,
},
})
local cmp = require("cmp")
cmp.setup({
mapping = cmp.mapping.preset.insert({
["<CR>"] = cmp.mapping.confirm({ select = false }),
["<C-Space>"] = cmp.mapping.complete(),
}),
})
So you're using Neovim's in-built completion with a language server? I only tried the standard in-built completion, I'll have to test it with a language server to see what the problem is.
Yeah exactly. I think the problem might just be that the inbuilt completion and lsp completion don’t share the same api
On Thu, May 30, 2024 at 19:43 Brenton Leighton @.***> wrote:
So you're using Neovim's in-built completion with a language server? I only tried the standard in-built completion, I'll have to test it with a language server to see what the problem is.
— Reply to this email directly, view it on GitHub https://github.com/brenton-leighton/multiple-cursors.nvim/issues/65#issuecomment-2141052910, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANE35OTWG74O7CCX6AGIMXDZE7BUXAVCNFSM6AAAAABIOQCZIGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBRGA2TEOJRGA . You are receiving this because you authored the thread.Message ID: @.***>
Yeah exactly. I think the problem might just be that the inbuilt completion and lsp completion don’t share the same api
Yeah that's most likely, but I can check and see if it can be supported.
@pgosar I've tested using LSP and the omnifunction for completion (Ctrl+x Ctrl+o
) and as far as I can tell it works fine (except for some weirdness with the up and down keys), so I think what you're describing is an issue with nvim-cmp. Can you try commenting out anything to do with nvim-cmp and see if you still have a problem?
Yeah like I mentioned I think something is going wrong with how nvim-cmp formats its completions from a language server. It does work properly for other cases where the completion does not come from a language server. For what it’s worth https://github.com/mg979/vim-visual-multi does it correctly so maybe that’s something to look into. Unfortunately i’m not super familiar with how it works though
On Tue, Jul 9, 2024 at 20:21 Brenton Leighton @.***> wrote:
@pgosar https://github.com/pgosar I've tested using LSP and the omnifunction for completion (Ctrl+x Ctrl+o) and as far as I can tell it works fine (except for some weirdness with the up and down keys), so I think what you're describing is an issue with nvim-cmp. Can you try commenting out anything to do with nvim-cmp and see if you still have a problem?
— Reply to this email directly, view it on GitHub https://github.com/brenton-leighton/multiple-cursors.nvim/issues/65#issuecomment-2219293038, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANE35OXDUH23YZ5WKRQP6TLZLSECDAVCNFSM6AAAAABIOQCZIGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJZGI4TGMBTHA . You are receiving this because you were mentioned.Message ID: @.***>
Great plugin! I think this issue I have is the last step before I can switch from vim-visual-multi.
As you can see, when auto-completing, the other cursors do not end up with the correct text, Neovim version 0.10.0. I'm not quite sure if I understood correctly, but I did add the pre and post hooks to the plugin setup in Lazy.nvim
Interestingly, I cannot repro this just given Neovim's default completion menu or even with nvim-cmp unless I setup a language server, it seems to happen only with suggestions given by the LSP?
Expected behavior is that whatever text is auto-completed on the "primary" cursor is replicated across all cursors - this does work with vim-visual-multi