-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
A way to execute ad-hoc searches similar to fzf #433
Comments
Actually you also have to write |
I have a different use case for this: I'm trying to use vim-clap as a replacement for fzf in LanguageClient-neovim, which uses fzf as a general-purpose selection UI. I've got a working |
I would suggest you creating a new repo for the languageclient-neovim like https://github.com/vn-ki/coc-clap for coc.nvim, and I can also take a look if you make a lcn-clap. @runiq |
Turns out this is not so simple. Both vim-clap and LCN adhere to the Hollywood principle of "Don't call us, we'll call you":
I believe the easiest way forward to implement my plan would be for Clap to expose a convenience function for a general purpose 'ad hoc' provider that just takes source and sink arguments, similar to |
@runiq @svermeulen Try the following patch for now, if it works for you, I'll merge it later. diff --git a/autoload/clap.vim b/autoload/clap.vim
index f040ec3..1a04655 100644
--- a/autoload/clap.vim
+++ b/autoload/clap.vim
@@ -376,5 +376,20 @@ function! clap#(bang, ...) abort
call clap#for(provider_id_or_alias)
endfunction
+function! clap#run(provider) abort
+ if has_key(a:provider, 'id')
+ let id = a:provider['id']
+ else
+ let id = 'run'
+ endif
+ let g:clap_provider_{id} = a:provider
+ if s:inject_default_impl_is_ok(g:clap_provider_{id})
+ let g:clap.registrar[id] = g:clap_provider_{id}
+ execute 'Clap' id
+ else
+ echoerr 'failed to run:'.string(a:provider)
+ endif
+endfunction Example: |
* Add clap#run() Close #433 * Update doc * Nits
Is your feature request related to a problem? Please describe.
I dislike how with vim clap you need to pre-define each type of clap popup. You cannot very easily dynamically create popups.
Describe the solution you'd like
With fzf.vim, if you want to create a popup dynamically, you can just call
fzf#run
like this:Whereas, with vim-clap, it seems you have to do something like this:
This works ok, because you can define a temporary provider like this and re-use it for any adhoc popups you want to trigger, but it would be much nicer if there was an API method for this instead of needing to define a global variable for the temporary provider ahead of time
Describe alternatives you've considered
n/a
Additional context
n/a
The text was updated successfully, but these errors were encountered: