folke / which-key.nvim

💥 Create key bindings that stick. WhichKey helps you remember your Neovim keymaps, by showing available keybindings in a popup as you type.
Apache License 2.0
5.12k stars 163 forks source link

bug: leader stopped showing WK #748

Closed 0xDmtri closed 1 month ago

0xDmtri commented 1 month ago

Did you check docs and existing issues?

Neovim version (nvim -v)

v0.10.0 Release

Operating system/version

Debian 11

Describe the bug

Pressing leader key stopped working. Just nothing happens pretty much.

I rolled back to one commit before e8b454f and all working again.

Steps To Reproduce

Use this commit: e8b454f

Expected Behavior

Seeing options followed by leader key.

Health

No errors

Log

No response

Repro

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", commit = "e8b454f", opts = {} },
    -- add any other plugins here
  },
})
folke commented 1 month ago

You probably map your leader manually?

What does :verbose nmap <leader> say?

0xDmtri commented 1 month ago

You probably map your leader manually?

What does :verbose nmap <leader> say?

Yh I do it manually before all loads as vim.g.mapleader = " " and vim.g.maplocalleader = " "

I suppose it is wrong :)

How should I do it instead? Thanks!

folke commented 1 month ago

What do you map before that exactly? to <nop>? And why is that?

MadhavM-117 commented 1 month ago

@0xDmtri I had the same issue.

I had the following line in my config assigning <Space> to <Nop>:

vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })

This was after I had set leader to space using:

vim.g.mapleader = " "
vim.g.maplocalleader = " "

Removing the assignment to <nop> fixed the issue for me.

folke commented 1 month ago

I just allowed that. But I really wonder why? It seems a lot of people do that, but what does that achieve?

MadhavM-117 commented 1 month ago

I based my initial config off of kickstart-modular, and it looks like it came from here.

I didn't even notice it till this happened.

Thanks for the quick fix @folke!

0xDmtri commented 1 month ago

What do you map before that exactly? to <nop>? And why is that?

but how else can u make space as your leader key? I really dont get the question, sorry.

folke commented 1 month ago

So everyone just adds that to their config because everyone else does it?

There's no reason to do that. Just remove that line and everything will work the same. It doesn't achieve anything.

Setting vim.g.mapleader = " " is what sets your leader.

folke commented 1 month ago

https://github.com/search?q=vim.keymap.set%28%7B+%27n%27%2C+%27v%27+%7D%2C+%27%3CSpace%3E%27%2C+%27%3CNop%3E%27%2C+%7B+silent+%3D+true+%7D%29&type=code

So, so, weird. I don't get it.

sjclayton commented 1 month ago

Me neither...

sonjiku commented 1 month ago

asdf

https://github.com/search?q=vim.keymap.set%28%7B+%27n%27%2C+%27v%27+%7D%2C+%27%3CSpace%3E%27%2C+%27%3CNop%3E%27%2C+%7B+silent+%3D+true+%7D%29&type=code

So, so, weird. I don't get it.

It's so in normal mode for example, your cursor doesnt move to the next character if you are "too slow" to follow up with your space-as-leader keymap.