Any way to make mini.clue work like nvzone/showkeys and show all the pressed keys #1861
-
Contributing guidelines
Module(s)mini.clue QuestionHi echasnovski! Is there any way to make mini.clue show up for every key press and show the keys similar to how nvzone/showkeys does it. Or is it possible to achieve this with the combination of mini.notify and mini.keymap. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Both 'mini.clue' and 'mini.keymap' are meant to work with mappings. This is far from "showing any key press". Neovim itself has a pretty good (since Neovim 0.11) built-in way of acting on every keypress: local do_show_keys = false
local ns_id = vim.api.nvim_create_namespace('show-keys')
_G.toggle_show_keys = function()
do_show_keys = not do_show_keys
if not do_show_keys then return vim.on_key(nil, ns_id) end
vim.on_key(function(_, typed)
if typed ~= '' then vim.notify(vim.fn.keytrans(typed)) end
end, ns_id)
end Executing But I'd strongly suggest using a higher level key casting tool, as it will be more robust. I prefer screenkey. |
Beta Was this translation helpful? Give feedback.
Both 'mini.clue' and 'mini.keymap' are meant to work with mappings. This is far from "showing any key press".
Neovim itself has a pretty good (since Neovim 0.11) built-in way of acting on every keypress:
:h vim.on_key()
. It can be used without any plugin to show typed keys with something like this:Executing
:lua _G.toggle_show_keys()
starts to show withvim.notify()
k…