0

How can I set the color scheme manually for the current window only ?

colorscheme affects all windows when I use it.

My use case is that I am using neovim and I have a terminal session in one window and regular windows otherwise, and I would like to have a different color scheme for the terminal window only

3

You can't change colorscheme for a single window in vim (and probably in neovim too).

But if you speak about different colors of regular neovim windows and built-in terminals, you can play around g:terminal_color_0..15.

Usually modern colorschemes use them to set terminal colors to match colorscheme, e.g.:

    let g:terminal_color_0 = '#1c1c1c'
    let g:terminal_color_1 = '#d75f5f'
    let g:terminal_color_2 = '#5f875f'
    let g:terminal_color_3 = '#af8700'
    let g:terminal_color_4 = '#5f87af'
    let g:terminal_color_5 = '#5f5f87'
    let g:terminal_color_6 = '#5f8787'
    let g:terminal_color_7 = '#6c6c6c'
    let g:terminal_color_8 = '#444444'
    let g:terminal_color_9 = '#d787af'
    let g:terminal_color_10 = '#87af87'
    let g:terminal_color_11 = '#d7af5f'
    let g:terminal_color_12 = '#8fafd7'
    let g:terminal_color_13 = '#8787af'
    let g:terminal_color_14 = '#5fafaf'
    let g:terminal_color_15 = '#ffffff'

I am not sure you will be able to change background though.

PS, for vim it would be:

  let g:terminal_ansi_colors = ['#1c1c1c', '#d75f5f', '#5f875f', '#af8700',
        \ '#5f87af', '#5f5f87', '#5f8787', '#6c6c6c', '#444444', '#d787af',
        \ '#87af87', '#d7af5f', '#8fafd7', '#8787af', '#5fafaf', '#ffffff']
2
  • 2
    I am not sure you will be able to change background though. FYI, Neovim has :h 'winhighlight' window-local option. So setl winhighlight=Normal:AnotherGroup could change background/foreground in any window, including terminal. Also, Neovim terminal fully supports syntax highlighting (while still running in Terminal-mode) just like a regular buffer.
    – Matt
    Dec 28 '20 at 8:31
  • Neovim has winhighlight allowing to change the color scheme per window.
    – strboul
    Apr 23 at 12:08

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.