1

I use Colemak layout. In order to use hjkl I remapped several keys nearby with noremap. It works fine. However, window movement commands somehow do not recognize these mappings. E.g. although I have 'noremap n j' in my vimrc when I press <C-W> n it opens a new split instead of moving downwards.

It seems that <C-W> enters not operator pending mode but some other unknown state. Why is it the case? How can I do my mapping?

I don't want to map it like noremap <C-w>n <C-w>j because of the very small timeout (I need it for other commands).

4

CTRL-W starts a window command, that means, Vim enters a special mode, which won't timeout, awaiting another command and which does not allow maps. And this makes sense, since Ctrl-W is no command, after which a motion follows, so I wouldn't expect Operator Pending mode after Ctrl-W.

8
  • Oh. Well, this is reasonable, but having mappings for this mode also would be nice. Maybe I can squeeze something from langmap and exec mappings on Ctrl-W. – Ivan Smirnov Jul 23 '17 at 20:17
  • "And this makes sense" but it makes no sense. :) – trusktr Dec 30 '20 at 7:40
  • @trusktr what does not make sense? – Christian Brabandt Dec 30 '20 at 9:38
  • To an end user who hasn't delved into the details, pressing ctrl+w and seeing the character waiting for you looks exactly like operator pending mode. Even after reading your answer, I can't understand what it means (apart from perhaps it explaining simply what the code does, but I don't understand any reason the code should actually do that and why it can't just be operator pending). – trusktr Jan 1 at 4:05
  • @trusktr The simple answer is, since CTRL-W starts a window management comment, it cannot logically act on any cursor movement that follows it. It simply does not make sense, or what should happen if you press Ctrl-W followed by move to next word? It simply does not work as an operation that acts over whatever motion follows. – Christian Brabandt Jan 1 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.