-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Grep with commandline like arguments and options #1186
Comments
You can already do that with: require('fzf-lua').grep({ cmd = '<any command>' }) You can also dynamically add arguments as part of live grep with |
@Grueslayer, I added this to the wiki with examples, see: |
@ibhagwan Hi, Live Grep is something what never correctly worked on my system.... Agricultures tries to let you define all search parameters in the VIM commandline as you would write this in the shell. E.g. :RgRaw -i "TaBlE 5" --iglob "*g.table.al" will be translated to rg --column --line-number --no-heading --color=always -i "TaBlE 5" --iglob "*g.table.al" If I use that as "cmd" for grep it still prompts for search input..... I can give it to fzf_exec as first parameter but it does not have the preview and no actions are defined. |
@ibhagwan What a nice small hack, thanx! I've added fzf-lua support as PR to jesseleite/vim-agriculture which can be used from my branch in the meantime: {
'grueslayer/vim-agriculture',
branch = 'fzf-lua-support',
config = function()
vim.keymap.set('n','<leader>/',"<Plug>RgRawSearch",{})
vim.keymap.set('v','<leader>/',"<Plug>RgRawVisualSelection",{})
vim.keymap.set('n','<leader>*',"<Plug>RgRawWordUnderCursor",{})
end
} This plugin has some small additional little things, which can be fast moved to lua I think but was to lazy for it. |
Maybe my expectation is wrong, vim/nvim handles asynchronous processes wrong or MS Windows process handling is the problem. Let's say if I write 'tableextension' in the live grep in a big and deep directory struture, it starts finding 'tabl' and displays many matches in the list. I think I've to wait until it has finished it's search before it begins to display any 'tableextension' matches and removes the wrong ones. So until it starts while I am not finshed to type or not immediately restarts search after altering the input (and removes wrong / outdated matches), it's not my solution. |
Very nice, lua is indeed one of the simplest of languages.
I see what you mean, when using Basically, live_grep is a UI for |
btw, if you’re referring to the visual selection you can reuse fzf-lua’s fzf-lua/lua/fzf-lua/providers/grep.lua Lines 367 to 371 in 9c953df
Similarly, grep word under cursor in fzf-lua/lua/fzf-lua/providers/grep.lua Lines 351 to 357 in 9c953df
|
Have you RTFM'd?
Feature Request
Would be fine to have the same features like jesseleite/vim-agriculture in fzf-lua.
Or maybe you can give an example how to refactor
while using the build in preview mechanism of fzf-lua, so we can make a fork.
The text was updated successfully, but these errors were encountered: