user7522621
user7522621

Reputation:

Vim default color scheme can't change

I'm wondering why my VIM can't apply the changes I modify in $MYVIMRC. The changes only apply to GVIM instead of VIM. I have the following in $MYVIMRC:

syntax on
colorscheme tomorrow-night

I also tried changing the color scheme setting in the command bar below by typing :colorscheme tomorrow-night but nothing changed. Why is it not changing?

Upvotes: 2

Views: 881

Answers (1)

Badacadabra
Badacadabra

Reputation: 8497

The main difference between Vim and GVim is that GVim is an independent application that does not run in your terminal emulator.

If you use Vim and GVim for different purposes, I recommend you to create also a gvimrc file. But if you want to keep a single vimrc file, you can do something like this:

if has('gui_running')
    " GVim
    set guifont=Larabiefont\ 13
else
    " Vim
    set t_Co=256
    set termguicolors
endif
colorscheme archery

Notice the set termguicolors in this code. I think this is the most convenient solution nowadays for common issues with colorschemes. It tells Vim to use the true colors defined for GVim with hexadecimal notation in guifg and guibg (instead of ctermfg and ctermbg).

Upvotes: 1

Related Questions