2

I use GVim with the gruvbox colorscheme. When I open a terminal inside vim with :term, the colors are different, it looks like another colorscheme is applied.

enter image description here

The other terminals I use (urxvt and xfce4-terminal) also look nothing like what I see in the vim terminal.

Where is the coloscheme of the vim terminal buffer configured and how can I change it ?

  • Why do you think it is different in terminal in your case? Normal foreground and background in terminal looks the same as in your buffer. – Maxim Kim May 21 at 8:38
2

In GVim, you can control the 16 ANSI colors used by your terminal with the g:terminal_ansi_colors variable.

See :help g:terminal_ansi_colors:

In GUI mode or with 'termguicolors', the 16 ANSI colors used by default in new terminal windows may be configured using the variable g:terminal_ansi_colors, which should be a list of 16 color names or hexadecimal color codes, similar to those accepted by highlight-guifg. [...]

The term_setansicolors() function can be used to change the colors, and term_getansicolors() to get the currently used colors.

| improve this answer | |
  • There's also the Terminal highlight group to define default foreground and background colors. But I think in your case the 16 ANSI colors is where you're seeing the differences... Right? – filbranden May 21 at 8:46
2

In modern vim/neovim there is :h g:terminal_ansi_colors (vim) or 16 of g:terminal_color_0 .. g:terminal_color_15 (neovim).

If you open gruvbox colorscheme you use, you will find those definitions there (most probably).

Basically:

  1. your whatever terminal can have palette of base 16 colors defined (there are defaults for each type of terminal, but you can also redefine it).
  2. In Vim when you open a :term those default/redefined base 16 colors are applied to it unless you or a colorscheme again redefine them with g:terminal_ansi_colors to match your colorscheme
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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