Search code examples
vimneovim

How to learn to use hjkl in vim?


I've been using vim/neovim for like 2/3 months now, and I really like it, but i got a problem, sometimes instead of using hjkl I'm using arrow keys, but I want to always use hjkl.

I tried to watch some youtube tutorials, but idk if theyre good


Solution

  • There's nothing wrong with using the arrow keys. They sit on the keyboard, they do what you'd expect in Vim so everything is fine.

    However, I agree that you should prefer hjkl motion because these keys sit on the home row and you will gain speed. Note that this only works if you are reasonably good at touch typing.

    Let me say it again: the key is to improve your typing skills!

    You can remap the cursor keys to <Nop> so they will do nothing. You can also assign some other useful functionality. Maybe the answers to this question will give you some ideas: Best of both worlds: arrow keys for cursor movement or flipping through buffers

    I had my arrow keys remapped for years and always found it hilarious when co-workers tried to scroll through my code.

    Some Vim users (not me though) also find the vim-hardmode plugin useful, which will disable several keys and taunt you when you press them.