Skip to content
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

Send all current search results to QuickFix list #324

Closed
nikbrunner opened this issue Jan 22, 2022 · 10 comments
Closed

Send all current search results to QuickFix list #324

nikbrunner opened this issue Jan 22, 2022 · 10 comments
Labels
question Further information is requested

Comments

@nikbrunner
Copy link

Hi there,
Thanks you again for your great PlugIn!
I am just missing one feature. Maybe I am missing or not seeing something, but one of my favourite features of Telescope was, to send all current search results to the QuickFix list via Ctrl-q.

I found out that there is a default mapping for Ctrl-i, which seems to be not listed in the README, to select multiple entries and when pressing Enter the selection gets send to the QF List.

But how can I send all current results to the QF list?
Is there are default mapping for this or do I must build a mapping with a custom function?

@ibhagwan
Copy link
Owner

I found out that there is a default mapping for Ctrl-i, which seems to be not listed in the README, to select multiple entries and when pressing Enter the selection gets send to the QF List.

There is no such bind defined by fzf-lua, this is probably coming from your shell setup defined by FZF_DEFAULT_OPTS.

But how can I send all current results to the QF list? Is there are default mapping for this or do I must build a mapping with a custom function?

Since the defult action already sends multiple selection to quickfix this can be easily achieved by creating a new fzf bind (or modifying the existing one) to perform both select-all and accept:

require'fzf-lua'.setup {
  keymap = {
    fzf = {
      -- your other fzf binds
      ...
      -- modify the current 'toggle-all' bind:
      ["alt-a"]         = "select-all+accept",
    }
  }
}

@ibhagwan ibhagwan added the question Further information is requested label Jan 22, 2022
@nikbrunner
Copy link
Author

@ibhagwan Thank you! This solves it for me!

@strdr4605
Copy link

This is my setting:

fzf_lua.setup({
  -- fzf_bin = "/Users/strdr4605/.local/share/nvim/site/pack/packer/start/fzf/bin/fzf",
  fzf_opts = {
    ["--layout"] = "default",
    -- ["--ansi"] = false,
  },
  keymap = {
    fzf = {
      ["ctrl-q"] = "select-all+accept",
    }
  },
  grep = {
    -- rg_opts = "--column --line-number --no-heading --color=never --smart-case --max-columns=512",
    file_icons = false,
    git_icons = false,
  },
  winopts = {
    split = "belowright new",
    preview = {
      default = "bat_native",
      horizontal = "right:40%",
    },
  },
})

I never used fzf before fzf-lua, so I may not understand how it works, but in order to send the current search to QuickFix, I have to press ctrl-q twice (in Terminal mode of fzf-lua). Is this because of my other settings? what am I doing wrong?

@ibhagwan
Copy link
Owner

ibhagwan commented Aug 26, 2022

I never used fzf before fzf-lua, so I may not understand how it works, but in order to send the current search to QuickFix, I have to press ctrl-q twice (in Terminal mode of fzf-lua). Is this because of my other settings? what am I doing wrong?

This is not how it should behave, what if you remove the customization, do you have to press ctrl-q once or twice to select all? What about other binds? What happens if you change to a different key?

Above are some troubleshooting steps, you can also try with the minimal_init.lua (provided by this project), modify the keybind part and see if this works as expected.

@strdr4605
Copy link

strdr4605 commented Aug 26, 2022

what if you remove the customization, do you have to press ctrl-q once or twice to select all?

ctrl-q closes the fzf-lua window

But when mapped to ctrl-q, I press twice, window is closed and quickfix opens with results from search

What happens if you change to a different key?

Nothing happens when I mapped to alt-a

fzf-lua

@ibhagwan
Copy link
Owner

@nikbrunner what version of fzf are you using? What happens if you setup a select-all+accept in the terminal (without neovim), does it work?

@nikbrunner
Copy link
Author

@nikbrunner what version of fzf are you using? What happens if you setup a select-all+accept in the terminal (without neovim), does it work?

I am sorry, but I don't use this Plugin any more. I got a new Laptop since then, and I don't remember what version of fzf I was using at the time. :(

@ibhagwan
Copy link
Owner

Opps, the question was actually meant to @strdr4605 :)

Ty @nikbrunner!

@strdr4605
Copy link

 fzf --version
0.32.1 (4993d19)

looks like something is not working on my machine with alt-a
fzf-lua-2

But I tried mapping ctrl-q and it selects and exit with the results.
When ctrl-a is mapped, pressing ctrl-q closes with no results (as expected I guess).

fzf-lua-3

Now, I mapped again ctrl-q in fzf-lua but it does not work (pressing twice, closes the window without opening quickfix)

But using ctrl-w as a keymap works. Although, I would like to use ctrl-q as a keymap.
I think this is a corner issue on my machine, sorry for bothering

@ibhagwan
Copy link
Owner

Perhaps you have a conflict with another plug-in? Even with minimal init fzf-lua doesn’t erase the other plugins as I didn’t want to mess with ppl’s configs.

I would also check existing terminal mappings for ctrl-q with :verbose tmap <c-q>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants