Friday, December 5, 2014

Re: Is there a way to get info when Vim enters into operator-pending-mode and leaves it?

On Friday, December 5, 2014 8:45:12 AM UTC-6, Igor Forca wrote:
> Hi,
> I use gVim 7.4 on Windows 7. I would like to disable Caps Lock functionality in gVim and make it possible to enable it in all other programs - I desperately need Caps Lock in other programs. I have manage to do this with help of AutoHotKey program. Works perfectly.
>
> But now I have thought little bit farther I would actually like to disable Caps Lock functionality ONLY! in normal mode and make it enabled in insert mode. I have written a lot of code that actually knows when Vim switches from normal to visual to insert mode. For example being in normal mode when I press letters: a, A, i, I, s, S, c, C and R it should exit the normal mode and enter into insert mode. This is OK for most of the times, but there is also operator-pending mode. Like when pressing: daw so when d is pressed operator-pending-mode appears when a in da command is pressed then vim is still in operator-pending-mode but when movement part of the command is pressed like w in daw command then operator-pending-mode is exited and it gets into normal mode again.
>
> I would like to recognize the operator-pending-mode. Is there any way to set operating system variable like operator-pending-mode=1 when Vim enters into operator pending mode and set operating system variable operator-pending-mode=0 when Vim leaves the operator pending mode?
> Thanks

May I suggest an alternate approach?

You can set up a keymap, or language mappings, in Vim that you can toggle on and off with CTRL-^, and they only affect insert mode (and command-line mode, and replace mode, and search) but not normal or visual modes.

Details here:

http://vim.wikia.com/wiki/Insert-mode_only_Caps_Lock

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