From 0881a6bc17d970d2833be21fafc8de69fe468631 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sat, 5 Nov 2022 01:03:25 +0900 Subject: [PATCH] [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 --- plugin/fzf.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugin/fzf.vim b/plugin/fzf.vim index ca2dbaa4..a56f23ce 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -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