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

bug: whichkey menu doesn't appear in the first file that I open #709

Closed
4 tasks done
jqno opened this issue Jul 15, 2024 · 5 comments · Fixed by #688
Closed
4 tasks done

bug: whichkey menu doesn't appear in the first file that I open #709

jqno opened this issue Jul 15, 2024 · 5 comments · Fixed by #688
Labels
bug Something isn't working

Comments

@jqno
Copy link

jqno commented Jul 15, 2024

Did you check docs and existing issues?

  • I have read all the which-key.nvim docs
  • I have updated the plugin to the latest version before submitting this issue
  • I have searched the existing issues of which-key.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

v0.10.0

Operating system/version

Ubuntu 24.04 LTS

Describe the bug

When I open vim and press <leader>, the which-key menu appears.
When I open any file, and press <leader>, nothing happens (after the timeout, the cursor moves one space to the left because my leader is space).
When I open another file, and press <leader>, the which-key menu appears again.

BTW, I love which-key, and version 3 looks awesome!

Steps To Reproduce

Note that I added 2 lines to the default repro file below: I set mapleader, and I define a mapping

  • Run nvim with no parameters in a directory with some files
  • Press leader (space): which-key menu appears
  • :e somefile.txt (an existing file)
  • Press leader (space): which-key menu does not appear; after the timeout, the cursor moves 1 position
  • :e someotherfile.txt (an existing file)
  • Press leader (space): which-key menu appears

Expected Behavior

I expect the which-key menu to appear each time, including when the first file was opened

Health

which-key: require("which-key.health").check()

- OK Most of these checks are for informational purposes only.
  WARNINGS should be treated as a warning, and don't necessarily indicate a problem with your config.
  Please |DON't| report these warnings as an issue.

Checking your config ~
- WARNING |mini.icons| is not installed
- WARNING |nvim-web-devicons| is not installed
- WARNING Keymap icon support will be limited.

Checking for issues with your mappings ~
- OK No issues reported

checking for overlapping keymaps ~
- WARNING In mode `n`, <gc> overlaps with <gcc>:
  - <gc>: Toggle comment
  - <gcc>: Toggle comment line
- OK Overlapping keymaps are only reported for informational purposes.
  This doesn't necessarily mean there is a problem with your config.

Checking for duplicate mappings ~
- OK No duplicate mappings found


### Log

