0

Hello I am new to vim and only used it via plugin in my IDE and now I wanted to change to the consol.
I use the build : NVIM v0.5.0-727-gc10c2fab5\ OS: Windows 10
Terminal: Windows Terminal with PowerShell\

I installed via vim-plug the gruvbox colorscheme but it doesn't look like gruvbox-colors. When I enter :colorscheme it returs gruvbox if I change to another colorscheme the colors change as well.
I read often something about set termguicolorsbut when I add this to my init.vim file everything becaumse "white" or just the sames color as in the terminal.\

Here is my init.vim file, Thank you in advance that you took your time\

" Automatic reloading of .vimrbc
autocmd! bufwritepost init.vim source %

" Enable syntax highlighting
filetype off
filetype plugin indent on
syntax on

"" Bette  copy & paste
" When you want to paste large blocks of code into vim, press F2 before you
" paste. At the bottom you should see ``-- INSERT (paste) --``.
set pastetoggle=<F2>
set clipboard=unnamed

set cmdheight=2
set relativenumber
set expandtab
set smartindent
set nu
set smartcase
set noswapfile
set nobackup
set undodir=~/AppData/Local/nvim/undodir
set undofile

" Having longer updateti
" e (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=50

set colorcolumn=80

" Rebind <Leader> key
let mapleader = " "

" bind Ctrl+<movement> keys to move around the windows, instead of using Ctrl+w + <movement>
map <c-j> <c-w>j
map <c-k> <c-w>k
map <c-l> <c-w>l
map <c-h> <c-w>h

" Bind nohl
" Removes highlight of your last search
noremap <C-n> :nohl<CR>
vnoremap <C-n> :nohl<CR>
inoremap <C-n> :nohl<CR>

call plug#begin('~/AppData/Local/nvim/autoload')

Plug 'mbbill/undotree'
Plug 'OmniSharp/omnisharp-vim'
Plug 'gruvbox-community/gruvbox'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'preservim/nerdtree'

call plug#end()

let g:gruvbox_termcolors=16
set background=dark
colorscheme gruvbox

init.vim how it is displayed

With nvim -u NONE .\init.vim I just get a white init.vim file with no colors

3
  • 1
    Welcome to Vi and Vim! Please edit your question to show what « displayed wrongly » means. You should also try to debug your vimrc to present a minimal reproducible example. Lastly, note that termguicolors usually only works if your terminal supports it (neovim may have changed that?), and that vim colorschemes sometimes look « off » in terminals that dont have their color palettes adjusted to match.
    – D. Ben Knoble
    Commented Oct 8, 2020 at 13:12
  • @D.BenKnoble Thank you for your fast answer. As you can see in the picture now it is more than a little bit off (if you know gruvbox colors). I used the gruvbox plugin with Vim 8 within WSL2 in OpenSUSE and Windows Terminal as well and the colors were represented correctly.
    – tilupe
    Commented Oct 8, 2020 at 14:36
  • 2
    try set termguicolors and remove let g:gruvbox_termcolors=16
    – Maxim Kim
    Commented Oct 8, 2020 at 14:37

1 Answer 1

1

Looking into the source code of gruvbox-material/gruvbox I can see:

https://github.com/gruvbox-community/gruvbox/blob/9e71159ffa93be1e772d2cb3c78ee940f7b308ba/colors/gruvbox.vim#L272 g:gruvbox_termcolors == 16 fallback to use terminal 16 colors which are only viable if you have set them properly in a terminal to match gruvbox colors.

I suggest to add set termguicolors and remove let g:gruvbox_termcolors=16.

3
  • When I do this I lose all the colors (everyhting becomes to the color which I have i the corresponding terminal)
    – tilupe
    Commented Oct 13, 2020 at 15:22
  • 1
    @tilupe do you use terminal with truecolor support? If not then the only option is to fallback to 256 colors (again if your terminal supports it) or to 16 colors as you did but you would have to setup your terminal color palette to match gruvbox colors. Or just use terminal with truecolor support.
    – Maxim Kim
    Commented Oct 13, 2020 at 18:04
  • Okey I looked it up and had to realize that PowerShell does not have true color support, according to this open discussion github.com/PowerShell/PowerShell/issues/2381 The reason why I chose PowerShell is that I had problems using OmnirSharp with vim on WSL2. So eithter I solve these problems oder the color ones. Thank you anyway
    – tilupe
    Commented Oct 15, 2020 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.