In Neovim, the foreground and background colors of a floating window
defaults to those of Pmenu highlight group, which yields unexpected
results.
This commit makes the colors of fzf window defaults to those of 'Normal'
group (or 'NormalFloat' if defined), by ignoring Pmenu group.
Then the colors can be configured via --color option of fzf.
NOTE: An error from setwinvar call is ignored because the exact
behavior of &winhighlight with an empty target group is not clearly
documented.
Close#3035
Close https://github.com/junegunn/fzf.vim/issues/1431
See https://github.com/neovim/neovim/pull/9722#discussion_r264777602
`shellescape()` behavior is different when `shell=fish`, so we should set `shell` before calling `shellescape()`, otherwise an unexpected result may occur (e.g. https://github.com/kevinhwang91/nvim-bqf/issues/56).
Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
So that it's easier to add a sinklist function to a spec dictionary.
let spec = { 'source': source, 'options': ['--preview', preview] }
function spec.sinklist(matches)
echom string(a:matches)
endfunction
call fzf#run(fzf#wrap(spec))
When 'down' layout was used on regular Vim on terminal, fzf would open
below the editor using `--height` option. This was the only case where
terminal buffer was not used (the code was written when Vim didn't have
builtin terminal) and this exception has been a constant source of
confusion.
This commit makes fzf open in a terminal buffer even in that case.
The clean-up is done in s:collect(), so let's make sure it's run before
we may terminate due to CTRL-C or ESC (or some other error code) in
s:exit_handler().
The output may contain some unexpected warning messages from the shell
if it's not properly configured. While such extra messages should be
properly addressed by the user, we can ignore them by checking the
last line of the output instead of the first line.
Related: bd3a021ec1
The new default is
{ 'window' : { 'width': 0.9, 'height': 0.6, 'highlight': 'Normal' } }
The default highlight group for the border of the popup window is
'Comment', but 'Normal' seems to be a safer choice.
If you prefer the previous default, add this to your Vim configuration file:
let g:fzf_layout = { 'down': '40%' }
(fzf will fall back to this if popup window is not supported)