neovim icon indicating copy to clipboard operation
neovim copied to clipboard

message "Swap file xxx already exists" does not respect the MoreMsg highlight during startup

Open xulongwu4 opened this issue 3 years ago • 3 comments

Neovim version (nvim -v)

0.5.1

Vim (not Nvim) behaves the same?

no, vim 8.2.3575

Operating system/version

Solus Linux

Terminal name/version

Alacritty 0.9.0

$TERM environment variable

alacritty

Installation

System package manager

How to reproduce the issue

This is the content of my init.vim file:

colorscheme nord
set termguicolors

Then I first open file a.cc in one nvim instance. Then I open another terminal and run nvim a.cc. The following is what I saw: Screenshot from 2021-12-20 18-36-54

However, this is the MoreMsg highlight group defined by the nord colorscheme: Screenshot from 2021-12-20 18-38-11

As can be seen, the highlight colors used by nvim for the Swap file xxxx already exists message does not match the MoreMsg highlight group defined by my colorscheme.

I did the same experiment with vim, with .vimrc identical to the init.vim shown above. This is the result in vim: Screenshot from 2021-12-20 18-36-04

vim uses correct highlight colors for the Swap file xxxx already exists message.

Expected behavior

The highlight color for the Swap file xxxx already exists message should match the MoreMsg highlight group of the selected colorscheme.

Actual behavior

The highlight color for the Swap file xxxx already exists message do not match the MoreMsg highlight group of the selected colorscheme.

xulongwu4 avatar Dec 22 '21 02:12 xulongwu4

This only happens on startup. ~However, I roughly tested and it appears Vim behaves the same. Maybe there is some environment-related stuff affecting.~

zeertzjq avatar Dec 22 '21 03:12 zeertzjq

@zeertzjq, did you use the minimum vimrc similar to what I used when you tested it? And what is the version of vim in your test. I believe my test result is not related to my environment settings because I have tried a minimum vimrc file and can reproduce the result on multiple machines.

I think what is important is that set termguicolors should appear after colorscheme xxx. This is the way to force vim to respect the MoreMsg highlight group when showing the Swap file xxx already exists message. However, it does not work for neovim. If we flip the order of the two commands, vim and neovim both behave in the wrong way (not taking the highlight group from my set colorscheme).

xulongwu4 avatar Dec 22 '21 12:12 xulongwu4

Oh, indeed Vim behaves correctly with set termguicolors after changing MoreMsg highlight group.

zeertzjq avatar Dec 22 '21 12:12 zeertzjq

I think I'm having this problem as well. It didn't bother me previously, but with the new default colour scheme in neovim, the warning text is hard to read for me:

image

I think this is a pretty significant usability problem.

dexgs avatar Jun 08 '24 22:06 dexgs

@dexgs try nvim --cmd "set bg=light"

justinmk avatar Jun 10 '24 01:06 justinmk