Transparent background of Vim editor within the xfce-4 terminal

12

9

Is there a way to have a transparent Vim session within the xfce-4 terminal?

tmaric

Posted 2012-03-07T21:41:58.223

Reputation: 375

Answers

23

I made mine transparent in gnome-terminal (and I'm guessing this will work for xfce-4 too)

I'm using Molokai theme (the 256 colour version).

I just had to change one line.

(original):

hi Normal          ctermfg=252 ctermbg=233

(my version, with transparent background):

hi Normal          ctermfg=252 ctermbg=none

Juanjo

Posted 2012-03-07T21:41:58.223

Reputation: 346

Juanjo's answer is great, and inspired me to add this edit: hi NonText ctermfg=250 ctermbg=none This ensures that the parts of buffers that don't have content, are transparent. – duma – 2012-12-23T20:20:25.767

6Note that you can just add this line to your .vimrc and it will have the same effect: hi Normal guibg=NONE ctermbg=NONE. And it won't change the forgroud color for the Normal group either. – Robert Audi – 2014-02-09T21:19:16.690

2

In the Terminal Preferences dialog, the Appearance tab has a "Transparent background" option to make the window transparent. If you found this option and set it appropriately, I can think of two reasons that it might not be working for you:

1) You might be using gvim instead of console vim within the terminal. If Vim opens up a new window, then you're using gvim instead of console vim.

2) You might have a vim colorscheme that explicitly sets white or black as the background color. It's unusual to have a misbehaving color scheme like this, so I don't think it's likely.

I think it's most likely that you're actually using gvim instead of console vim.

amcnabb

Posted 2012-03-07T21:41:58.223

Reputation: 323

Thanks for the answer, but I've figured it out: the vim coloscheme had ctermbg set to "black", I've removed it and now the background is transparent. I'm definitely using vim. – tmaric – 2012-03-08T09:47:06.070

So my answer was right, then, wasn't it? I suggested it might be a colorscheme that explicitly sets the background to black or white, which indeed turned out to be the problem. – amcnabb – 2012-03-13T18:14:25.783

sorry for accepting your answer so late.. it missed my attention somehow.. – tmaric – 2013-01-21T13:05:00.483