diff options
| author | tami5 <65782666+tami5@users.noreply.github.com> | 2020-12-23 20:36:20 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-23 20:36:20 +0300 |
| commit | 4850c6df6d04aa6b98912b1dac9def713b1eda44 (patch) | |
| tree | 7842aad6ca295f3d5be627db8255c9f8fb4bf028 /lua | |
| parent | 1e3ae2847281b5323cc820fcbe66a0cdcdfe45f2 (diff) | |
feat: include buf local maps, execute item on enter (#360)
keymaps should now include local buffer mappings and execute the mappings one enter
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/telescope/builtin/internal.lua | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/lua/telescope/builtin/internal.lua b/lua/telescope/builtin/internal.lua index 12c158e..5987546 100644 --- a/lua/telescope/builtin/internal.lua +++ b/lua/telescope/builtin/internal.lua @@ -591,13 +591,18 @@ internal.registers = function(opts) }):find() end --- find normal mode mappings +-- TODO: make filtering include the mapping and the action internal.keymaps = function(opts) local modes = {"n", "i", "c"} local keymaps_table = {} + for _, mode in pairs(modes) do - local keymaps_iter = vim.api.nvim_get_keymap(mode) - for _, keymap in pairs(keymaps_iter) do + local global = vim.api.nvim_get_keymap(mode) + for _, keymap in pairs(global) do + table.insert(keymaps_table, keymap) + end + local buf_local = vim.api.nvim_buf_get_keymap(0, mode) + for _, keymap in pairs(buf_local) do table.insert(keymaps_table, keymap) end end @@ -616,6 +621,16 @@ internal.keymaps = function(opts) end }, sorter = conf.generic_sorter(opts), + attach_mappings = function(prompt_bufnr) + actions.goto_file_selection_edit:replace(function() + local selection = actions.get_selected_entry() + vim.api.nvim_feedkeys( + vim.api.nvim_replace_termcodes(selection.value.lhs, true, false, true), + "t", true) + return actions.close(prompt_bufnr) + end) + return true + end }):find() end |
