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

[FR] Add opts hook for fzf #169

Open
jiz4oh opened this issue Aug 6, 2024 · 0 comments
Open

[FR] Add opts hook for fzf #169

jiz4oh opened this issue Aug 6, 2024 · 0 comments

Comments

@jiz4oh
Copy link

jiz4oh commented Aug 6, 2024

I have checked the implementation of fzf, it's impossible to extend by the customer.

I have some functions like below:

function! fzf#customized#quickfix(query, fullscreen) abort
  let l:qf = getqflist()
  let l:list = map(l:qf, { _, val -> bufname(val.bufnr). ':'. val.lnum . ':' . val.col . ':'. val.text})
  if !empty(a:query)
    let @/ = a:query
  endif

  let l:actions = {
    \ 'ctrl-t': 'tab split',
    \ 'ctrl-x': 'split',
    \ 'ctrl-v': 'vsplit'
    \}
  let l:dir = getcwd()
  let l:spec = {
                \'dir': l:dir,
                \'sink*': { lines -> fzf#helper#colon_sink(lines, l:actions) },
                \'source': l:list,
                \'options': [
                  \'--expect', join(keys(actions), ','),
                  \'--ansi',
                  \'--prompt', 'Quickfix ',
                  \'--multi', '--bind', 'alt-a:select-all,alt-d:deselect-all',
                  \'--delimiter', ':', '--preview-window', '+{2}-/2'
                \]}

  call fzf#run(fzf#wrap('quickfix', fzf#vim#with_preview(l:spec), a:fullscreen))
endfunction

the fzf#run takes a single
dictionary argument, a spec, and starts fzf process accordingly. depending on the user's choice, the value of this dictionary may be very different. and usually called with fzf#wrap and fzf#vim#with_preview.

could you consider adding new opts for fzf backend like telescope which can let customers customize UI.

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

No branches or pull requests

1 participant