```log
Debug Started for v3.3.0
on_key: <Space>
State(start): { "Mode(n)", "Node(<Space>)", { keys = "<Space>", update = true, waited = 0 } }
  continue: { "<Space>", "Mode(n)" }
  getchar
  on_key: <Esc>
  got: <Esc>
on_key: :
ModeChanged(n:c)
on_key: e
on_key: <Space>
on_key: a
on_key: .
on_key: t
on_key: x
on_key: t
on_key: <CR>
ModeChanged(c:n)
not safe
on_key: <Space>
on_key: :
ModeChanged(n:c)
on_key: e
on_key: <Space>
on_key: b
on_key: .
on_key: t
on_key: x
on_key: t
on_key: <CR>
ModeChanged(c:n)
not safe
on_key: <Space>
State(start): { "Mode(n)", "Node(<Space>)", { keys = "<Space>", update = true, waited = 0 } }
  continue: { "<Space>", "Mode(n)" }
  getchar
  on_key: :
  got: :
  reattach: { "<Space>", "n" }
  detach: <Space>
  plugin: { [2] = ":" }
  feedkeys: { "Mode(n)", "<Space>:" }
on_key: <Space>
on_key: :
ModeChanged(n:c)
attach: { "<Space>", "n" }
on_key: q
on_key: <CR>
ModeChanged(c:n)
not safe

Repro

vim.g.mapleader = ' '

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
    { "folke/which-key.nvim", opts = {} },
    -- add any other plugins here
  },
})

vim.keymap.set('n', '<leader>j', function() print('hello') end)
@jqno jqno added the bug Something isn't working label Jul 15, 2024
@sjclayton
Copy link
Contributor

@jqno Everything is working for me when I try to reproduce your issue following those steps, I'm also on nvim v0.10.0 and my leader key is set to space as well. Are you on the latest commit of which-key?

@jqno
Copy link
Author

jqno commented Jul 15, 2024

Yes: 4c36b9b
I created .config/test-whichkey and am running NVIM_APPNAME=test-whichkey nvim to test this

@jqno
Copy link
Author

jqno commented Jul 15, 2024

I have a pretty elaborate zsh configuration, I thought maybe that's running interference somehow, but if I blow all that away, the problem persists for me unfortunately

@sjclayton
Copy link
Contributor

sjclayton commented Jul 15, 2024

@jqno

I have a pretty elaborate zsh configuration, I thought maybe that's running interference somehow, but if I blow all that away, the problem persists for me unfortunately

I didn't see your minimal repro above at first, and now that I've tested again with that... I can confirm the issue occurs for me as well.

@jqno
Copy link
Author

jqno commented Jul 15, 2024

I can confirm that this fix works. Thanks for the super quick turnaround!

folke pushed a commit that referenced this issue Jul 15, 2024
🤖 I have created a release *beep* *boop*
---


##
[3.4.0](v3.3.0...v3.4.0)
(2024-07-15)


### Features

* added icons for function keys
([9222280](9222280))
* **mode:** allow certain modes to start hidden and only show after
keypress. See [#690](#690)
([b4fa48f](b4fa48f))
* **presets:** added gw
([09b80a6](09b80a6))
* **presets:** better padding defaults for helix preset
([4c36b9b](4c36b9b))
* **presets:** increase default height for helix
([df0ad20](df0ad20))
* simplified/documented/fixed mappings sorting. Closes
[#694](#694)
([eb73f7c](eb73f7c))
* **state:** skip mouse keys in debug
([5f85b77](5f85b77))
* **ui:** show keys/help in an overlay and added scrolling hint
([50b2c43](50b2c43))
* **view:** get parent icon if possible
([b9de927](b9de927))


### Bug Fixes

* **buf:** always detach " when executing keys. Fixes
[#689](#689)
([d36f722](d36f722))
* **config:** set expand=0 by default. Fixes
[#693](#693)
([89434aa](89434aa))
* **config:** warn when deprecated config options were used. Fixes
[#696](#696)
([81413ef](81413ef))
* **health:** move deprecated option check to health
([af7a30f](af7a30f))
* **mappings:** allow creating keymaps without desc. Fixes
[#695](#695)
([c442aaa](c442aaa))
* **plugins:** add existing keymaps to plugin view. Fixes
[#681](#681)
([26f6fd2](26f6fd2))
* **presets:** don't override title setting for classic. See
[#649](#649)
([9a53c1f](9a53c1f))
* **presets:** shorter descriptions
([20600e4](20600e4))
* **state:** always do full update on BufReadPost since buffer-local
keymaps would be deleted. Fixes
[#709](#709)
([6068887](6068887))
* **state:** don't show when coming from cmdline mode. Fixes
[#692](#692)
([8cba66b](8cba66b))
* **state:** honor timeoutlen and nowait. Fixes
[#648](#648). Closes
[#697](#697)
([80f20ee](80f20ee))
* **state:** properly disable which-key when recording macros. Fixes
[#702](#702)
([b506275](b506275))
* **state:** scrolling
([dce9167](dce9167))
* **tree:** rawget for existing plugin node children
([c77cda8](c77cda8))
* **util:** when no clipboard provider exists, use the " register as
default. Fixes
[#687](#687)
([d077a3f](d077a3f))
* **view:** disable footer on Neovim &lt; 0.10
([6d544a4](6d544a4))
* **view:** ensure highlights get set for title padding
([#684](#684))
([2e4f7af](2e4f7af))
* **view:** hide existing title/footer when no trail
([4f589a1](4f589a1))
* **view:** include group keymaps in expand results. See
[#682](https://github.com/folke/which-key.nvim/issues/682)
([39e703c](39e703c))
* **view:** overlap protection should keep at least 4 lines
([0d89475](0d89475))
* **view:** padding & column spacing. Fixes
[#704](#704)
([11eec49](11eec49))
* **view:** spacing when more than one box
([89568f3](89568f3))
* **view:** special handling of `&lt;NL&gt;/<C-J>`. Fixes
[#706](#706)
([f8c91b2](f8c91b2))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants