Skip to content
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

Fix which-key delay settings #1276

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jensenr30
Copy link

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.

@@ -134,10 +134,6 @@ vim.opt.signcolumn = 'yes'
-- Decrease update time
vim.opt.updatetime = 250

-- 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
Author

Choose a reason for hiding this comment

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

Fixed.

@@ -274,6 +270,7 @@ require('lazy').setup({
'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
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

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.

2 participants