On 24/06/09 11:51, Matt Wozniski wrote:
>
> On Wed, Jun 24, 2009 at 4:32 AM, Tony Mechelynck wrote:
>>
>> On 24/06/09 10:10, TheLonelyStar wrote:
>>>
>>>
>>> Hi,
>>>
>>> I would like to define a key to cycle through the open windows (like Alt-Tab
>>> in most WMs).
>>> But I can only find directonal movements.
>>>
>>> Is this somehow possible?
>>
>> " go to next window, round-robin
>> map<F11>     <C-W>w
>> imap<F11>     <C-O><C-W>w
>> " go to previous window, round-robin
>> map<S-F11>  <C-W>W
>> imap<S-F11>  <C-O><C-W>W
>> " with a count, either one goes to the nth window from top,
>> " not the nth window up or down from current
>
> The nmaps, vmaps, and omaps work with a count, but the imaps don't.
> Really, I question the wisdom of having such a mapping in insert mode,
> or in operator pending mode... And I'm not even sure it's really a
> good idea in visual mode.  Either way, if an imap is really desired,
> it should start with<Esc>  or<C-\><C-N>  instead of with<C-O>  unless
> it's really desired behavior that the map exit insert mode in window
> x, switch to window y, and then re-enter insert mode wherever the
> cursor happened to be in window y...
>
> ~Matt

Right, the "with a count" paragraph doesn't apply to imap, since in 
Insert mode digits are inserted as part of the text -- you can't use a 
count with an Insert-mode command.

I use the mappings like this in my vimrc, the idea is that F11 followed 
or preceded by Shift-F11 goes to the neighbouring window and back 
"without changing modes".

Alternately, replace map by nmap or even nnoremap, and remove the imap 
lines.


Best regards,
Tony.
-- 
The USA is so enormous, and so numerous are its schools, colleges and
religious seminaries, many devoted to special religious beliefs ranging
from the unorthodox to the dotty, that we can hardly wonder at its
yielding a more bounteous harvest of gobbledygook than the rest of the
world put together.
                -- Sir Peter Medawar

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to