liuchengxu/vim-which-key

Delay on a dot key mapping

AnatoleLucet opened this issue · 0 comments

Environment (please complete the following information):

  • OS: Ubuntu 20.04.1 LTS

  • (Neo)Vim version:

NVIM v0.5.0-dev
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -g -O2 -fdebug-prefix-map=/build/neovim-fnisx6/neovim-0.5.0+ubuntu2+git202101031639-7a81a0c07-d569569c9=. -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/build/neovim-fnisx6/neovim-0.5.0+ubuntu2+git202101031639-7a81a0c07-d569569c9/build/config -I/build/neovim-fnisx6/neovim-0.5.0+ubuntu2+git202101031639-7a81a0c07-d569569c9/src -I/build/neovim-fnisx6/neovim-0.5.0+ubuntu2+git202101031639-7a81a0c07-d569569c9/.deps/usr/include -I/usr/include -I/build/neovim-fnisx6/neovim-0.5.0+ubuntu2+git202101031639-7a81a0c07-d569569c9/build/src/nvim/auto -I/build/neovim-fnisx6/neovim-0.5.0+ubuntu2+git202101031639-7a81a0c07-d569569c9/build/include
Compiled by buildd@lgw01-amd64-060
  • vim-which-key version: 68bd177

  • Minimal vimrc (lua):

require("nvim_utils")

vim.cmd("packadd packer.nvim")
require("packer").startup(
 function()
   use({ "wbthomason/packer.nvim", opt = true })
   use({ "liuchengxu/vim-which-key" })
   use({ "norcalli/nvim_utils" })
 end
)

nvim.g.mapleader = " "
vim.api.nvim_set_keymap(
 "n", "<Leader>", [[:<C-u>WhichKey '<Space>'<CR>]], { silent = true }
)

nvim.g.which_key_map = {
 name = "Leader",
 ["."] = {"ihey", "Test"}, -- this is sloow
}

vim.call("which_key#register", "<Space>", "g:which_key_map")

Describe the bug
When I map something to ., WhichKey will wait a bit before executing the command.

  • there's no delay when I map the same command to another key
  • the delay's length change when I change timeoutlen

To Reproduce

Hit <Space>. with the above config.

Expected behavior
No delay?