mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
feat(picker): when picker was started from insert mode, return to insert after paste
This commit is contained in:
parent
b49d11c28a
commit
a4176301e3
2 changed files with 7 additions and 0 deletions
|
|
@ -585,6 +585,11 @@ function M.paste(picker, item, action)
|
|||
if item then
|
||||
local value = item[action.field] or item.data or item.text
|
||||
vim.api.nvim_paste(value, true, -1)
|
||||
if picker.input.mode == "i" then
|
||||
vim.schedule(function()
|
||||
vim.cmd.startinsert({ bang = true })
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
M.put = M.paste
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
---@class snacks.picker.input
|
||||
---@field win snacks.win
|
||||
---@field mode? string
|
||||
---@field totals string
|
||||
---@field picker snacks.Picker
|
||||
---@field filter snacks.picker.Filter
|
||||
|
|
@ -15,6 +16,7 @@ function M.new(picker)
|
|||
self.totals = ""
|
||||
self.picker = picker
|
||||
self.filter = require("snacks.picker.core.filter").new(picker)
|
||||
self.mode = vim.fn.mode()
|
||||
picker.matcher:init(self.filter.pattern)
|
||||
|
||||
self.win = Snacks.win(Snacks.win.resolve(picker.opts.win.input, {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue