2011-03-27

vim 让背景透明 | make transparent background in vim

gnome-terminal 背景默认是透明的了(至少是ubuntu下),guake也可以弄成透明的,但是vim我用了colorscheme torte,结果背景是一坨黑,很不爽。

最近研究了一下,命令应该是hi Normal ctermbg=NONE,而且应该放到torte.vim里(直接放vimrc中colorscheme的后面没有用,没有再仔细研究)。于是把torte.vim放到~/.vim/colors里,改名,把Normal一行的ctermbg设成None。就好了。 (当然vimrc里要加载这个新的颜色)

另外改guibg后gvim会报错,也没有再自己研究。我基本也不用gvim。



The background color of gnome-terminal has already been transparent, and so has guade. But (maybe since) I use 'colorscheme torte' for vim, the background is a huge black block, ugly...

So I check the help page in vim and found the command should be 'hi Normal ctermbg=None', it's no use if put below the 'colorscheme' scheme in .vimrc, I have to change the color file. So I move the torte.vim in to my ~/.vim/colors, changed its name,and changed ctermbg to be 'NONE' at the line containing 'Normal'. Then it's done (of course you need to load this new scheme file in vimrc)

Besides, gvim will show an error dialog if I set guibg to be NONE, don't know why but ok for me as usually I don't use gvim.

No comments: