[neovim] Do not use Pmenu group colors for floating window

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
This commit is contained in:
Junegunn Choi 2022-11-05 01:03:25 +09:00
parent 2c6a73546d
commit 0881a6bc17
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

View File

@ -973,16 +973,16 @@ function! s:callback(dict, lines) abort
endfunction
if has('nvim')
function s:create_popup(hl, opts) abort
function s:create_popup(opts) abort
let buf = nvim_create_buf(v:false, v:true)
let opts = extend({'relative': 'editor', 'style': 'minimal'}, a:opts)
let win = nvim_open_win(buf, v:true, opts)
call setwinvar(win, '&winhighlight', 'NormalFloat:'..a:hl)
silent! call setwinvar(win, '&winhighlight', 'Pmenu:')
call setwinvar(win, '&colorcolumn', '')
return buf
endfunction
else
function! s:create_popup(hl, opts) abort
function! s:create_popup(opts) abort
let s:popup_create = {buf -> popup_create(buf, #{
\ line: a:opts.row,
\ col: a:opts.col,
@ -1017,7 +1017,7 @@ function! s:popup(opts) abort
let row += !has('nvim')
let col += !has('nvim')
call s:create_popup('Normal', {
call s:create_popup({
\ 'row': row, 'col': col, 'width': width, 'height': height
\ })
endfunction