fix: builtin runner insert issue (#266)
closes #262 , adds new parameter to action.close. Users know can have more control over the mode after action.close is called.
This commit is contained in:
@@ -151,7 +151,7 @@ function actions.close_pum(_)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function actions.close(prompt_bufnr)
|
function actions.close(prompt_bufnr, keepinsert)
|
||||||
local picker = actions.get_current_picker(prompt_bufnr)
|
local picker = actions.get_current_picker(prompt_bufnr)
|
||||||
local prompt_win = state.get_status(prompt_bufnr).prompt_win
|
local prompt_win = state.get_status(prompt_bufnr).prompt_win
|
||||||
local original_win_id = picker.original_win_id
|
local original_win_id = picker.original_win_id
|
||||||
@@ -161,7 +161,9 @@ function actions.close(prompt_bufnr)
|
|||||||
end
|
end
|
||||||
|
|
||||||
actions.close_pum(prompt_bufnr)
|
actions.close_pum(prompt_bufnr)
|
||||||
vim.cmd [[stopinsert]]
|
if not keepinsert then
|
||||||
|
vim.cmd [[stopinsert]]
|
||||||
|
end
|
||||||
|
|
||||||
vim.api.nvim_win_close(prompt_win, true)
|
vim.api.nvim_win_close(prompt_win, true)
|
||||||
|
|
||||||
@@ -219,8 +221,7 @@ end
|
|||||||
actions.run_builtin = function(prompt_bufnr)
|
actions.run_builtin = function(prompt_bufnr)
|
||||||
local entry = actions.get_selected_entry(prompt_bufnr)
|
local entry = actions.get_selected_entry(prompt_bufnr)
|
||||||
|
|
||||||
actions.close(prompt_bufnr)
|
actions.close(prompt_bufnr, "keepinsert")
|
||||||
vim.cmd [[startinsert]]
|
|
||||||
|
|
||||||
require('telescope.builtin')[entry.text]()
|
require('telescope.builtin')[entry.text]()
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user