Custom confirm action carries over to later instances of picker #2013
-
I'm trying to do the following: local augroup_netrw_picker = vim.api.nvim_create_augroup("NetrwPicker", { clear = true })
vim.api.nvim_create_autocmd('filetype', {
group = augroup_netrw_picker,
pattern = 'netrw',
callback = function()
vim.keymap.set('n', '<C-f>', function()
local lines_picker = Snacks.picker.lines({
confirm = { "edit", function()
vim.schedule(function()
vim.fn.feedkeys('o')
end)
end,
}
})
end)
end
}) This works, but then when I later open the lines picker outside of netrw, the confirm action seems to have been permanently modified. It inserts a new line underneath the target one. Is this not the right way to do this? |
Beta Was this translation helpful? Give feedback.
Answered by
drowning-cat
Jul 2, 2025
Replies: 1 comment 1 reply
-
Bruh, you created a global keymap. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use
vim.keymap.set(mode, lhs, rhs, { buffer = true })
.