which-key.nvim icon indicating copy to clipboard operation
which-key.nvim copied to clipboard

use vim.keymap.set for keymaps

Open budswa opened this issue 2 years ago • 14 comments

budswa avatar Jan 09 '22 10:01 budswa

problem: this is only a latest commit thing on nightly. There is no stable release with it and some people can't even get this version with their package manager

max397574 avatar Jan 09 '22 16:01 max397574

Does this allow passing lua functions as RHS to which-key? or does which-key do some typechecking that would get in the way of that?

IndianBoy42 avatar Jan 10 '22 07:01 IndianBoy42

yes it does (I have a fork where I do this)

max397574 avatar Jan 10 '22 08:01 max397574

I don't think this PR changes anything. which-key.nvim already supports Lua functions as RHS, it currently just wraps them to be called from non-Lua mappings, and this PR just adds a redundant extra layer of mapping.

zeertzjq avatar Jan 15 '22 07:01 zeertzjq

vim.keymap.set is more than justfunction() end it also allows function references

max397574 avatar Jan 15 '22 08:01 max397574

But this PR never passes a function reference to vim.keymap.set(). It only passes a string.

zeertzjq avatar Jan 15 '22 09:01 zeertzjq

no it can also pass a function reference

max397574 avatar Jan 15 '22 15:01 max397574

It never does this. Have you even read the source code?

https://github.com/folke/which-key.nvim/blob/387fd676d3f9b419d38890820f6e262dc0fadb46/lua/which-key/keys.lua#L212-L219

require('which-key.keys').map() is NOT a public interface. Sure you can call it directly, but what is the point of that?

zeertzjq avatar Jan 15 '22 22:01 zeertzjq

I have if you pass a function reference then the type wouldn't be function and I just had to disable a type check on my fork and everything worked

max397574 avatar Jan 16 '22 07:01 max397574

Oh, I missed your second comment. This PR doesn't disable the type check though.

zeertzjq avatar Jan 16 '22 07:01 zeertzjq

its now on stable! 0.7.0

Suyashtnt avatar Apr 16 '22 17:04 Suyashtnt

@max397574, I saw you're working on this on your fork. Is it ready?

jdahm avatar May 09 '22 23:05 jdahm

yes ig

max397574 avatar May 10 '22 05:05 max397574

Hi @max397574, this pull request does not solve #310 , right?

DavidePatria avatar Jul 21 '22 07:07 DavidePatria

I've pushed an update that utilizes the new api for callbacks and also sets the desc attribute on Neovim 0.7 or higher

folke avatar Sep 06 '22 18:09 folke