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 Answer 1

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   
1
  • 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, 2017 at 22:29

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .