Vim showing random trailing colors on wsl

Viewed 139

Every time I use a colorscheme for vim(WSL) from Github it shows some trailing colors normally within the first 10 lines and sometimes for the entire code like in the link. At first, I thought that it was just highlighting the trailing spaces, but even after removing them, it reverts to its original form on changing cursor locations. Pretty new to vim, so please help me.

the abomination

My .vimrc:

set nocompatible
set clipboard=unnamed
set clipboard=unnamedplus
syntax on
set tabstop=4
set shiftwidth=4
set autoindent
set smartindent
set shortmess+=I
set number
set termguicolors
set relativenumber
set laststatus=2
set backspace=indent,eol,start
set hidden
set ignorecase
set smartcase
set incsearch
nmap Q <Nop> " 'Q' in normal mode enters Ex mode. You almost never want this.
set noerrorbells visualbell t_vb=
set mouse+=a
colorscheme pablo
nnoremap <Left>  :echoe "Use h"<CR>
nnoremap <Right> :echoe "Use l"<CR>
nnoremap <Up>    :echoe "Use k"<CR>
nnoremap <Down>  :echoe "Use j"<CR>
inoremap <Left>  <ESC>:echoe "Use h"<CR>
inoremap <Right> <ESC>:echoe "Use l"<CR>
inoremap <Up>    <ESC>:echoe "Use k"<CR>
inoremap <Down>  <ESC>:echoe "Use j"<CR>

Update: Just found out after messing with stuff that it happens everytime I use ^D or ^U for page up - down. Now it happens even for the inbuilt colors. However does not happen if I use j or k. The only change I did with the .vimrc was adding the set termguicolors. figured out that all my issues happens because of the termguicolors. but this is included from every github has that and so all of them show this random colours. is there any way this can be fixed?

1 Answers

So, apparently the problem lies with windows, or the WSL to be precise. WSL does not seem to support the set termguicolors which is responsible for the weird colors appearing on screen. And because this is essential for several colorschemes (otherwise they look very different). So unless WSL2 provides this feature I don't think it is possible for windows to have any of the fancy colorschemes. The best option is to probably use a virtual machine and run linux or dual-boot your device.

Related