Monday, July 25, 2011

Re: disable "window close button (X)"

On Sun, 24 Jul 2011, warem wrote:

> hi,
>
> i am using gvim in M$. i would like to know if it is possible to
> disable "window close button (X)" on the top right corner in gvim. my
> purpose is to prevent closing vim accidentally by pressing button X.

Have you tried pressing the button?

In Win7 (only thing I have access to ATM), with a buffer with unsaved
changes, if you click on the 'X' to close, you should get a dialog box
asking "Save changes to [buffer name]?" with the options 'Yes' (= save
changes and quit), 'No' (= discard changes and quit), and 'Cancel' (=
don't quit, changes remain).

So, GVim itself already has some protection.

As Tony stated, anything else would be up to the O/S. Or, an external
O/S-specific tool. An example for Windows would be to use AutoHotkey¹.

--
Best,
Ben

¹: "grey out" the close button script (didn't work for me in Win7,
should work pre-Vista?):
http://www.autohotkey.com/forum/viewtopic.php?p=62506#62506

²: This crazy script might be what you want:
http://www.donationcoder.com/Software/Skrommel/NoClose/NoClose.ahk

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: