bug: default mappings cause operator-pending mode and lag
Describe the bug
The default mappings for avante.nvim cause operator pending mode. this is highly undesirable - c is a very common motion. I was pulling my hair out trying to figure out why neovim suddenly felt so laggy.
I later learned about operator-pending mode and timeoutlen. I like that avante has a way to override timeoutlen when hovering over diffs, but I think this is still insufficient, and so is manually overriding the defaults to not conflict - the default experience should reflect what is recommended to users, and therefore should not conflict with any built-in vim bindings. Continuing the status-quo will only result in hard to debug and very noticeable "lag" for end users.
To reproduce
default config
Expected behavior
basic vim motions should not feel laggy due to entering operator-pending mode.
Installation method
Use lazy.nvim:
{
"yetone/avante.nvim",
event = "VeryLazy",
lazy = false,
version = false, -- set this if you want to always pull the latest change
opts = {
-- add any opts here
},
-- if you want to build from source then do `make BUILD_FROM_SOURCE=true`
build = "make",
-- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows
dependencies = {
"nvim-treesitter/nvim-treesitter",
"stevearc/dressing.nvim",
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
},
}
Environment
❯ nvim --version NVIM v0.10.2 Build type: Release LuaJIT 2.1.1713773202
To add, search jumps (n) lag like crazy, as well as character search motions like f,F,t,T. Using those to qualify cut operations basically doesn't work and that is a very common use case for me. Using wordwise motions with visual mode (e.g. ve) is a workaround but there's still noticeable latency in visual mode completing the motion.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.
I honestly have no idea how you are supposed to use this plugin without this autocmd:
-- Fix bizarre avante default behavior with weird operator pending mode issue
vim.api.nvim_create_autocmd("WinEnter", {
pattern = "*",
callback = function()
if vim.bo.filetype == "AvanteInput" then
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<Esc>", true, true, true), "n", false)
vim.cmd("startinsert")
end
end,
})