Friday, February 27, 2015

Re: Prevent from closing window

2015-02-16 23:25 GMT+03:00 Paul <Paul.Domaskis <at> gmail.com>:
> I do not want <C-W><C-C> to close the current window, so my _vimrc
> contains: nmap <C-W><C-C> <Esc>
> Unfortunately, this only nullifies <C-W><C-C> if the two keys are
> pressed in quick succession. Is there a way to completely prevent
> <C-W><C-C> from closing the window? I want only <C-W>C to close the
> window. <C-C> should always be to stop doing anything.

Nikolay Pavlov <zyx.vim <at> gmail.com> writes:
| You should map `<C-w>` to a function that will use `getchar()` to
| get the next character and, depending on its value, either run
| `<C-w>{char}` or exit. `<C-w>` and other partial normal-mode
| commands use internally C equivalent of `getchar()` function to get
| the next character, thus they do not care how quick the next
| character was entered.

Thanks, Nikolay. I'll delve into the help files and look for online
examples of getchar() usage when I have the chance.

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment