feat: show keymaps for builtin actions (#1084)

* Add default mappings `<C-/>`and `?` for insert and normal mode, respectively, to show registered keymappings (`actions.which_key`) attached to prompt buffer
This commit is contained in:
fdschmidt93
2021-09-01 20:11:53 +02:00
committed by GitHub
parent 5d37c3ea08
commit fbe004142f
7 changed files with 385 additions and 1 deletions

View File

@@ -30,6 +30,7 @@ mappings.default_mappings = config.values.default_mappings
["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
["<C-l>"] = actions.complete_tag,
["<C-_>"] = actions.which_key, -- keys from pressing <C-/>
},
n = {
@@ -56,6 +57,7 @@ mappings.default_mappings = config.values.default_mappings
["<C-u>"] = actions.preview_scrolling_up,
["<C-d>"] = actions.preview_scrolling_down,
["?"] = actions.which_key,
},
}
@@ -222,6 +224,7 @@ mappings.execute_keymap = function(prompt_bufnr, keymap_identifier)
assert(key_func, string.format("Unsure of how we got this failure: %s %s", prompt_bufnr, keymap_identifier))
key_func(prompt_bufnr)
vim.cmd [[ doautocmd User TelescopeKeymap ]]
end
mappings.clear = function(prompt_bufnr)