Skip to content

live grep with exclusions #1194

Answered by ibhagwan
kapral18 asked this question in Q&A
May 13, 2024 · 3 comments · 28 replies
Discussion options

You must be logged in to vote

Ideally I'd have a keymap that pops open the picker with prefilled exclusions and puts the cursor right between \b\b

Found your ideal solution using fzf's start event:

:lua require'fzf-lua'.live_grep({
  no_esc=true,
  rg_glob=true, search=[[\b\b -- *.lua]],
  keymap = { fzf = { start = "beginning-of-line+forward-char+forward-char" }}
})

We can also use the "dotted" format for a slightly shorter command:

:lua require'fzf-lua'.live_grep({
  no_esc=true,
  rg_glob=true, search=[[\b\b -- *.lua]],
  ["keymap.fzf.start"] = "beginning-of-line+forward-char+forward-char"
})

For more options to send to fzf, man fzf and search for AVAILABLE ACTIONS:
https://github.com/junegunn/fzf/blob/4e9e842aa4…

Replies: 3 comments 28 replies

Comment options

You must be logged in to vote
1 reply
@kapral18
Comment options

Comment options

You must be logged in to vote
21 replies
@kapral18
Comment options

@ibhagwan
Comment options

@kapral18
Comment options

@ibhagwan
Comment options

@kapral18
Comment options

Answer selected by kapral18
Comment options

You must be logged in to vote
6 replies
@dotfrag
Comment options

@ibhagwan
Comment options

@dotfrag
Comment options

@ibhagwan
Comment options

@dotfrag
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants