Skip to content

How do I customize the on_move_async previewer? #757

Answered by liuchengxu
comfortablynick asked this question in Q&A
Discussion options

You must be logged in to vote

The backend requires a valid file path string. Given that clap is unable to interpret each entry and extract the filepath on its own, if your custom provider has a different format for each entry, you need to firstly extract a valid file path by hand and then pass it via fpath in the clap#client#call_preview_file(extra). For instance:

let g:clap_provider_quick_open = {
    \ 'source':  ['0:~/.vimrc', '1:~/.bashrc', '2:~/.zshrc'],
    \ 'sink':    'e',
    \ 'on_move_async': {->clap#client#call_preview_file({'fpath': split(g:clap.display.getcurline(), ':')[1]})},
    \ }

This commit 84cbe8d is required for passing the entries that contain ~, or you can convert it to an absolute path on Vim…

Replies: 1 comment 1 reply

Comment options

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

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