10
theuser
7y

Question for vim veterans:

I am fairly confident with vim. I know a couple of commands like delete line, delete under cursor, copy, paste, undo and stuff like that.

So in command mode it's hjkl to move the cursor, which is a good idea because I won't have to move my right palm to the arrow keys.

However, in insert mode, if I needed to move the cursor, I would still have to move my left palm to the esc key in order to use hjkl. Why not just use the arrow keys then?

Comments
  • 3
    I'm not really a veteran, but they usually remap ESC to Caps Lock on the OS level. So you don't have to move the left hand.
  • 0
    The goal is not to only use one hand - if you're going to navigate again it's normal to hit esc and go to normal mode to navigate. Your right hand would stay around hjkl but your left can also do a bunch of things.
  • 1
    I mapped "jk" to esc. Never had problems with it.
    I also tried mapping caps like @512GB and @AlexDeLarge said and liked it too, but I'm already used to "jk". I gained the habit of doing it a few times to make sure I'm in normal mode. I even send it to people on chat by mistake sometimes, and they think I mean "joke".
  • 1
    This is the command btw:

    inoremap jk <esc>
  • 2
    I just reach esc with my pinkie finger. My keyboard is a bit small :) but yeah, as everyone's said, the best way is to remap ESC.
  • 0
    I think you can just hold alt while in insert mode and then use hjkl to move the cursor.
  • 1
    I configure jk to esc.
    But subsequently learned to use ctrl+[ because I use vim on many different machines and servers that I don't have many bindings everywhere.

    And also, don't navigate in insert mode.

    Soon after you'll realize even moving around using hjkl isn't efficient.

    I use '/' , 'f' , '$', '_' , (num)j and (num)k to navigate way more often.
  • 1
    @AlexDeLarge G and gg of course. Ctrl+d and Ctrl+u great as well. Learning to incorporate zt and zz too.
Add Comment