From d88094fbfd84b297178252230f6faf0e7d2f7650 Mon Sep 17 00:00:00 2001 From: fdschmidt93 <39233597+fdschmidt93@users.noreply.github.com> Date: Fri, 22 Apr 2022 15:52:22 +0200 Subject: feat: show assigned function in actions.which_key (#1871) --- lua/telescope/actions/init.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lua/telescope/actions/init.lua') diff --git a/lua/telescope/actions/init.lua b/lua/telescope/actions/init.lua index 402c979..4c3b42a 100644 --- a/lua/telescope/actions/init.lua +++ b/lua/telescope/actions/init.lua @@ -1128,6 +1128,16 @@ actions.which_key = function(prompt_bufnr, opts) table.insert(mappings, { mode = v.mode, keybind = v.keybind, name = name }) end end + elseif type(v.func) == "function" then + if not opts.only_show_current_mode or mode == v.mode then + local fname = action_utils._get_anon_function_name(v.func) + table.insert(mappings, { mode = v.mode, keybind = v.keybind, name = fname }) + utils.notify("actions.which_key", { + msg = "No name available for anonymous functions.", + level = "INFO", + once = true, + }) + end end end -- cgit v1.2.3