1. 20
  1. 13


    If we flip through the ADM manual, we see that the ADM used “backspace” to mean “move the cursor left” without deleting the current character.3 With ^H and ^J already being used as left and down, it made sense to turn ^K and ^L into up and right.

    1. 11

      It isn’t, as the other comment mentioned, it is just historical baggage that was retconned into orthodoxy.

      The notion that vim is somehow The One Real Hacker tool is harmful. Use what works well for what you’re doing. I use a mix of CLion, VSCode, and neovim. They’re all really good at certain tasks. And I spend zero hours a month on contorting vim into handling them almost as well ;)

      1. 11

        I don’t think it’s just “historical baggage”.

        To be clear: I use arrow keys as well, I put “hjkl is so much faster” in my Vim myths page, and I proposed to de-emphasize it in vimtutor. I’m hardly some sort of hjkl-purist.

        But I do often find it more convenient. In particular, the location of the keys are often more convenient, especially on my laptop. 50% of the reason I use vimium in Firefox is so I can scroll up and down with j and k, since I don’t need to put my hand in the corner.

        That hjkl specifically is used is perhaps an accident of history: it could have been another set of similar keys. But then again: it’s not like the creators of the ADM-3A keyboard weren’t thinking about their design either and used keys that worked fairly well (although if I were to design it today I would probably use wasd like many games).

        It’s a bit like the tired old “we’re not living in 1972 any more, there’s no reason not to use 80-column text” trope. Well, no, but a line width of roughly 80 characters is what many find fairly comfterable to read, and it’s probably not a coincidence that this width was used by terminals of old. (hard-line 80-col purism is also tiring though, but I know very few of those people).

        I am annoyed when people keep harping on like the hjkl thing like it somehow matters. It doesn’t really, and I couldn’t disagree more with Bram’s comment that it’s a “core function of Vi and Vim”, and the other reply is even worse. But I do think it’s useful, and more than just “baggage”.

        1. 2

          I’m not sure whether it’s actively harmful, but it’s not productive, and very tiresome.

        2. 7

          It took me a while to get used to HJKL, but now it’s second nature to me.

          I actually quite like J/K for down/up. I navigate up and down quite a lot, having these next to each other (instead of on top) feels really nice to me.

          1. 6

            It doesn’t need to be. It just needs to be in your muscle memory so you don’t need to think about it.

            1. 4

              Intuitive: of course not. Has anyone sane seriously argued that it is?

              Ergonomic: Neither great nor terrible if you ask me. It works well enough.

              But of course both of those are complete red herrings so… whatever. Everything except really purist-minimalist vi supports arrow keys, so use them as convenient.

              I once had a coworker who, apparently inspired by FPS keyboard layouts, remapped his vim keys so that movement was on wasd, and the functions formerly on wasd went to hjkl. This was fine until he put his custom config into /root/.vimrc on some of the machines… opening up a file, parking my finger on j to scroll down and finding out that j had become d was a bit annoying.

              1. 3

                Note that you don’t need to have a special keyboard to implement this. For several years, I used xkb/autohotkey to remap capslock to layer toggle and JKLI and neighboring keys to arrows, home, end, page up and page down. This setup is described in https://manybutfinite.com/comments/home-row-computing.html, my version is here: https://github.com/matklad/config/blob/master/home-row.xkb.

                1. 3

                  I find hjlk navigation very intuitive and ergonomic, and I am definitely not old enough to have ever used any of those ancient computers vi was originally designed for where arrow-key symbols were printed on hjlk. I like having access to hjlk navigation in contexts other than vim, as well, like pagers and PDF readers.

                  But certainly if this person doesn’t like that style of navigation, they should either remap the navigation keys to something else, or use the arrow keys, or use a different editor. There’s a lot of text editors out there.

                  1. 3

                    I found hjkl very intuitive at the time I learned vi. I still use vi, and I never use the arrow keys.

                    The reason I found it intuitive was that I had memorized the ASCII character set. Ctrl-H is the BS code, which originally mean to move the cursor one position to the left. Ctrl-J is the LF code, which originally meant move the cursor down to the next line, without any horizontal movement. ctrl-K is VT, vertical tab, which means vertical cursor movement. Although this doesn’t exactly mean up 1 line, I know its a vertical movement, so it’s easy to internalize the new meaning of move up one position. And ctrl-L is FF, form feed, which is also some kind of cursor movement. In other words, the HJKL bindings are mneumonic for me.

                    When I use vi, I bind the caps lock key to control. I type ‘h’ to move the cursor 1 left in command mode, and in edit mode I type ctrl-H to backspace (so I don’t lift my fingers from home row to backspace). Notice how I am using the same key, the H key, for two closely related commands? That’s also mneumonic for me. My fingers just know that ctrl-H and Backspace are logically the same key, because that’s how ASCII keyboards have always worked (as long as I’ve been using them anyway).

                    1. 3

                      My takeaway from this controversy and associated comments is that “intuitive” is a false measure; what intuitive really means is just “similar to a pattern i personally learned previously” which is obviously very subjective and not of much value to chase after.

                      1. 2

                        “Subjective measure” is not the same as “false measure”. For example, taste is subjective but most people like drinking orange juice more than they like chewing peppermint leaves. Subjective? Yes. Worthless? Not at all.

                        1. 1

                          A wise man once said: “The only intuitive interface is the nipple[*]. After that, everything is learned.”

                          [*] This is not 100% true either. Many babies have trouble breast-feeding.

                        2. 3

                          But if you don’t find HJKL intuitive or ergonomic, why are you using vim? Why not use some other editor that doesn’t have that navigation baked in at such a deep level?

                          1. 28

                            Vim is so, so, so much more than the keys you use to move by character.

                            1. 8

                              I don’t think it’s particularly baked in, four noremap commands in a .vimrc should replace all usage. (I say that, but probably a vim expert will point out they also need to be remapped in some odd half-mode or something.) And if the author doesn’t care for it, yeah, they should tweak or replace their editor, there’s no value in standing on tradition here.

                              1. 8

                                I’ve used vim for over 25 years and have never used hjkl navigation. I’ve always used the arrow keys. This has never hindered my usage of vim and the only time I notice it is those rare occasions when vim is set up really badly by default, (looking at you FreeBSD). Vim is not just hjkl navigation and has a lot of features that a lot of other editors don’t have, but modal editing is why I’ve never looked at other editors.

                                1. 1

                                  Not using hjkl doesn’t hinder your usage of Vim, but I do think it’s beneficial over using the arrow keys. After it’s in my muscle memory (which didn’t take long), whenever I found myself in insert mode and just needing to do a quick edit on the line below, for example — let’s say I spot a small typo while working on the line above — I found I was getting irritated at the delay I was feeling from having to navigate my hands to the arrow keys corner. I’m on a laptop keyboard, and I can only imagine how much worse it would’ve been on a larger desktop keyboard.

                              2. 1

                                There’s no reason to use it this nowadays except maybe for people that use minimalistic keyboards. But no reason to remove it.

                                1. 1

                                  HJKL drives me up the wall. In FPSes, I use IJKL instead of WASD (I’m left-handed), so I’ve mentally hardwire “middle finger = forward/up”.

                                  I can swap J and K so that K is down, but getting used to that means getting tripped up every single time I use anything on defaults - and half the benefit of Vim is its ubiquity.

                                  It’s a minor problem (and not relevant to most people), but a frustrating one.

                                  1. 2

                                    Yeah, I had the same idea about the reasons. I do use wasd for games (longer than I use vim) and even though it’s my left hand I think the middle-finger = forward/up is so hardwired that hjkl never made any sense or I could get it to work.