Disclaimer: I don't know all the correct terminology here. When I say "window" it might be "quickfix modal dialog" or something.
I am using Neovim (through Neovide) and have these settings to enable search via the fzf plugin, by way of ripgrep:
" Search / Grep
command! -bang -nargs=* Rg
\ call fzf#vim#grep(
\ 'rg --column --line-number --no-heading --color=always --smart-case '.shellescape(<q-args>), 1,
\ <bang>0 ? fzf#vim#with_preview('up:60%')
\ : fzf#vim#with_preview('right:50%:hidden', '?'),
\ <bang>0)
set grepprg=rg\ --vimgrep
" set ctrl-p similarities to open files
nnoremap <silent> <C-t> :Files <cr>
nnoremap <silent> <C-p> :Files <cr>
nnoremap <silent> <C-b> :Buffers<cr>
nnoremap <silent> <C-M-h> :History<cr>
" disable preview window
let g:fzf_preview_window = ''
In my environment vars, I have FZF_DEFAULT_COMMAND
set to:
rg --files --hidden --glob "!.git/*"
When I do something like :Rg fn
I get a popup window that looks like this:
Here's the problem: when I hit enter to one of the lines to dismiss the window and go to the target file to make changes, I then want to bring the search window back up after I'm done.
I can hit :
and then arrow up to re-run the search, but that can be pretty annoying, especially when there are many results and I want to keep the cursor around where it last left off. When I try :copen
it's just empty.
Is there a way to re-open the last search in a window, preserving the state? (I understand the search results will be stale if I changed something... that's fine)
Aside for the specific question - I'd appreciate tips for working with search in the Neovim UI, for someone coming from GUI editors like VSCode.
Thanks!