-
-
Notifications
You must be signed in to change notification settings - Fork 606
Open
Description
I search around for a working example and didn't find anything
function! FzfFilesWithVisualPrefilter() range
let [lnum1, col1] = getpos("'<")[1:2]
let [lnum2, col2] = getpos("'>")[1:2]
let lines = getline(lnum1, lnum2)
let lines[-1] = lines[-1][: col2 - (&selection == 'inclusive' ? 1 : 2)]
let lines[0] = lines[0][col1 - 1:]
let prefilter = lines[0]
call fzf#vim#files('', fzf#vim#with_preview({ 'options': '--query "' . prefilter . '"'}))
"call fzf#vim#files('', fzf#vim#with_preview({'options': {'query': prefilter}}))
endfunction
xnoremap <silent> <leader>ff :<C-U>call FzfFilesWithVisualPrefilter()<CR>
select a text, press ,ff and you have a popup searching for files matching your selected text.
Wonder if:
Is there a helper to get selected text for fzf.vim?
Should a line like:
call fzf#vim#files('', fzf#vim#with_preview({'options': {'query': prefilter}}))
work. Searching for a cleaner way to compose --query line
Metadata
Metadata
Assignees
Labels
No labels