The Register Home Page

back to article Vim text editor game teaches you keyboard shortcuts with ice cream delivery

If you find yourself editing text at the Linux command prompt, you've probably either used nano, which is simplest, or the more powerful but difficult-to-master Vim. In Vim, for example, even moving the cursor up, down, left, and right is less than straightforward. How about an ice cream-themed game to teach you all the "Vim …

  1. Michael Hoffmann Silver badge
    Trollface

    Yes, I've used nano. Generally for 5 seconds followed by the exclamation "dammit my shell didn't set EDITOR/VISUAL right!"

    1. ChoHag Silver badge
      Angel

      "Eugh. Did I forget to uninstall that again? How do I quit without accidentally saving?"

      On the other hand I've never had trouble leaving vi (or vim). Because a friend at school showing off didn't realise that when you try and shove your body in the way of the keyboard to hide what you're doing, some of us can tell that maybe there's a juicy secret to learn here if we know how to be less obvious.

  2. takno

    “I’ve been programming since long before modern AI tools existed, but I find they can type faster than I can." says the guy writing the glorified typing tutor.

    Next up: Mavis Beacon on why she just knocks up a couple of bullet points and lets an LLM do all the difficult stuff with sentences and paragraphs

  3. Authentic Name

    NetHack

    Isn't that what Rogue and NetHack are for?

    BOFH PFY moment: many years ago, the boss breezes in one afternoon showing things off to guests. I'm at a console with a game of NetHack underway. PHB glazes over the ASCII dungeon map and enthuses to the guests, "These guys are always such complicated techie stuff, I don't get any of it!"

  4. the spectacularly refined chap Silver badge

    hjkl

    h and l are on the left and right of the quad so hopefully easily to remember.

    j extends down below the baseline and k extends up above the median.

    1. Dave559

      Re: hjkl

      That's good - I had never noticed the "clues" in j and k before, I'd just mentally absorbed them through practice…

      (And previous game-playing experience on our ZX Spectrum with the 5/6/7/8 keys probably also subconsciously helped! Another system with its own complicated multi-key commands…)

  5. RockBurner Silver badge

    (h for left, j for down, k for up, and l for right)

    Wasn't that the keys for some early BBC or DOS games??

    I seem to remember playing something using those keys.... Checkee Egg or Doom? (those are the 2 games I remember playing a lot)

    1. Alan Bourke

      Re: (h for left, j for down, k for up, and l for right)

      Many 8-bit games would have used those in the absence of separate cursor keys or a joystick. Doom and the like tend to be WASD and mouse but maybe southpaws use IJKL and mouse.

    2. William Towle
      Boffin

      Re: (h for left, j for down, k for up, and l for right)

      > I seem to remember playing something using those keys.... Checkee Egg or Doom? (those are the 2 games I remember playing a lot)

      Depending on the game you tended to get two adjacent keys for left and right and two other keys above each other for up and down - eg. q, a, o, p (or similar if p had been reserved for pause and/or q for quit).

      I don't remember h/j/k/l used for anything but on the Spectrum they're in the same block of the keyboard matrix and could have been read together in the same way the "Sinclair Joystick" key combinations were.

      I do remember some Spectrum games having alternative unadvertised keys - the arrow keys worked on Manic Miner*, and various adjacent pairs worked as left/right (...possibly also MM?).

      (* "why not use the arrow keys, arrow keys, arrow keys...?" :grin:)

      1. Dan 55 Silver badge
        Boffin

        Re: (h for left, j for down, k for up, and l for right)

        Also the Sinclair Interface 2/Amstrad Spectrum joystick ports were incompatible with Sinclair's own cursor keys, so the left joystick could be fitted into the 12345 block and the right joystick into the 67890 block.

        The cursor keys were in two blocks, 5 was on its own in the 12345 block.

        1. William Towle
          Linux

          Re: (h for left, j for down, k for up, and l for right)

          > The cursor keys were in two blocks, 5 was on its own in the 12345 block.

          The cursor keys being 5 to 8 seem to be a consequence of the decision to place RUBOUT and HOME in the top right of the ZX80 keyboard, with later models following suit. It follows that in order to not conflict with other pre-existing game controls, the two Interface 2 joysticks had to break with the convention of using the keys with the arrow labels.

          I've not seen anything that says the order matches Lear Siegler Inc's choice of H/J/K/L intentionally, however the code points in the ZX80 character set suggest to me that we could have had up/down/left/right and it's clear some other decision was made.

    3. cleminan

      Re: (h for left, j for down, k for up, and l for right)

      Acorn Electron/Archie standard keys were z (left), x (right), ' (up), / (down) and space to fire/jump/splat the cute furry thing with a hammer (though that game just had left/right directional controls).

      Sensible spread across the keyboard for a single player, at least one game compacted them down to z, x, c, f, left ctrl and ,, ., /, ', right ctrl for a cramped two player experience.

      1. The Indomitable Gall

        Re: (h for left, j for down, k for up, and l for right)

        In my house they were known as "z, x, star, question mark". But then half of the games used the space bar and half used the enter key, so that was confusing....

  6. This post has been deleted by its author

  7. RockBurner Silver badge

    (h for left, j for down, k for up, and l for right)

    Weren't those the keys for some early DOS or BBC games?

    I seem to remember using them for something... ChuckieEgg or Doom? (not sure, but I do remember playing a lot of ChuckieEgg at school....)

  8. Jamie Jones Silver badge

    Whenever anyone uses AI for code...

    ... I ask them who wrote the original that the AI copied, and do they have permission to use it?

    1. stiine Silver badge

      Re: Whenever anyone uses AI for code...

      Care to share sum unanonymised results?

    2. frankyunderwood123 Silver badge

      Re: Whenever anyone uses AI for code...

      I bet that puts the fear of god into them

  9. RockBurner Silver badge

    (h for left, j for down, k for up, and l for right)

    Wasn't that the keys for some early BBC or DOS games??

    I seem to remember playing something using those keys.... Checkee Egg or Doom? (those are the 2 games I remember playing a lot)

    1. xyz123 Silver badge

      Re: (h for left, j for down, k for up, and l for right)

      Spectrum BBC and commodore 64.

      The two most common layouts were Q for up, A for down, O for left, P for right and SPACE for fire.

      Or Z for left, X for right, P for up and L for down with either enter or space or shift as fire.

  10. Ian Bush
    Trollface

    VIM SUX! EMACS ROOLZ

    1. Doctor Syntax Silver badge

      Vim is an abrasive cleaner.

      Is it true that as a complete OS, EMACS includes a copy of vi?

      1. Anonymous Coward
        Anonymous Coward

        Emacs isn't really a complete OS. It doesn't run systemd. Or any of the other Windows/BSD/Linux embuggerances, It does however include a vi emulation mode that works remarkably well. Though why anyone would choose to use that instead of running the far less resource hungry "native" vi is a mystery. "Because I can" could be a reasonable enough excuse.

        IIUC vi macros are Turing-complete. [I remember there used to be a chunky set of vi macros - vimaze? - which solved ASCII-art mazes.] If they are Turing-complete, I suppose someone could run a real OS on top of vi's macros and have that (virtualised?) OS run emacs in vi emulation mode. For all I know someone with too much time on their hands might well have already done this.

        1. The Indomitable Gall

          Your logic suggests CP/M isn't an OS. Or even IBM OS/360, for that matter.....

      2. Anonymous Coward
        Anonymous Coward

        Clearly not - as the old joke has it, Emacs would be a great OS if only it had a decent text editor.

      3. ChoHag Silver badge

        > Is it true that as a complete OS, EMACS includes a copy of vi?

        That's my preferred editor (there are some emacs features that are slightly handy in long-running sessions where plain vi would become a bit of a drag, and I like vim's macros), but you have to install vi yourself afterwards lest any GNU developers face the mortal peril of having to consider that they might not be entirely in the right about absolutely everything 100% of the time.

    2. kamen_n

      Yeah, with Emacs, you don't need a vibe-coded "game" to teach you how to use it - Emacs itself is the game.

      1. CrazyOldCatMan Silver badge

        Emacs itself is the game punishment

        :-)

        (For someone that grew up using a 3270 terminal (xedit), vi is far more intuitive.. Emacs is too similar to Wordstar - which we didn't have. No, we got Deathwish DisplayWriter 4 foisted on us,

  11. xyz123 Silver badge

    Shitty diffcult-by-design software built by someone with a broken keyboard and some sort of head injury, where the cursors don't work and it randomly crashes.

    Why do we keep using such pathetic annoying programs?

    Anyway enough about windows 11....was someone talking about VIM?

    1. theOtherJT Silver badge

      To be fair to vi, once you see the keyboard they were using when they developed it, some of the more... unique... keybindings start to make a bit more sense.

      1. retiredFool Silver badge

        Yep, vi is old, like really old. I used it in school in the 70's. My EE dept had a pdp 11/70 and initially had I think it was called ed. A line based editor. The EE dept picked up something from Rand corp called Ned. It was a full screen editor. It was lovely. It also could consume the resources of the pdp with just 3 users using it. That was a problem. It got replaced by vi, but I would use ned when no one was looking and so did others. I got very proficient with it. I still use my home brew version of it today. It too used hotkeys for actions, except they were all control keys. So ^H was move back, not h. h got you an h. And depending on the mode, toggled with ^o, it is either overstrike or insert mode. So basically you just typed with instant white out. It also did one other fantastic thing for makefiles. It would automatically

        replace leading chars with a tab if it could.

        Just one feature which remember this was the 70's was it could cut and paste rectangular areas. It could also pipe cut buffers to thru a external program. So I recall doing stuff like exec an ls and put the result in the file, or calling sed to modify an area all while in the editor. It also was multi-window, horizontal or vertical ones. So you could see up to I think 5 files on screen and copy/paste between. Excellent if you were looking to chop up a large program into smaller files. Another way I'd use it is if I needed a diff. So diff the 2 files into another file, and then open all 3 into 3 windows to see the diff and easily jump to the diff places between the files. Again this was like 78.

        Loved it, but like vi it has a steep learning curve of rote memorizing what key does what. I don't even think about it anymore. Although I did make my version have assignable keys so I could map a few onto the extra keys now on most keyboards. I still use mostly the key assignments in that version in the 70's. And of course, now it is "light as a feather" compared to typical modern editors. Mine has a text size of 87K vs say nano at 237K.

        1. druck Silver badge

          But once learned, never forgotten.

          If been out of uni and bereft of UNIX systems for about 10 years when the boss shouted "how do you delete a line in vi?" I instantly answered "dd", then went to see what he was using, unfortunately it was just a copy of vi on an NT box.

  12. LionelB Silver badge

    It's not like riding a bicycle

    I could do Vi in the 80s. I can't any more.

    (I've also learned, and forgotten, how to read music – twice.)

    1. Doctor Syntax Silver badge

      Re: It's not like riding a bicycle

      I still use vi a bit. The trouble with using more editing scheme is that you forget which command set to be using at any one time. I've found myself using u to undo something on kwrite or LO and ^Z on vi.

      Reading music isn't a problem - it's transferring it to the keyboard at anything faster than 2 seconds per note that's the problem.

      1. LionelB Silver badge

        Re: It's not like riding a bicycle

        I'm pretty much limited to ESC and 'i' these days (usually followed by … how the hell do I get out of here without losing my edit, and what in the name of jebus does that '!' do?)

        As for the music, I play (various) African guitar styles, so not much call for reading. Western music notation doesn't really work for most African music – the arcane rhythms, phrasing and syncopation turns it into an unreadable mess, so no-one bothers, you just learn it by ear off by heart (which is better for live performance anyway). The last time I (re)learned to read music was because I'd decided to try to learn some jazz standards. Which kind of worked, but I didn't keep it up.

        1. CrazyOldCatMan Silver badge

          Re: It's not like riding a bicycle

          Western music notation doesn't really work for most African music – the arcane rhythms, phrasing and syncopation turns it into an unreadable mess

          Doesn't really work for prog music either (except, maybe, the chord structure). You spend so long trying to puzzle out the phrasing that your music ends up like the musical equivalent of painting by numbers.

          Easier [1] to just play it how *you* want to.

          [1] Ha! I wish I had the talent to do it properly. Can do quite a few of the Genesis bass lines [2] and some of various other prog/neo-prog guitar lines.

          [2] Probably because I've heard them so many times. Sadly, nowadays, the mind is willing but the hands/wrists are very definitely not.

          1. LionelB Silver badge

            Re: It's not like riding a bicycle

            Upvoted, but to be honest never really got off on prog. With some honourable exceptions, the arcane phrasings, unconventional time signatures and all those pointless twiddly bits just feel too arbitrary and clever-clever, technical grandstanding rather than actually trying to sound good ("Look! We can do this!" me: "Why would you want to do that?") Not even to mention the risibly pompous lyrics. I did quite like Eels, though, if that counts.

            In African musics (plural, because that covers a huge diversity) the rhythm and phrasing is the entire point, but it is uncontrived, natural and organic. Some West African musics have insane rhythmic complexity, but are based on musical legacy and familial dynasties going back centuries – time enough to get it right :-)

  13. mhoulden

    Does it have one mode that beeps and another that corrupts files?

    Actually, I found it's easier to learn the essential commands in vi than to try to work out what other text editor is installed. I only use it for editing config files so I don't need that many. Even on Windows 11, it was easier to use the WSL version until MS reintroduced a text-mode editor.

  14. Dan 55 Silver badge
    Facepalm

    How embarassing (level 2-2)

    I still haven't worked out how to paste into the last line in vi(m) even after all these years, I always end up pasting text into the last-but-one line then deleting the last line and pasting that into the last-but-one line so the last-but-one line becomes the last line.

    But I have absolutely no idea why some people don't like vi-based editors.

    1. stiine Silver badge

      Re: How embarassing (level 2-2)

      Gp will do it. Is there a single keystroke command that will do the same? I don't know, and I'm still use vim (in compatible mode in black-and-white) on a daily basis, and I don't care.

    2. ChoHag Silver badge

      Re: How embarassing (level 2-2)

      Small p is paste below, big P is paste above.

      Most vi commands that share a letter have a similar small vs. big mnemonic for going before/after or doing a small/big movement or similar.

      1. Dan 55 Silver badge
        Thumb Up

        Re: How embarassing (level 2-2)

        Thinks both of you. I never caught that after all this time, I always used P and Ihought I was doing something wrong with g/G.

  15. +++ REDO FROM START +++
    Facepalm

    I know vi just enough to be dangerous...

    I don't know enough to be useful with it, but I've used it enough that I keep finding :wq in text files if I have to use anything else for more than ten minutes.

  16. kamen_n

    Forget about navigation keys...

    ...let's get to the important stuff. Does this game teach you how to exit vim?

    1. stiine Silver badge

      Re: Forget about navigation keys...

      More importantly, to exit without saving because all of those random 'get me the fuck out of here' keystrokes?

  17. Rich 2 Silver badge

    Vim really isn’t that difficult

    Vim gets a lot of stick but it’s really not that difficult. You can learn how to do basic editing, loading, saving, and exiting (!) in 5 minutes

    Everything else is just sugar in the top (supercharged extra powerful sugar but nonetheless) and the thing is, you do not need to learn it all at once. Use the basic stuff and when you come across a “there’s got to be a better way to do this” situation then check out the docs or Google and add the new technique to your brain. This way, you learn Vim in an organic way as and when you need it

    1. stiine Silver badge

      Re: Vim really isn’t that difficult

      Nope. Once you figure out top/bottom/beginning/end/copy/paste/delete/undelete/quit without saving/exit and save, you never learn anything else...

      1. ChoHag Silver badge

        Re: Vim really isn’t that difficult

        Nope your nope.

        After having used vi for nearly 20 years at the time, a fellow $orker was astounded that he was able to teach me what the z command does.

        Old dogs can be taught new tricks (and about 10 years later I learned that the vim implementation I'd got to know is different from vi's for whatever reason, so sometimes we can even learn them twice).

  18. tl3

    All anyone needs is a Vi mug.

    https://www.zazzle.com/vi_quick_reference_two_tone_coffee_mug-168770754576713946 for example.

    How I learned the basics twenty years ago.

  19. Bloognoo

    Vim Adventures is still there, no AI, and far more fun.

    Which is more than I can say about Vim. I've moved to Evi.

    Also

    Disable your vim keys plugin for your browser!

    Took a couple of seconds to realise that's why nothing was responding

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon