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:
tami5
2020-12-01 14:03:14 +03:00
committed by GitHub
parent 07ce3c341a
commit f3caae5dda

View File

@@ -151,7 +151,7 @@ function actions.close_pum(_)
end
end
function actions.close(prompt_bufnr)
function actions.close(prompt_bufnr, keepinsert)
local picker = actions.get_current_picker(prompt_bufnr)
local prompt_win = state.get_status(prompt_bufnr).prompt_win
local original_win_id = picker.original_win_id
@@ -161,7 +161,9 @@ function actions.close(prompt_bufnr)
end
actions.close_pum(prompt_bufnr)
vim.cmd [[stopinsert]]
if not keepinsert then
vim.cmd [[stopinsert]]
end
vim.api.nvim_win_close(prompt_win, true)
@@ -219,8 +221,7 @@ end
actions.run_builtin = function(prompt_bufnr)
local entry = actions.get_selected_entry(prompt_bufnr)
actions.close(prompt_bufnr)
vim.cmd [[startinsert]]
actions.close(prompt_bufnr, "keepinsert")
require('telescope.builtin')[entry.text]()
end