0

I have these lines in my .vimrc:

" Remap movement 
nnoremap j h                                                                                                      
nnoremap k j                                                                                                      
nnoremap l k                                                                                                      
nnoremap é l

This seems to work properly for simple navigation, but utterly fails when I want to have movements combined with actions, eg. d2k should delete 2 lines downwards, but it actually moves upwards (as if i did not remap the key k. How do I correctly do the remapping, so that every command obeys it?

1

I've found the answer, I needed to add separate lines like this:

" Remap movement keys for operations                                                                                  
onoremap j h                                                                                                          
onoremap k j                                                                                                          
onoremap l k                                                                                                          
onoremap é l   
  • 2
    You also need to add visual mode if you want it to work while selecting lines. That can be done with vnoremap or xnoremap – DJMcMayhem Jun 4 '17 at 22:29

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.