Transparent background for Windows version of gvim

1,753 views
Skip to first unread message

Steven Woody

unread,
Oct 20, 2009, 8:06:46 AM10/20/09
to Vim
Hi,

I've been using gvim in Windows. I am just wondering if there is a
solution that can make my gvim transparent to my desktop background or
simply have a background picture. We get this feature when we are
using rxvt in Linux. I hope I can still have the similar function in
Windows + Gvim.

Thanks in advance.

--
Life is the only flaw in an otherwise perfect nonexistence
-- Schopenhauer

narke
public key at http://subkeys.pgp.net:11371 (narke...@gmail.com)

Christian Brabandt

unread,
Oct 20, 2009, 10:16:25 AM10/20/09
to vim...@googlegroups.com
On Tue, October 20, 2009 2:06 pm, Steven Woody wrote:
> I've been using gvim in Windows. I am just wondering if there is a
> solution that can make my gvim transparent to my desktop background or
> simply have a background picture. We get this feature when we are
> using rxvt in Linux. I hope I can still have the similar function in
> Windows + Gvim.

Using VimTweakน you can. I have something like this in my .vimrc:

func! ToggleDarkroom()
" You need the darkroom colorscheme from
http://www.vim.org/scripts/script.php?script_id=2246
" and you need vimtweak.dll from
http://www.vim.org/scripts/script.php?script_id=687
if !exists("g:darkroom")
let g:darkroom=1
let s:o_lbr=&lbr
let s:o_wrap=&wrap
let s:o_colors = exists("g:colors_name") ? g:colors_name : "default"
else
let g:darkroom = 1 - g:darkroom
endif
if (g:darkroom)
let &go=""
set lbr wrap stal&
call libcallnr("vimtweak.dll", "SetAlpha", 210)
call libcallnr("vimtweak.dll", "EnableMaximize", 1)
call libcallnr("vimtweak.dll", "EnableCaption", 0)
call libcallnr("vimtweak.dll", "EnableTopMost", 1)
colorscheme darkroom
else
let &lbr=s:o_lbr
let &wrap=s:o_wrap
exe "colorscheme ".s:o_colors
set go& stal&
call libcallnr("vimtweak.dll", "SetAlpha", 255)
call libcallnr("vimtweak.dll", "EnableMaximize", 0)
call libcallnr("vimtweak.dll", "EnableCaption", 1)
call libcallnr("vimtweak.dll", "EnableTopMost", 0)
endif
endfu

nmap <F11> :call ToggleDarkroom()<CR>

I think someone posted this or a slightly similar version to this list.

Another approach would be to use the rxvt from the Cygwin package, which
can be switched to a transparent mode, IIRC. I used to do this, until I
started using Gvim in Windows, which is a more comfortable.


น)http://www.vim.org/scripts/script.php?script_id=687

regards,
Christian
--
:wq

Steven Woody

unread,
Oct 20, 2009, 12:40:10 PM10/20/09
to vim...@googlegroups.com
On Tue, Oct 20, 2009 at 10:16 PM, Christian Brabandt <cbl...@256bit.org> wrote:
>
> On Tue, October 20, 2009 2:06 pm, Steven Woody wrote:
>> I've been using gvim in Windows.  I am just wondering if there is a
>> solution that can make my gvim transparent to my desktop background or
>> simply have a background picture.  We get this feature when we are
>> using rxvt in Linux.  I hope I can still have the similar function in
>> Windows + Gvim.
>
> Using VimTweak¹ you can. I have something like this in my .vimrc:
>
> func! ToggleDarkroom()
> " You need the darkroom colorscheme from
> http://www.vim.org/scripts/script.php?script_id=2246

I hesitate to use the colorscheme because it claims that I have to use
':qa' to quit the gvim.
> ¹)http://www.vim.org/scripts/script.php?script_id=687
>
> regards,
> Christian
> --
> :wq
>
>
> >
>


Benoit Mortgat

unread,
Oct 20, 2009, 1:12:43 PM10/20/09
to vim...@googlegroups.com
On Tue, Oct 20, 2009 at 18:40, Steven Woody <narke...@gmail.com> wrote:

I hesitate to use the colorscheme because it claims that I have to use
':qa' to quit the gvim.

There is absolutely no reason why you should use the “darkroom” color scheme. I use moria with that DLL and it works perfectly.
--
Benoit Mortgat
39, cours Albert Thomas
69003 Lyon, France
+33 4 27 78 31 27 / +33 6 17 15 41 58

Christian Brabandt

unread,
Oct 20, 2009, 5:26:20 PM10/20/09
to vim...@googlegroups.com
Hi Steven!

On Mi, 21 Okt 2009, Steven Woody wrote:

>
> On Tue, Oct 20, 2009 at 10:16 PM, Christian Brabandt <cbl...@256bit.org> wrote:
> > " You need the darkroom colorscheme from
> > http://www.vim.org/scripts/script.php?script_id=2246
>
> I hesitate to use the colorscheme because it claims that I have to use
> ':qa' to quit the gvim.

I posted an example on how I use VimTweak. You don't need that
particular colorscheme. Use whatever you want. And BTW, it is general
list consensus to avoid top posting and trim quotes.

regards,
Christian
--
:wq

Steven Woody

unread,
Oct 20, 2009, 8:40:56 PM10/20/09
to vim...@googlegroups.com

sorry... where is the example and how VimTweak related with
transparent background? Maybe I missed something information ...

Christian Brabandt

unread,
Oct 21, 2009, 1:42:31 AM10/21/09
to vim...@googlegroups.com
On Wed, October 21, 2009 2:40 am, Steven Woody wrote:
> sorry... where is the example and how VimTweak related with
> transparent background? Maybe I missed something information ...

:call libcallnr("vimtweak.dll", "SetAlpha", <digit>)

Where digit can be any value between 1 and 255, the lower the value the
more transparently will vim become.

regards,
Christian
--
:wq

Ricky

unread,
Oct 21, 2009, 10:55:01 AM10/21/09
to vim...@googlegroups.com
I have tried to use vimtweak.dll, but my Vim became very slow when move
cursor.
Is this function need high requirement of GPU?
like :call libcallnr("vimtweak.dll", "SetAlpha", 220)
Reply all
Reply to author
Forward
0 new messages