-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conflict between ufo and reactive.nvim causes weird behavior of nvim-cmp scroll_docs #223
Comments
what's error msg? |
No error message, just scroll_docs causes strange behavior, cmp.scroll_docs() moves my cursor forward one character, and the autocomplete window goes back to its original state |
I did more testing, and it turns out that the problem has nothing to do with vim.o.foldenable, but with ufo itself! |
can't reproduce it. |
Okay, I'll try to make a minimal configuration. There may be other conflicts. |
I'm sorry, using ufo and nvim-cmp minimal configuration did not cause the problem. It should be other plugins and ufo that caused the problem, because if I disable ufo, everything works fine. |
In fact, reactive.nvim and ufo have some conflicts, which will cause this problem when they exist at the same time. -- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath })
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
{
"rasulomaroff/reactive.nvim",
config = function()
require("reactive").setup({
builtin = {
cursorline = true,
cursor = true,
modemsg = true,
},
})
end,
},
{
"williamboman/mason.nvim",
config = function()
require("mason").setup()
end,
},
{
"WhoIsSethDaniel/mason-tool-installer.nvim",
config = function()
require("mason-tool-installer").setup({
ensure_installed = {
"lua-language-server",
},
})
end,
},
{
"neovim/nvim-lspconfig",
config = function()
require("lspconfig").lua_ls.setup({})
end,
},
{
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
},
config = function()
local cmp = require("cmp")
cmp.setup({
mapping = {
["<C-u>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end),
["<C-e>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end),
["<C-h>"] = cmp.mapping(function(fallback)
if cmp.visible_docs() then
cmp.scroll_docs(-5)
else
fallback()
end
end),
["<C-b>"] = cmp.mapping(function(fallback)
if cmp.visible_docs() then
cmp.scroll_docs(5)
else
fallback()
end
end),
},
sources = cmp.config.sources({
{ name = "nvim_lsp" },
}),
})
end,
},
{
"nvim-treesitter/nvim-treesitter",
config = function()
require("nvim-treesitter.configs").setup({
ensure_installed = { "c", "lua", "vim", "vimdoc", "query" },
})
end,
},
{
"kevinhwang91/nvim-ufo",
dependencies = {
"kevinhwang91/promise-async",
},
config = function()
vim.o.foldcolumn = "1" -- '0' is not bad
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
vim.o.foldlevelstart = 99
vim.o.foldenable = true
-- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself
vim.keymap.set("n", "zR", require("ufo").openAllFolds)
vim.keymap.set("n", "zM", require("ufo").closeAllFolds)
require("ufo").setup({
provider_selector = function(bufnr, filetype, buftype)
return { "treesitter", "indent" }
end,
})
end,
},
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
}) |
This reverts commit 4b5ad30. Conflict with nvim-ufo. kevinhwang91/nvim-ufo#223
The issue is complex. I'm not sure if there's an issue of |
In which repository do you think this problem would be more simple and elegant to solve? Or should it be solved in conjunction with the reactive.nvim contributors? |
Solved by ufo. |
Ha ha ha, let me know if you need any help. |
Neovim version (nvim -v | head -n1)
NVIM v0.10.0
Operating system/version
macOS 14.5
How to reproduce the issue
As per the documentation, I have the following minimal configuration:
nvim-cmp has the following keymap:
At this point, the scroll_docs function will cause some confusion.
vim.o.foldenable = true does not cause problems when ufo is disabled.
Expected behavior
nvim-cmp scroll_docs normal behavior.
Actual behavior
nvim-cmp scroll_docs causes confusion.
The text was updated successfully, but these errors were encountered: