merry-go-round
merry-go-round

Reputation: 4625

My Neovim LSP error message doesn't have a red color

My Neovim LSP error message doesn't have a red color:

Neovim screenshot with diagnostic message

Here is my vimrc file. I really don't know what the issue is.

syntax on

set guicursor=
set relativenumber
set noerrorbells
set tabstop=2 softtabstop=2
set shiftwidth=2
set expandtab
set smartindent
set nu
set nowrap
set smartcase
set noswapfile
set nobackup
set undodir=~/.vim/undodir
set undofile
set incsearch
set cursorline
set cursorcolumn
set updatetime=50



call plug#begin('~/.vim/plugged')

Plug 'gruvbox-community/gruvbox'
Plug 'preservim/nerdtree'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
Plug 'scrooloose/syntastic'
Plug 'scrooloose/nerdcommenter'
Plug 'majutsushi/tagbar'
Plug 'vim-airline/vim-airline'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'airblade/vim-gitgutter'
Plug 'blueyed/vim-diminactive'
Plug 'mattn/emmet-vim'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'mileszs/ack.vim'
"Plug 'mxw/vim-jsx'
"Plug 'leafgarland/typescript-vim'
"Plug 'peitalin/vim-jsx-typescript'
Plug 'neovim/nvim-lspconfig'
Plug 'nvim-lua/completion-nvim'

call plug#end()


let g:gruvbox_contrast_dark = 'hard'
if exists('+termguicolors')
    let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
    let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
endif
let g:gruvbox_invert_selection='0'

colorscheme gruvbox
set background=dark

let loaded_matchparen = 1
let mapleader = " "

let g:airline#extensions#tabline#enabled = 1
let g:fzf_layout = { 'window': { 'window': 0.8, 'height': 0.8 } }
let $FZF_DEFAULT_OPTS='--reverse'

set completeopt=menuone,noinsert,noselect
let g:completion_matching_strategy_list = ['exact', 'substring', 'fuzzy']
lua require'nvim_lsp'.tsserver.setup{ on_attach=require'completion'.on_attach }

map <C-\> :NERDTreeToggle<CR>
map <C-/> :TagbarToggle<CR>

nnoremap <leader>h :wincmd h<CR>
let g:gitgutter_map_keys = 0
nnoremap <leader>j :wincmd j<CR>
nnoremap <leader>k :wincmd k<CR>
nnoremap <leader>l :wincmd l<CR>
nnoremap <leader>pv :wincmd v<bar> :Ex <bar> :vertical resize 30<CR>

Upvotes: 2

Views: 6713

Answers (6)

Matthias Braun
Matthias Braun

Reputation: 34413

To change the colors of diagnostic messages:

set termguicolors

hi DiagnosticError guifg=Red
hi DiagnosticWarn  guifg=DarkOrange
hi DiagnosticInfo  guifg=Blue
hi DiagnosticHint  guifg=Green

Setting LspDiagnosticsVirtualTextError did not change colors in my case.

To see the highlights that you're currently using, run :hi. Since the list of highlights can be pretty long, you might want to open that list in a Vim buffer for easier searching and navigating:

:enew|pu=execute('hi')

See also this discussion on how to set LSP colors using Lua. The link was provided in a deleted answer to this question by user Marcel Arie.

Upvotes: 4

Omar Elweshy
Omar Elweshy

Reputation: 180

You can use

Plug 'folke/lsp-colors.nvim'

Upvotes: 1

Shiva Kishore
Shiva Kishore

Reputation: 1701

Here is the one that worked for me

hi LspDiagnosticsVirtualTextError guifg=Red ctermfg=Red

guifg is for GUI clients and ctermfg is for terminal clients

This should work for both terminal and gui clients

Upvotes: 2

Jo&#227;o Rodrigues
Jo&#227;o Rodrigues

Reputation: 21

For future reference, the old answers will probably fail, now there are more organized highlight groups for you to customize the colors of those, for example:

highlight LspDiagnosticsDefaultError guifg=#FF0000

For more detailed information read :help lsp-highlight-diagnostics and :help highlight.

Edit: Notice this needs to go after more general colorscheme settings such as colorscheme whatever that might overwrite your highlight

Upvotes: 2

merry-go-round
merry-go-round

Reputation: 4625

I removed "Plug 'leafgarland/typescript-vim' and it removed it fixed :D

Upvotes: -3

Codeceps
Codeceps

Reputation: 111

I am on Windows 10 and use the new Windows Terminal + NeoVim, my config is similar to yours with the same colorscheme. I fixed the color issue by adding this to my 'init.vim' file, before setting the colorscheme:

set termguicolors

The following options were recommended as a solution in different GitHub discussions, but they had no effect for me whatsoever:

let g:gruvbox_contrast_dark = 'hard'

if exists('+termguicolors')
    let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
    let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
endif

let g:gruvbox_invert_selection='0'
set background=dark

Upvotes: 9

Related Questions