diff options
| author | TJ DeVries <devries.timothyj@gmail.com> | 2020-09-16 10:53:53 -0400 |
|---|---|---|
| committer | TJ DeVries <devries.timothyj@gmail.com> | 2020-09-16 10:53:53 -0400 |
| commit | 54f768fd7f93e35da6fec37121b0160f7db9d2a8 (patch) | |
| tree | af496336c21dc1d78610408dd7a26be3138e9380 /lua | |
| parent | b8f17075d4bd4f4cb41d1ce89a2a3b2a3bfa54a3 (diff) | |
fix: At least close pum when open and closing
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/telescope/actions.lua | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lua/telescope/actions.lua b/lua/telescope/actions.lua index 0f890de..171c132 100644 --- a/lua/telescope/actions.lua +++ b/lua/telescope/actions.lua @@ -5,7 +5,7 @@ local a = vim.api local state = require('telescope.state') local actions = setmetatable({}, { - __index = function(t, k) + __index = function(_, k) error("Actions does not have a value: " .. tostring(k)) end }) @@ -93,8 +93,6 @@ local function goto_file_selection(prompt_bufnr, command) a.nvim_win_set_cursor(0, {row, col}) end end - - vim.cmd [[stopinsert]] end end @@ -114,10 +112,19 @@ function actions.goto_file_selection_tabedit(prompt_bufnr) goto_file_selection(prompt_bufnr, "tabe") end +function actions.close_pum(_) + if 0 ~= vim.fn.pumvisible() then + vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<c-y>", true, true, true), 'n', true) + end +end + function actions.close(prompt_bufnr) local picker = actions.get_current_picker(prompt_bufnr) local prompt_win = state.get_status(prompt_bufnr).prompt_win + actions.close_pum(prompt_bufnr) + vim.cmd [[stopinsert]] + vim.api.nvim_win_close(prompt_win, true) vim.cmd(string.format([[bdelete! %s]], prompt_bufnr)) |
