diff options
| author | kylo252 <59826753+kylo252@users.noreply.github.com> | 2022-04-22 16:13:32 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-22 16:13:32 +0200 |
| commit | cc1a3440f9ba6f28a8ca0bfff867f60c2d80c353 (patch) | |
| tree | 965bd4cb118219c3f45dfdd7442379938f849938 /lua/telescope/actions/init.lua | |
| parent | 5a58b1f53577a8e124d703b5f8f3a29d07416753 (diff) | |
fix: fix keep insert when going from telescope window to telescope window (#1600)
Also fixes `initial_mode`
Co-authored-by: Simon Hauser <Simon-Hauser@outlook.de>
Diffstat (limited to 'lua/telescope/actions/init.lua')
| -rw-r--r-- | lua/telescope/actions/init.lua | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/lua/telescope/actions/init.lua b/lua/telescope/actions/init.lua index 4c3b42a..95f2ce4 100644 --- a/lua/telescope/actions/init.lua +++ b/lua/telescope/actions/init.lua @@ -343,28 +343,26 @@ end --- Close the Telescope window, usually used within an action ---@param prompt_bufnr number: The prompt bufnr actions.close = function(prompt_bufnr) - actions._close(prompt_bufnr, false) -end - ---- Close the Telescope window and specify if you want to keep insert mode or not ----@param prompt_bufnr number: The prompt bufnr ----@param keepinsert boolean: Remain in INSERT mode if true -actions._close = function(prompt_bufnr, keepinsert) action_state.get_current_history():reset() local picker = action_state.get_current_picker(prompt_bufnr) local prompt_win = state.get_status(prompt_bufnr).prompt_win local original_win_id = picker.original_win_id actions.close_pum(prompt_bufnr) - if not keepinsert then - vim.cmd [[stopinsert]] - end vim.api.nvim_win_close(prompt_win, true) pcall(vim.cmd, string.format([[silent bdelete! %s]], prompt_bufnr)) pcall(a.nvim_set_current_win, original_win_id) end +--- Close the Telescope window, usually used within an action<br> +--- Deprecated and no longer needed, does the same as |telescope.actions.close|. Might be removed in the future +---@deprecated +---@param prompt_bufnr number: The prompt bufnr +actions._close = function(prompt_bufnr) + actions.close(prompt_bufnr) +end + local set_edit_line = function(prompt_bufnr, fname, prefix, postfix) postfix = vim.F.if_nil(postfix, "") local selection = action_state.get_selected_entry() @@ -460,7 +458,7 @@ end ---@param prompt_bufnr number: The prompt bufnr actions.insert_symbol_i = function(prompt_bufnr) local symbol = action_state.get_selected_entry().value[1] - actions._close(prompt_bufnr, true) + actions.close(prompt_bufnr) vim.schedule(function() vim.cmd [[startinsert]] vim.api.nvim_put({ symbol }, "", true, true) |
