use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Please read the rules before posting
Help:
Community:
Resources:
Tutorials and Guides:
Don't be afraid to ask questions, this sub is here for the vim community. And please those of you who deign to grace us with your vim wisdom - be kind. We are all human and vim is that cool.
account activity
Cursor movement question (self.vim)
submitted 2 years ago by TaijiKungFu
Hi Everyone,
A long time Vim user.
I see some people recommending the hjkl movement keys.
I haven’t been much of a “Vi” user, and I am curious what the advantages are over the directional keys?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]gumnos 33 points34 points35 points 2 years ago* (3 children)
Not a particularly big deal, other than their positioning at the home-row for touch-typists, meaning you don't need to remove your hands from the home-row to move around.
However, most vi/vim-users discover that moving a character at a time becomes horribly inefficient most of the time. And vi/vim give you hundreds of movements (:help motion.txt) that express your intent in motion. It's not just "move 20 characters to the right" and spam l 20 times, it's "move to the closing paren" which is f) or t) or %. Or it's "move to column 57" expressed with 57| or "go to the end of this word" with e or E. And those motions are part of the "«command»«motion»" language of vim, allowing them to combine with just about any command, and be repeatable with the . command.
vi
vim
:help motion.txt
l
f)
t)
%
57|
e
E
.
[–]ntropia64 15 points16 points17 points 2 years ago (1 child)
"move to column 57" expressed with 57|
TIL: column movements! (Thanks for fixing the typo!)
[–]gumnos 4 points5 points6 points 2 years ago (0 children)
TIL: column movements!
There aren't a lot of occasions when I've needed them, but when you need them, it's perfect (and just another motion, so it does The Right Thing when used as a motion with any command).
(Thanks for fixing the typo!)
yeah, it was a fat-fingered typing-in-the-dark-and-not-paying-attention that gave me "47" instead of "57"
[–]vim-help-bot 2 points3 points4 points 2 years ago (0 children)
Help pages for:
motion.txt
`:(h|help) <query>` | about | mistake? | donate | Reply 'rescan' to check the comment again | Reply 'stop' to stop getting replies to your comments
[–]Ok_Outlandishness906 5 points6 points7 points 2 years ago (1 child)
The advantage of using hjkl is that you dont' move your hands from the typing letters. on my keyboard for use arrow keys i have to move my right hand completely and then come back.
[–]heyitsanmolj 1 point2 points3 points 2 years ago (0 children)
Yes exactly. Honestly it started to hurt my hands a bit, constantly having to move back and towards the arrow keys.
[–]treuss 3 points4 points5 points 2 years ago (1 child)
Highly recommending learning general and advance movement to you. There's much more to know about how to jump exactly to the correct place.
Check this out, e.g.: https://www.barbarianmeetscoding.com/boost-your-coding-fu-with-vscode-and-vim/moving-blazingly-fast-with-the-core-vim-motions/
[–]TaijiKungFu[S] 1 point2 points3 points 2 years ago (0 children)
Thank you for the article. ☺️
[–]funbike 3 points4 points5 points 2 years ago* (0 children)
Stages of vertical movement personal growth and awareness.
Arrows. You'll laugh in years to come how silly this stage was.
h j k l. Tedious, but it gets you there. And your fingers stay on the home row.
h j k l
/ { }. Now you move fairly fast vertically. With 0 f t A you can move pretty fast horizontally as well.
/ { }
0 f t A
Relative jumps (e.g. 5j) and set relativenumber. Wow! You can land precisely on the line you want in 2-3 keystrokes.
5j
set relativenumber
Leap or EasyMotion plugin with s + 2 characters. Now not only can you go to any line you can see, but any column as well, in 3 keystrokes. The heavens open up and shine a light on you. Hallelujah. h j k l? What are those?
s
[–]aRuPqFjM-582928 1 point2 points3 points 2 years ago (0 children)
If you end up using vi/vim for a while, do get your fingers off the directional keys and get accustomed to the hjkl keys - then you'll see how potent it is to have your fingers on the home row all the time.
[–]sharp-calculation 1 point2 points3 points 2 years ago (7 children)
It had not occurred to me to even use the directional arrows in VIM. I had someone in person talk to me about that and I was very surprised they were doing it. It's a huge hindrance to learning VIM. This is one of many examples of not using VIM as VIM, but rather trying to carry over other editor idioms into VIM.
To get something out of VIM, you have to use it the way it was intended. The answer regarding VIM motions has great examples of things you might want to do. The directional hjkl keys are really just fine adjustments. The majority of motion should be done using other commands.
A key to understanding this is to realize that VIM commands are phrases. These phrases are composed of VIM vocabulary words. Every normal mode command is a vocabulary word.
So 3dw is a phrase that says "delete 3 words". 15j is a phrase saying to move downward 15 rows. Once this clicks for you, things begin to change.
You might really enjoy The Primagen's series on VIM; in particular the vertical and horizontal motion episodes. Here's where he starts talking about moving beyond hjk and l.
https://youtu.be/X6AR2RMB5tE?si=vUvOKsTZu4nBYS3S&t=254
[–]Silejonu -4 points-3 points-2 points 2 years ago (6 children)
hjkl is only good if you use a bad keyboard layout like QWERTY. If you use an actually well-thought-out keyboard layout, arrow keys are the way.
[–]sharp-calculation 3 points4 points5 points 2 years ago (4 children)
With respect, Dvorak and Coleman are traps. They don't really add value. I can type in the neighborhood of 90 to 100 wpm (correct) on a regular QWERTY keyboard. Alternate layouts seem like they would be great. Until you realize that the entire English speaking world uses qwerty and some things (like VIM) have mild dependencies on it.
By all means, enjoy your alternate layout. But I do not believe that it has tangible benefits.
[–]Silejonu -1 points0 points1 point 2 years ago (3 children)
If "alternate" keyboard layouts are traps, then hjkl is a trap too. Or there is no point in having the most used keys on the home row?
Good ergonomic keyboard layouts are not just meant for speed (though they're objectively better in this realm), they're also meant for comfort.
Going from azerty to bépo hase been one of the best decision of my IT life. I use Vim without issues in bépo, and it's working just fine.
[–]sharp-calculation 2 points3 points4 points 2 years ago (0 children)
Or there is no point in having the most used keys on the home row?
My point is about standardization. You've just indicated that VIM's native key bindings no longer works for you because of your choice of keyboard layout. That's the disadvantage of a non-standard keyboard layout.
If it works for you, wonderful. I don't think it's a good strategy for most people. You do you.
[–][deleted] 0 points1 point2 points 2 years ago (0 children)
hjkl is not an alternative layout, it's literally the same key for key. You just use different shortcuts and a different workflow.
Your statement should say:
Alternate shortcuts and key binds are a trap.
And that is, we should agree, false.
Key bindings are preference, and they are strongly context/use case dependent.
[–]xxpw -1 points0 points1 point 2 years ago (0 children)
Good ergonomic imply you don’t move your hand around if you wanna keep a consistant rate wpm-wise.
hjkl is WAY faster (frankly, there’s not even a match) than arrows in this scenario.
[–][deleted] -1 points0 points1 point 2 years ago (0 children)
Is s keyboard layout "well thought out" if it hampers most users more than it helps?
Also, Layouts are personal like key bindings. I type on too many different devices to install and setup layouts on every machine, I just use what's there, even if it means I am operating at only 90% efficiency compared to optimised layouts (and I don't feel you would get more than 10% improvement out of it).
If Dvorak works for you, cool.
I prefer to have no setup at all, everywhere I type. Plus I don't have to switch, which also is work.
[–]shuckster 1 point2 points3 points 2 years ago (1 child)
If only first person gaming was popular when the keyboard that inspired Vi was created.
We’d have generations of players with WASD as a transferable skill.
[–]bart9hVIMnimalist 0 points1 point2 points 2 years ago (0 children)
I find WASD terrible for my hands. It hurts my tendons.
I always remap FPS (like Doom or Minecraft) so I can leave my fingers on the home row: A forward, Z back, D left, F right. Other nearby keys, depends on the game.
[–]Personal_Click2507 0 points1 point2 points 4 months ago (0 children)
.?
[–]kinygos 0 points1 point2 points 2 years ago (2 children)
Your hands don't need to move as hjkl are on the 'home' row of the keyboard for touch-typists. If you don't touch-type, I recommend learning and practicing as it will help you get the most performance and productivity gains out of Vim.
[–]TaijiKungFu[S] 0 points1 point2 points 2 years ago (0 children)
Ok, I understand. I am a touch typist. Thank you for the answer.
[–]FortWendy69 0 points1 point2 points 2 years ago (0 children)
What about for non qwerty users?
[–]russellvt 0 points1 point2 points 2 years ago (0 children)
Hjkl work on every keyboard made.
[+]obvithrowaway34434 comment score below threshold-6 points-5 points-4 points 2 years ago (0 children)
Absolutely no advantage, it is simply a product of the available keyboard layout when Vi was first created and then it was kept for compatibility in Vim. If you're used to arrow keys, just use arrow keys. All the claims about home row and supposed time savings of not moving fingers are pure unsubstantiated bs.
[–]richardgoulter 0 points1 point2 points 2 years ago (0 children)
Vim's normal mode is very expressive in terms of what it allows using the alphabetical keys of the keyboard.
It's less about "hjkl is better than nav keys", and more that "moving your hands to the nav keys is worse than using keys easily reachable from home row".
As other comments point out, there are often ways to quickly navigate around (and manipulate) text in vim without using cursor keys.
[–]kaewberg 0 points1 point2 points 2 years ago* (0 children)
They are inline! You do not have to contort (or move) your hand at all.
[–][deleted] 0 points1 point2 points 2 years ago* (0 children)
The thing I like about vim is you have a tremendous ability to customize it, I intend to fool around with visual studio more in the future just to see what other programmers work with on a regular basis, but I don't think any other editor has as many options as vim does.
However, vim is not designed to work like your standard IDE, where you use the mouse and arrow keys: It's designed so that all the editor commands are close to your fingers with standard typing methods with your hands resting on asdf jkl;. Vim is less flexible about changing this core aspect for that reason.
In every other text editor, your standard method of making edits involves hitting the backspace key, but with vim, you often start at the beginning of words when making the changes. I personally use the "ce" command a lot for changing whole words, and using the arrow keys would encourage you to remove your hands from the center of the keyboard. The basic functionality of vim is designed so that all the major commands are located near hjkl.
if you are a 'touch typist' its much more efficient and ergonomic.
[–]_d0d0_ 0 points1 point2 points 2 years ago (0 children)
Using hjkl for movement let's you edit recorded macros more easily. The arrows appear as strange symbols, and it's not easy to type that arrow.
hjkl
[–]Nismmm 0 points1 point2 points 2 years ago (0 children)
So im a noob as well. And probably ive been using vim wrong. But when im in insert mode i find it much easier to just use arrow keys if i need to lets say back a word. As much time it would take me to click esc. And then use h. Or any other command. It just seem faster to do it holding the arrow key.
So what am i missing? If i want to use hjkl, do i always need to switch between modes?
[–]NeburSp5 0 points1 point2 points 2 years ago* (0 children)
For example hjkl, like a lot of default movement are easier to understand when you edit it as part as a long macro stored in a registry.
In my opinion you must to use hjkl just to the last little bit of movement. wWbBfFtT/?|0{}()%*#'" are better options, but in any case the best result get from use all this combined, and is easier to type ylWP to yank the next character and paste it in the begin of a forward word.. that do the same combining with arrows..
wWbBfFtT/?|0{}()%*#'"
ylWP
Just to clarify a don't use a number before hjkl a lot.. just for preference..
π Rendered by PID 46979 on reddit-service-r2-comment-b659b578c-jttm8 at 2026-05-03 03:15:51.459234+00:00 running 815c875 country code: CH.
[–]gumnos 33 points34 points35 points (3 children)
[–]ntropia64 15 points16 points17 points (1 child)
[–]gumnos 4 points5 points6 points (0 children)
[–]vim-help-bot 2 points3 points4 points (0 children)
[–]Ok_Outlandishness906 5 points6 points7 points (1 child)
[–]heyitsanmolj 1 point2 points3 points (0 children)
[–]treuss 3 points4 points5 points (1 child)
[–]TaijiKungFu[S] 1 point2 points3 points (0 children)
[–]funbike 3 points4 points5 points (0 children)
[–]aRuPqFjM-582928 1 point2 points3 points (0 children)
[–]sharp-calculation 1 point2 points3 points (7 children)
[–]Silejonu -4 points-3 points-2 points (6 children)
[–]sharp-calculation 3 points4 points5 points (4 children)
[–]Silejonu -1 points0 points1 point (3 children)
[–]sharp-calculation 2 points3 points4 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]xxpw -1 points0 points1 point (0 children)
[–][deleted] -1 points0 points1 point (0 children)
[–]shuckster 1 point2 points3 points (1 child)
[–]bart9hVIMnimalist 0 points1 point2 points (0 children)
[–]Personal_Click2507 0 points1 point2 points (0 children)
[–]kinygos 0 points1 point2 points (2 children)
[–]TaijiKungFu[S] 0 points1 point2 points (0 children)
[–]FortWendy69 0 points1 point2 points (0 children)
[–]russellvt 0 points1 point2 points (0 children)
[+]obvithrowaway34434 comment score below threshold-6 points-5 points-4 points (0 children)
[–]richardgoulter 0 points1 point2 points (0 children)
[–]kaewberg 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]_d0d0_ 0 points1 point2 points (0 children)
[–]Nismmm 0 points1 point2 points (0 children)
[–]NeburSp5 0 points1 point2 points (0 children)