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.4k stars 176 forks source link

Insert Mode, Key that ins't map show which-key panel and only Null show #92

Closed Maverun closed 3 years ago

Maverun commented 3 years ago

Hello, When I was typing in Insert Mode, When I press < key, it active which key and it show only null

image

When I do :imap to see a list of them this is what I found image There was other early such as 2,3, M, etc but Somehow they stop showing up, not sure what cause it when I was doing something (Note the reason why I mention it and it not showing up anymore was due to existing nvim then return) As far as I know, I didn't touch which-key related or mapping them, only setup config (require'which-key'.setup{})

I could disable it via setting, but I am confused why it is shown like that and especially when there is no key related to it. I figure it could be likely a bug that should be report.

folke commented 3 years ago

That seems odd indeed. The only reason I can think of is that there were mappings in INSERT mode under < before, but that got deleted somehow. That or a special key mapping like <...> where the closing tag was not properly closed.

If you say there were 2,3,M earlier, what do you mean exactly?

You saw mappings for 2, 3, M when hitting < in INSERT mode?

Maverun commented 3 years ago

As far as I can see Nothing is like that, I rarely map to Insert mode... Mapping Link as you can see here,

as for 2,3,M Those was similar as < function, when pressing those, it will show up same as that Screenshot with <

For some reason they stop showing up when I fresh enter nvim which I presume it some how trigger when I was doing something, I don't even know what was process since it was long time...

But what will always active even when start new nvim run is always < At this moment, I temporary fix it with

  triggers_blacklist = {
    -- list of mode / prefixes that should never be hooked by WhichKey
    -- this is mostly relevant for key maps that start with a native binding
    -- most people should not need to change this
    i = { "j", "k", "<"},
    v = { "j", "k" },
  },

(Just checking, is there possible to disable only Insert Mode and just have which key trigger on visual/normal? I haven't yet to read full documentals (since I cant find any with :h whichkey or something...)

folke commented 3 years ago

I can definitely add an option to restrict the modes where WK is active, but would still be good to figure out what's happening here.

So if you do :imap <, you only see the WK binding?

The only other reason I can think of is that in some other buffers, theres local mappings under <. Any plugin you use that has mappings like <,2,3,M in insert mode?

Maverun commented 3 years ago

image I presume that line before < < soemthing strange symbol might be a issues, and I have no idea how to remove that...? I presume cuz of 0.5, <NOP> no longer valid?

--few min later-- ah... Appear so this was a problem, somehow <Nop> cause issues, when I comment all related to <Nop>, issue stop showing up,

As for 2,3,m Nothing as far as I know does that, I doubt any dev plugins would do that...

Maverun commented 3 years ago

bit checking further, only those that have nop are

map(n,'MiddleMouse','<Nop>')
map(n,'2-MiddleMouse','<Nop>')
map(n,'3-MiddleMouse','<Nop>')
map(n,'4-MiddleMouse','<Nop>')

map(i,'MiddleMouse','<Nop>')
map(i,'2-MiddleMouse','<Nop>')
map(i,'3-MiddleMouse','<Nop>')
map(i,'4-MiddleMouse','<Nop>')
vim.g.UltiSnipsExpandTrigger = '<Nop>'
vim.g.UltiSnipsJumpForwardTrigger = '<Nop>'
vim.g.UltiSnipsJumpBackwardTrigger = '<Nop>'

first codeblock doesn't affect any but last code block related to Ultisnip does affect, I have to comment them out in order for it stop assign < which is oddly strange consider both are similar, I presume it is issue for Ultisnip plugins side?

Maverun commented 3 years ago

image image .... Appear those 2,3,4, and M Are caused from MiddleMouse... good grief...

So now with proper fix, instead of "MiddleMouse", fixed with "<MiddleMouse> " (Idk why did I forget to add tag <>)

only issue is < which is related to UltiSnips plugins... supposed only solution is assign it to something other than <Nop>

I am sorry.. I am not very good at testing...

folke commented 3 years ago

<nop> can only appear on the right side of a keybindings. You cant use it as a key.

What do you want to achieve by doing that?

Maverun commented 3 years ago

Wait what? all of them are on right side, wait are you reference to Ultisnip? If so, that true, I wasn't thinking clear and that make sense, I just set it to <F12> since that is a key I would likely never touch. Regardless Issue was found due to that I was using on left side I supposed?

folke commented 3 years ago

vim.g.UltiSnipsExpandTrigger = '<Nop>'

Those lines are mapping the <nop> as a key, but that can;t be used as a key. Maybe just keep it empty? Not sure what utilsnips expects there if you don;t want the trigger

aasutossh commented 3 years ago

I have , comma mapped as the leader key. After typing comma in insert mode and waiting for the timeoutlen, nvim shows the which-key popup. image

I think the main issue and my issue is related. Maybe it's because I have comma mapped to some insert mode commands? That must be it.

aasutossh commented 3 years ago

Pressing esc after any keypress shows up the which-key popup instantly. Is this proper behaviour? Shouldn't pressing esc cancel the popup instead?

Maverun commented 3 years ago

vim.g.UltiSnipsExpandTrigger = '<Nop>'

Those lines are mapping the <nop> as a key, but that can;t be used as a key. Maybe just keep it empty? Not sure what utilsnips expects there if you don;t want the trigger

What? Oh oh god... I understood why we are kind misunderstood each other, I just saw my message, I didn't realized doing <> without codeblock would make it invisible... I am sorry for not double checking my message

I have to set it manually since default use <tab> and other but I am letting compe or so taking care of it that why. Regardless This issue is solved as long as you don't set <Nop> on left side yes?