Skip to content

Conversation

@jensenr30
Copy link
Contributor

I was trying to make which-key pop up instantly. I tried changing vim.opt.timeoutlen to 0, then to 1000, but it made no difference. While searching through the which-key repository, I discovered they changed how the plugin's delay is configured. They used to rely on vim.opt.timeoutlen, but they changed that a few months ago. Now they use their own opt.delay instead.

The previous 300 ms delay led me assume there was some horribly inefficient code somewhere in neovim, lua, or which-key. I changed the delay to 0 ms and that makes which-key feel really snappy and responsive! I think other newcomers to neovim would appreciate that feel.


-- Decrease mapped sequence wait time
-- Displays which-key popup sooner
vim.opt.timeoutlen = 300
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep this in. Removing this increases the timeoutlen to the default 1000 ms for all other map sequences.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

'folke/which-key.nvim',
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
opts = {
delay = 0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment here explaining delay option and that it is independent of the timeoutlen option.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

The which-key plugin used to rely on vim.opt.timeoutlen, but it was
updated a few months ago to use its own opt.delay instead.

https://github.com/folke/which-key.nvim/blob/8ab96b38a2530eacba5be717f52e04601eb59326/NEWS.md?plain=1#L10

I set which-key's delay to 0 ms because it makes it feel snappy and
responsive! That way, we give new users a good first impression.
Copy link
Contributor

@iton0 iton0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@feoh
Copy link
Collaborator

feoh commented Dec 29, 2024

Hey @iton0 thank you SO MUCH for helping polish this change and for all your contributions in general.

@jensenr30 thanks for this fix! Much appreciated.

@feoh feoh merged commit a8f5395 into nvim-lua:master Dec 29, 2024
1 check passed
@moustario moustario mentioned this pull request Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants