Friday, April 27, 2012

Re: Can Vim remember modes when switching between tabs?

On 27/04/12 23:45, Andrei Zmievski wrote:
> I originally noticed this in MacVim, but turns out this happens in the
> terminal as well. If you have two tabs open and enter the Insert mode
> in one, then switch to the other tab (by clicking on it in GUI, for
> example), the Insert mode is still active. This wreaks havoc when I'm
> editing something and want to quickly switch to the other tab to
> search/look up/etc, because the Normal mode keystrokes get inserted
> into the buffer.
>
> Any workarounds for this?
>


You could use some b: variable to remember the mode, and define a
BufLeave autocommand to remember the current mode and a BufEnter
autocommand to set the mode. See also :help mode()

If it isn't possible to detect Insert mode directly from an autocommand,
use (in your status line) a function which returns the empty string,
with a side-effect to set the appropriate buffer-local variable.


Best regards,
Tony.
--
God must love assholes -- She made so many of them.

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