Question

I am using colemak and thus I have remapped my direction keys like so

noremap n h
noremap e j
noremap i k
noremap o l

noremap h n
noremap j e
noremap k i
noremap l o

The problem is that these keybindings are not honored by the viewport navigation. Eg. when I press ^w+n I want to shift focus to the viewport to the left but instead a new empty viewport is opened.

How can I help rebinding all the viewport navigation keys individually?

Was it helpful?

Solution

I think you'll have to map the <C-W> window navigation commands explicitly, by doing something like:

noremap <C-W>n <C-W>h
noremap <C-W>e <C-W>j
noremap <C-W>i <C-W>k
noremap <C-W>o <C-W>l

noremap <C-W>h <C-W>n
noremap <C-W>j <C-W>e
noremap <C-W>k <C-W>i
noremap <C-W>l <C-W>o

OTHER TIPS

This subject has been somewhat beaten to death over at the colemak forums:

There are a number of listed links to

  • keymaps
  • plugin scripts

I feel Shai's own script is going way too far - doing way more than just integrate Colemak into vim (remapping C-w to Close Tab e.g., showing some bias towards tab-oriented editors, people have complained about in-/exclusive motions (diw, daB etc) not working any more etc).

I guess the best advice, as has been given before is to stick with the defaults and do:

Keyboard bindings for Vim

Vim is an extremely efficient text editor that I use for writing emails and editing any sort of text file. Vim's commands are all controlled from the keyboard: 'd' for delete, 'w' to move the cursor forward one word, 'dw' to delete the text moved over by 'w', '2dw' to delete two words, etc. Left/Down/Up/Right navigation is located on the QWERTY keys H/J/K/L so that the typist's hands never need to reach for arrow keys or the mouse.

Unfortunately, these navigation keys are not so intuitive under Colemak and so I needed to find some more appropriate mappings. After experimenting with many alternatives, here is what I finally decided on and am very happy with:

noremap n j|noremap <C-w>n <C-w>j|noremap <C-w><C-n> <C-w>j
noremap e k|noremap <C-w>e <C-w>k|noremap <C-w><C-e> <C-w>k
noremap s h
noremap t l

noremap f e
noremap k n
noremap K N 
noremap U <C-r>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top