fix(action): insert symbol in insert mode (#1722)

followup to #1618, ensure insert after cursor
This commit is contained in:
Christian Clason
2022-01-28 16:12:50 +01:00
committed by GitHub
parent 0011b1148d
commit 21cb64aa1a

View File

@@ -360,11 +360,9 @@ end
actions.insert_symbol_i = function(prompt_bufnr) actions.insert_symbol_i = function(prompt_bufnr)
local symbol = action_state.get_selected_entry().value[1] local symbol = action_state.get_selected_entry().value[1]
actions._close(prompt_bufnr, true) actions._close(prompt_bufnr, true)
local cursor = vim.api.nvim_win_get_cursor(0)
vim.api.nvim_buf_set_text(0, cursor[1] - 1, cursor[2], cursor[1] - 1, cursor[2], { symbol })
vim.schedule(function() vim.schedule(function()
vim.api.nvim_win_set_cursor(0, { cursor[1], cursor[2] + #symbol }) vim.cmd [[startinsert]]
vim.cmd [[startinsert!]] vim.api.nvim_put({ symbol }, "", true, true)
end) end)
end end