bepo.nvim icon indicating copy to clipboard operation
bepo.nvim copied to clipboard

Delay after "c"

Open Shcak opened this issue 1 year ago • 7 comments

When I make a single left move with "c" (wich is remapped to h), I have a half-second delay before the move is made. I think neovim is waiting for a potential "ca" for change around or "ci" for change inner. (even if "la" and "li" took their places)

require("bepo").setup() is the first line of my init.lua

Thanks

Shcak avatar Dec 13 '23 21:12 Shcak

Thanks for opening this issue. It has prompted me to add instructions to report bugs in the Readme :).

Can you please try to run

nvim --clean -u test/mock_setup.lua

as explained in the Readme? That will help determine if something in your config is causing this.

I could not reproduce your issue locally with the above command, so that suggests that your user (or system) config is at fault here. It may be that one plugin is creating a mapping starting with c, say c], and that would be what’s causing the delay.

cljoly avatar Dec 16 '23 14:12 cljoly

Hey @Shcak !

The same is happening to me.

My setup is quite fresh so I don't have many plugins installed that could have added a mapping using c

Do you also experience that unlike the t,s,r keys mapping directly to j, k, l in the command prompt, pressing c makes a c appear in the prompt before it shifts to an h right before the move is made ?

Have you figured out any common package that could cause this ?

On my side I tried to uninstall some of my packages in order to test the result, without success.

Here's my list of packages :

  "wbthomason/packer.nvim"
  "nvim-telescope/telescope.nvim"
  "nvim-tree/nvim-tree.lua"
  "nvim-lualine/lualine.nvim"
  "mbbill/undotree"
  "tpope/vim-fugitive"
  "mg979/vim-visual-multi"
  "nvim-treesitter/nvim-treesitter"
  "cljoly/bepo.nvim"
  "VonHeikemen/lsp-zero.nvim"
 "folke/which-key.nvim"
  "catppuccin/nvim"

Jurollet avatar Jan 03 '24 13:01 Jurollet

Also @cljoly, I tried nvim --clean -u test/mock_setup.lua, works as expected

Jurollet avatar Jan 03 '24 13:01 Jurollet

Maybe running :verbose map c will help to figure what gets defined on the c mapping @Jurollet ?

For me, :verbose map l (different key, but it's for the sake of an example), returns:

n  lJ            <Plug>CSurround
	Last set from ~/.local/share/nvim/site/pack/paqs/start/bepo.nvim/after/plugin/surround.vim line 10
n  lj            <Plug>Csurround
	Last set from ~/.local/share/nvim/site/pack/paqs/start/bepo.nvim/after/plugin/surround.vim line 9
x  l           * c
	Last set from Lua
o  l           * c
	Last set from Lua
n  l           * c
	Last set from Lua

So you see that I have a plugin defining mappings lj and lJ.

cljoly avatar Jan 04 '24 08:01 cljoly

After a fresh install, problem is gone. Must have been an interaction with another plugin.

Shcak avatar Jan 06 '24 17:01 Shcak

Fresh install too, adding plugins one after another. Looks like the delay is caused by "folke/which-key.nvim"

Jurollet avatar Jan 14 '24 14:01 Jurollet

Looks like the delay is caused by "folke/which-key.nvim"

That makes sense. Reading the Readme of that plugin, specifically the configuration section, I suspect you might be able to add this:

{
  -- list of triggers, where WhichKey should not wait for timeoutlen and show immediately
  triggers_nowait = {
    "c",
  },
}

to solve the problem.

Alternatively, deactivating operator presets (and then specifying them in operators) might help:

{
  plugins = {
    presets = {
      operators = true, -- Might be worth setting that to false and manually wrap with operators below
    },
  },
  -- add operators that will trigger motion and text object completion
  -- to enable all native operators, set the preset / operators plugin above
  operators = { d = "Delete", l = "Change", y = "Yank" },
}

cljoly avatar Jan 14 '24 14:01 cljoly