Skip to content
Discussion options

You must be logged in to vote

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:

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 :lua _G.toggle_show_keys() starts to show with vim.notify() k…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@231tr0n
Comment options

Answer selected by echasnovski
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested mini.clue mini.notify
2 participants