How to toggle between grep and find files? #2003
Answered
by
drowning-cat
niksingh710
asked this question in
Q&A
-
I mean if i have |
Beta Was this translation helpful? Give feedback.
Answered by
drowning-cat
Jul 1, 2025
Replies: 1 comment 5 replies
-
---@param source string
---@param picker snacks.Picker
local reopen_picker = function(source, picker)
picker:close()
Snacks.picker.pick(
source,
vim.tbl_extend('force', picker.init_opts, {
search = picker:filter().search,
pattern = picker:filter().pattern,
live = picker.opts.live,
ignored = picker.opts.ingnored,
hidden = picker.opts.hidden,
} --[[@as snacks.picker.Config]])
)
end
return {
'folke/snacks.nvim',
---@type snacks.Config
opts = {
picker = {
sources = {
files = {
actions = {
switch_grep = function(picker)
reopen_picker('grep', picker)
end,
},
win = {
input = {
keys = {
['<M-g>'] = { 'switch_grep', mode = { 'i', 'n' } },
},
},
},
},
grep = {
actions = {
switch_files = function(picker)
reopen_picker('files', picker)
end,
},
win = {
input = {
keys = {
['<M-g>'] = { 'switch_files', mode = { 'i', 'n' } }, |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use #2003 (reply in thread)
Previous
Use:
#2003 (comment)
With one of:
opts.picker.sources.grep.live = false
live = picker.opts.live or false