Incorrect spelling highlights are not legible
I am using vim 8.0.1763 on RHEL 8.8. Colour scheme is catppuccin_macchiato.
The different spell check highlights are not legible. The highlighted text is illegible in all dark variants -- frappe, macchiato, and mocha. Frappe looks better though. The screeshot below was with
:setlocal spell spelllang=en_gb.
Macchiato:
Latte:
What's required to make the text legible?
Thanks!
Would you mind sharing your .vimrc and the terminal you are using?
- macOS v14.6 (originally reported the issue on RHEL 8.8, but seeing same behaviour on macOS)
- vim v9.1.650
- iTerm2 v3.4.23
Expand to view vimrc
" vim configuration file (location: ~/.vimrc).
set nocompatible " Don't bother with being vi compatible
" Plug plugins manager
" Download vim-plug if not present
if empty(glob("~/.vim/autoload/plug.vim"))
execute '!curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.github.com/junegunn/vim-plug/master/plug.vim'
endif
call plug#begin('~/.vim/plugged')
Plug 'bfrg/vim-cpp-modern'
Plug 'catppuccin/vim', { 'as': 'catppuccin' }
Plug 'dhruvasagar/vim-table-mode'
Plug 'editorconfig/editorconfig-vim'
Plug 'itchyny/lightline.vim'
Plug 'itchyny/vim-gitbranch'
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
Plug 'junegunn/vim-plug'
Plug 'majutsushi/tagbar'
Plug 'preservim/vim-markdown'
Plug 'tpope/vim-surround'
call plug#end()
" Navigation
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
set splitright " always split to the right
set splitbelow " always split at the bottom
" Spaces & Tabs
set tabstop=4 " number of visual spaces per tab
set shiftwidth=4 " number of spaces to shift in >> or <<
set softtabstop=4 " number of spaces in tab when editing
set expandtab " tabs are visual spaces
" UI Config
set background=dark " dark background, light foreground
set t_md= " disable bold fontface
set number " show line numbers
set relativenumber " show relative number for all but current line
set ruler " show line and column numbers
set cursorline " highlight current line
set backspace=indent,eol,start " allow bksp in diff. cursor positions
set scrolloff=2 " always show 2 lines before/after cursor
set laststatus=2 " always display status bar
filetype indent on " load filetype-specific indent files
syntax on " enable syntax color/processing
colorscheme catppuccin_macchiato
if !has('gui_running')
set t_Co=256
endif
" True colour support.
if exists('+termguicolors')
" Some terminals do not set their TERM to xterm. So, we have to manually
" set forground and background colours (t_8f and t_8b).
" See ':h xterm-true-color' for more details.
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
set termguicolors
endif
" Search
set ignorecase " case insensitive search
set smartcase " respecat case only if pattern has UPPER char
set incsearch " search as chars are entered
set hlsearch " highlight matches
set showmatch " highlight matching [{()}]
" Plugin configurations
" Lightline
let g:lightline = {'colorscheme': 'catppuccin_macchiato'}
" Tagbar
let g:tagbar_width = 33 " width of tagbar in chars
let g:tabar_autofocus = 1 " foucs tagbar when opened
nmap <leader>. :TagbarToggle<CR>
" FZF
let g:rg_command = '
\ rg --column --line-number --no-heading --fixed-strings --ignore-case --hidden --follow --color=always
\ -g "*.{js,json,php,md,styl,jade,html,config,py,cpp,c,rs,go,hs,rb,conf}"
\ -g "!{.git,node_modules,vendor,*.o}/*" '
command! -bang -nargs=* Find call fzf#vim#grep(g:rg_command .shellescape(<q-args>), 1, <bang>0)
nnoremap <leader>f :GFiles<CR>
nnoremap <leader>F :Files<CR>
nnoremap <leader>b :Buffers<CR>
nnoremap <leader>t :BTags<CR>
nnoremap <leader>T :Tags<CR>
nnoremap <leader>l :BLines<CR>
nnoremap <leader>L :Lines<CR>
nnoremap <leader>s :BCommits<CR>
nnoremap <leader>S :Commits <CR>
nnoremap <leader>m :Marks <CR>
nmap <leader>h :History:<CR>
nmap <leader>H :Helptags!<CR>
nmap <leader>C :Commands<CR>
let g:fzf_preview_window = ['right:50%:hidden', 'ctrl-/']
" Rust.vim
let g:rustfmt_autosave = 1
" Table mode
let g:table_mode_corner='|' " generate Markdown-compatible tables
I found that in different terminals with the same settings the highlights were different for the Spell group, now it should be fixed
Looks better after applying https://github.com/catppuccin/vim/commit/e4e612c26902de31b0ba5c8ff826230071b6387c. Thanks!
But, now the the cursorline highlight colour makes the rest of the highlighted words illegible.
Consider the following test file which illustrates the issue.
// vim: spell spelllang=en_gb norelativenumber cursorline
// Some comments here.
//
// TODO: check how this line looks w/ and w/out cursorline.
// FIXME: same as above
//
// bad speling standalone good
//
// bad speling standalone good
//
// Bad spelling stand-alone good
#include <stdio.h>
int main(void)
{
printf("Test catppuccin colours\n");
}
Lines 5 and 6 has TODO/FIXME markers which are highlighted in yellow. Lines 8 and 10 has words with incorrect spelling, incorrect capitalization, etc.
Screeshots below (macchiato theme) are with cursorline at different lines as described in this table:
| image | cursorline position |
|---|---|
| left | blank line |
| middle | TODO |
| right | bad spelling |
How the lines look with https://github.com/catppuccin/vim/commit/e4e612c26902de31b0ba5c8ff826230071b6387c
- When cursorline is on
TODO, the word is almost invisible - Comments are barely visible when cursorline is placed on them
- Spelling looks okay, but now bad spelling indicators are lost when cursorline is placed on them (perhaps not a big deal?)
How the lines look with this patch
Expand to view patch
diff --git colors/catppuccin_macchiato.vim colors/catppuccin_macchiato.vim
index 1ef4bf2..05f5011 100644
--- colors/catppuccin_macchiato.vim
+++ colors/catppuccin_macchiato.vim
@@ -71,7 +71,7 @@ call s:hi("Cursor", "NONE", s:base, s:text, "NONE", "NONE")
call s:hi("lCursor", "NONE", s:base, s:text, "NONE", "NONE")
call s:hi("CursorIM", "NONE", s:base, s:text, "NONE", "NONE")
call s:hi("CursorColumn", "NONE", "NONE", s:mantle, "NONE", "NONE")
-call s:hi("CursorLine", "NONE", "NONE", s:surface0, "NONE", "NONE")
+call s:hi("CursorLine", "NONE", "NONE", s:surface1, "NONE", "NONE")
call s:hi("Directory", "NONE", s:blue, "NONE", "NONE", "NONE")
call s:hi("DiffAdd", "NONE", s:base, s:green, "NONE", "NONE")
call s:hi("DiffChange", "NONE", s:base, s:yellow, "NONE", "NONE")
@@ -113,7 +113,7 @@ call s:hi("Title", "NONE", s:blue, "NONE", "bold", "bold")
call s:hi("VisualNOS", "NONE", "NONE", s:surface1, "bold", "bold")
call s:hi("WarningMsg", "NONE", s:yellow, "NONE", "NONE", "NONE")
call s:hi("WildMenu", "NONE", "NONE", s:overlay0, "NONE", "NONE")
-call s:hi("Comment", "NONE", s:surface2, "NONE", "NONE", "NONE")
+call s:hi("Comment", "NONE", s:subtext0, "NONE", "NONE", "NONE")
call s:hi("Constant", "NONE", s:peach, "NONE", "NONE", "NONE")
call s:hi("Identifier", "NONE", s:flamingo, "NONE", "NONE", "NONE")
call s:hi("Statement", "NONE", s:mauve, "NONE", "NONE", "NONE")
With this patch:
- Comments are legible even when cursorline is placed on them
-
TODOis visible with cursorline (could be improved?)
Can we make this any better?
The comments are too bright in your version, looking at the catppuccin neovim repo it seems that they are now using overlay0 instead of surface2, so this can be changed, as for the cursorline overwriting the colors I don't think anything can be done.
This is how it would look like with overlay0 on comments: