-
Notifications
You must be signed in to change notification settings - Fork 121
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
Visual defects in neovim #64
Comments
Same! What program do you use with fzy? ripgrep/find/silversearcher? I thought it was some issue with ripgrep + fzy. |
There is no issue in neovim To reproduce just |
@powerinside thank you for attention! It seems that so. I consider that it is necessary to add the correct instruction in README.md for neovim. |
I have tried something with
Maybe somebody knows more than me and can make this work :) |
This problem seems to have been solved in the fzf for a long time. But I can not quickly understand ~800 lines of vimscript :) |
Picker by Scott Stevenson might be a good place to look for this. I have copied what I think might be the relevant bit below: function! s:PickerTermopen(list_command, vim_command, callback) abort
" Open a terminal emulator buffer in a new window, execute
" list_command piping its output to the fuzzy selector, and call
" callback.on_select with the item selected by the user as the first
" argument.
"
" Parameters
" ----------
" list_command : String
" Shell command to generate list user will choose from.
" vim_command : String
" Readable representation of the Vim command which will be
" invoked against the user's selection, for display in the
" statusline.
" callback.on_select : String -> Void
" Function executed with the item selected by the user as the
" first argument.
let l:callback = {
\ 'window_id': win_getid(),
\ 'filename': tempname(),
\ 'callback': a:callback
\ }
function! l:callback.on_exit(job_id, data, event) abort
bdelete!
call win_gotoid(self.window_id)
if filereadable(self.filename)
try
call self.callback.on_select(readfile(self.filename)[0])
catch /E684/
endtry
call delete(self.filename)
endif
endfunction
execute g:picker_split g:picker_height . 'new'
let l:term_command = a:list_command . '|' . g:picker_selector . '>' .
\ l:callback.filename
let s:picker_job_id = termopen(l:term_command, l:callback)
let b:picker_statusline = 'Picker [command: ' . a:vim_command .
\ ', directory: ' . getcwd() . ']'
setlocal nonumber norelativenumber statusline=%{b:picker_statusline}
setfiletype picker
startinsert
endfunction |
@casr I hacked on it a bit and this works! function! FzyCommand(list_command) abort
let l:callback = {
\ 'window_id': win_getid(),
\ 'filename': tempname()
\ }
let l:fzy_command = 'fzy'
function! l:callback.on_exit(job_id, data, event) abort
bdelete!
call win_gotoid(self.window_id)
if filereadable(self.filename)
try
let l:selected_filename = readfile(self.filename)[0]
exec ':e ' . l:selected_filename
catch /E684/
endtry
call delete(self.filename)
endif
endfunction
execute 'botright 10 new'
let l:term_command = a:list_command . '|' . l:fzy_command . '>' .
\ l:callback.filename
let l:term_job_id = termopen(l:term_command, l:callback)
setlocal nonumber norelativenumber
startinsert
endfunction
nnoremap <leader>e :call FzyCommand("rg . -l -g ''")<cr> |
Adapted function! FzyCommand(choice_command, vim_command) abort
let l:callback = {
\ 'window_id': win_getid(),
\ 'filename': tempname(),
\ 'vim_command': a:vim_command
\ }
function! l:callback.on_exit(job_id, data, event) abort
bdelete!
call win_gotoid(self.window_id)
if filereadable(self.filename)
try
let l:selected_filename = readfile(self.filename)[0]
exec self.vim_command . l:selected_filename
catch /E684/
endtry
endif
call delete(self.filename)
endfunction
botright 10 new
let l:term_command = a:choice_command . ' | fzy > ' . l:callback.filename
silent call termopen(l:term_command, l:callback)
setlocal nonumber norelativenumber
startinsert
endfunction
nnoremap <silent> <c-o> :call FzyCommand('rg --files .', ':e ')<cr> |
Is the above a drop in replacement for the README version? |
Yes! |
Should be added to the readme imo. |
@ruifm Open a PR with the changes to the README and your wish might come true :) |
Is it possible to use fzy+ripgrep to search inside files? |
I use it fine using: nnoremap <silent><leader>t :call FzyCommand("rg --files --hidden -g '!.git/*' .", ":tabedit")<cr> |
One hack would be to rely on
The issue that I have is fzy does not highlight selection when colors are forced, so impossible to know which one is selected. |
I tried the example from the README.md with neovim and found visual flaws. Lines are displayed indented as a ladder. If you enter a few characters, then nothing on the screen can be understood.
The text was updated successfully, but these errors were encountered: