set vim background transparent

codingninja picture codingninja · Jun 8, 2016 · Viewed 36.6k times · Source

I am using the Matrix colorscheme along with CSApprox for my terminal vim.

I can not seem to be able to set the background as transparent. I have tried editing the matrix.vim file but it doesn't make it any better.

here is the matrix.vim

" vim:set ts=8 sts=2 sw=2 tw=0:
"
" matrix.vim - MATRIX like colorscheme.
"
" Maintainer: MURAOKA Taro <[email protected]>
" Last Change:  10-Jun-2003.

set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif

let g:colors_name = 'matrix'

hi Comment guifg=#226622
hi Constant guifg=#55ff55
hi Special guifg=#44cc44
hi Identifier guifg=#55ff55
hi Statement guifg=#55ff55 gui=bold
hi PreProc guifg=#339933
hi Type guifg=#55ff55 gui=bold
hi Underlined guifg=#55ff55 gui=underline
hi Error guifg=#55ff55
hi Todo guifg=#113311 gui=none
hi Cursor guifg=#226622
hi lCursor guifg=#226622
hi CursorIM guifg=#226622
hi Directory guifg=#55ff55
hi DiffAdd guifg=#55ff55 gui=none
hi DiffChange guifg=#55ff55 gui=none
hi DiffDelete guifg=#113311 gui=none
hi DiffText guifg=#55ff55 gui=bold
hi ErrorMsg guifg=#55ff55
hi VertSplit guifg=#339933
hi Folded guifg=#44cc44
hi FoldColumn guifg=#44cc44
hi IncSearch guifg=#226622 gui=none
hi LineNr guifg=#44cc44 gui=none
hi ModeMsg guifg=#44cc44
hi MoreMsg guifg=#44cc44
hi NonText guifg=#44cc44 guibg=NONE ctermbg=none
hi Normal guifg=#44cc44 guibg=NONE ctermbg=none
hi Question guifg=#44cc44
hi Search guifg=#113311 gui=none
hi SpecialKey guifg=#44cc44
hi StatusLine guifg=#55ff55 gui=none
hi StatusLineNC guifg=#113311 gui=none
hi Title guifg=#55ff55 gui=bold
hi Visual guifg=#55ff55 gui=none
hi VisualNOS guifg=#44cc44
hi WarningMsg guifg=#55ff55
hi WildMenu guifg=#226622

and my .vimrc file

set nocompatible
filetype off

set rtp+=~/.vim/bundle/Vundle.vim/
call vundle#begin()

Plugin 'gmarik/Vundle.vim'
Plugin 'fatih/vim-go'
Plugin 'vim-airline/vim-airline'
" Plugin 'vim-airline/vim-airline-themes'
Plugin 'airblade/vim-gitgutter'
" Plugin 'altercation/vim-colors-solarized'
Bundle 'morhetz/gruvbox'
Plugin 'tpope/vim-git'
Plugin 'Valloric/YouCompleteMe'
Plugin 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
" Plugin 'flazz/vim-colorschemes'
Plugin 'godlygeek/csapprox'

call vundle#end()

filetype plugin indent on
syntax on
syntax enable

#...
#...
#...
#...
#...

set t_Co=256
colorscheme matrix

if i enter hi Normal guifg=#44cc44 guibg=NONE ctermbg=none in the command prompt, it looks as expected. but not when it's only declared in matrix.vim. i also tried adding it after colorscheme matrix in .vimrc, but it does not help.

How it looks like when first loaded.

enter image description here

How it looks like after i enter command

enter image description here

Answer

GiftZwergrapper picture GiftZwergrapper · Jun 9, 2016

You don't have to change anything in your colorscheme just add the following to your .vimrc:

hi Normal guibg=NONE ctermbg=NONE

Update:

As Liam mentioned in the comments:

This line needs to go below the colorscheme in .vimrc