Fuzzy find among projects lines, and use globs to filter filtes #1940
-
Hi! I'm trying to create a fzf-lua call, that fits all my needs. I'm using Right now I use:
If I open this search, and type in Is it possible to achieve this functionality? I tried my best to find a solution online, or generate one with AI, but nothing I found worked Here is my fzf-lua config
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
What you want is to feed all lines of the desired globs in order to fuzzy match, for that use an empty search term To start directly with the glob |
Beta Was this translation helpful? Give feedback.
-
Possible to do it interactively with EDIT: fail to sleep again, take it away... M.grep_project_glob = function()
local last_gq
local cmd = 'rg --column --line-number --no-heading --color=always --smart-case'
local actions = require('fzf-lua.actions')
require('fzf-lua').fzf_exec(('%s ""'):format(cmd), {
previewer = 'builtin',
actions = {
['enter'] = actions.file_edit_or_qf,
['ctrl-s'] = actions.file_split,
['ctrl-v'] = actions.file_vsplit,
['ctrl-t'] = actions.file_tabedit,
['alt-q'] = actions.file_sel_to_qf,
['alt-Q'] = actions.file_sel_to_ll,
change = {
fn = function() end,
exec_silent = true,
postfix = 'transform:'
.. require('fzf-lua.shell').raw_action(function(sel)
local sq, gq = unpack(vim.split(unpack(sel), '%s%-%-%s'))
local gq_changed = gq ~= last_gq
last_gq = gq
if gq_changed then return ('reload(%s "" --iglob %q)+search:%s'):format(cmd, gq, sq) end
return ('+search:%s'):format(sq)
end, '{q}'),
},
},
})
end |
Beta Was this translation helpful? Give feedback.
-
Thanks guys, booth of the methods work, the custom fzf command packs it all together, I think I'll use that. Thanks again! |
Beta Was this translation helpful? Give feedback.
Possible to do it interactively with
transform-search
action:https://github.com/junegunn/fzf/blob/ba6d1b8772ce5e75ff999dcca21c0fadb689d7bf/CHANGELOG.md#L129
EDIT: fail to sleep again, take it away...