0

I have been trying to do :noremap j k and :noremap k j which works but instead of going up it goes slanted up and down. I want j to move up and k to move down which is opposite in vim. I also tried :map j k and :map k j which tells that i m doing recursive mapping and thus everything fails.

7
  • Nnoremap for no recursive
    – Chelz
    Jun 7 '20 at 11:44
  • 1
    @Chelz not quite; OP has correct noremap for non-recursive. The first n in your suggestion stands for « normal »
    – D. Ben Knoble
    Jun 7 '20 at 12:47
  • 1
    Welcome to Vi and Vim! I’m not sure why your original is failing, but can you try it with nnoremap (that’s two ns)? Do you want this only in normal mode, or visual and operator-pending as well?
    – D. Ben Knoble
    Jun 7 '20 at 12:47
  • "it goes slanted up and down" Don't you get the same effect with the original j and k though? I'd say the most likely cause for this might be concealed or full width characters. I don't think the mapping is what's doing that...
    – filbranden
    Jun 7 '20 at 14:18
  • 1
    Yes OH THATS THE DEFAULT BEHAVIOUR GOT IT :)
    – Machinexa
    Jun 7 '20 at 15:15
0

Ok, so i got the answer. Noremap does the work. Also, when in vim if something like this is there,

1    
    2
         3
    4 
5 

even with remapping and nothing, the both times cursor go from 1,2,3,4,5.

1
  • This behavior you have with the cursor going to the first word of the line is not default behavior by Vim, most likely caused by a plug-in... Try vim --clean, I believe you will no longer reproduce that behavior with that setting.
    – filbranden
    Jun 12 '20 at 14:00

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.