Hacker News new | past | comments | ask | show | jobs | submit login
Vim Adventures (vim-adventures.com)
140 points by DanielRibeiro on May 11, 2013 | hide | past | favorite | 54 comments



Hahaha… Vim adventures again.

People, if you are curious about Vim, just run the command below if you are on any UNIX-y machine:

    $ vimtutor
That's really all you need. If you don't have Vim installed, just install it and run vimtutor anyway.

Once you have got the basics right, no bullshit payware game or online drillings or online interactive tutorials will help you improve your skills. Only your accumulated experience, curiosity and willingness to learn will.


As a long time Vim user, I also found the book Practical Vim very instructive. Not really suitable for beginners though.


I'd like to second this. There is a lot to Vim and Practical Vim is an excellent read. This book covers a lot of ground and the way it internally references itself is excellent (great for jumping around).

Links for the lazy (non-affiliate)

http://pragprog.com/book/dnvim/practical-vim

http://www.amazon.com/Practical-Vim-Thought-Pragmatic-Progra...

The better you get at Vim the easier it is to learn more Vim.


For those outside the US who would like the paper version, use your local Amazon if possible. Postage is as much as the book from Pragmatic Programmer's site.


Whatever you say, I actually learned vim with this game and also had moderate fun for only 10$ or so. It's clearly a win for me.

The big payoff with this game is that it forced me to practice. Within two hours of game play I had the 'hjkl' fixed for good.

I'll take a look at vimtutor to see if it can complement what I already learned.


hjkl are almost worthless compared to other means of navigation and you wasted 2 hours and 10$ to fix them for good.

Vimtutor teaches you most of what you learned but for free, within Vim itself and in the context of actual text editing.

If you want to learn Vim, use it.


Whoever downvoted this guy was wrong. hjkl are useless. I gained vim proficiency through a few years of using it. Funny thing is that I never, ever used these keys for navigation: at the beginning I mapped arrows to them and later I just stopped using them altogether, outside of a few rare cases like block selection.

Commands for moving around are listed here: http://vim.wikia.com/wiki/Moving_around. Note the profound lack of any of h, j, k, l :)


Wait. You don't use hjkl and you also don't use the arrow keys anymore. So how would you, say, move left one character?

Most experienced vim users consider movement using the hjkl keys to be essential to the efficient use of vim. Some even go so far as to recommend unmapping the arrow keys altogether.

As someone who's used vim for about 20 years, I have to agree with them. If you don't use the hjkl keys for movement, you're almost certainly making your editing experience less efficient and more painful than it would be if you just buckled down and learned them.

There's a very good reason for keeping the most-used movement keys on the home row: you don't have to move your fingers off the home row to use them. Arrow keys and virtually all other motion keys are less efficient for this reason.

The more you have to move your hands and fingers, the less efficient your movement will be. Moving your hand back and forth to the arrow keys might not seem so much, but over time it adds up.

The truth is that becoming comfortable with the hjkl keys is no more difficult or unpleasant than playing nethack for a little while. You'll find yourself becoming an hjkl master in no time.


It sounds like you completely missed the parent's and my point.

hjkl are only marginally better than the arrows: kkkk is just as silly as <up><up><up><up> and their only benefit is in not moving the right hand to the arrow keys at the beginning and end of the sequence. Other than that hitting k 4 times to move the cursor 4 lines above doesn't offer much that the arrows don't.

4k is obviously better but yeah, it also works with the arrows so even there, the benefit is not that great.

what is better than both the arrows and hjkl, though, is all the other motions provided by Vim: wWbBeE/?{}fFtT and so on.

hjkl are really the tree that hides the forest and focusing one's effort on learning them is almost pointless.


The other movement commands you mention aren't "better" than the hjkl keys. They are very useful, but accomplish different things.

For example, the h key moves one character left. Those other movement keys aren't going to do that for you except in special circumstances.

That said, no one is suggesting that in vim the only movement keys one should use are hjkl. Those other movement keys you mention are also very important, and you definitely should learn them after mastering hjkl.

As for the arrow keys, the sooner you break free of that crutch, the better. You will find your editing efficiency improves immensely when you are able to keep your fingers mostly on the home row.

It's like the difference between touch typing vs hunt and peck typing. Some people are actually quite fast hunt and peck typers. But a touch typist will feel nothing but pity for all the energy they waste hunting and pecking when they could be comfortably and leisurely typing by touch.

There are some limited uses cases for the arrow keys in vim, however; such as occasional one-handed browsing with the arrow keys and page-up/page-down keys, which are conveniently close together on many US keyboards. (Don't mistake this use case for movement while editing, which is very different from simply browsing through a document.)

I've also known of people who use their arrow keys for accomplishing tasks such as resizing windows, which is a reasonable use case because it's generally done infrequently enough for the extra hand motion not to matter.


Fuck, I just lost 20 fucking minutes of typing. What's with that stupid "link expired" bullshit?

Whatever, I had a nice demonstration where the same simple task used 39 keypresses with only k + h, 9 keypresses with k + b and only 5-6 keypresses with a backward search. After that, the last paragraph went something like this:

"hjkl have their place in our arsenal, obviously, but focusing on them like if they were the apex of productivity and the single key to mastering Vim is both misleading and absurd."

---

Also, the only reason why Vim uses hjkl for movement is because the terminal on which Bill Joy created Vi didn't have physical arrows. The whole homerow/efficiency business is just post facto rationalizing.


Next time, at least in Chrome, you can hit the back button to return to the page you were at with your text in tact.

But, you probably wasted your time anyway because no one is disputing with you that you that there are quicker ways to navigate in Vim than exclusive use of hjkl. The argument is that there is a place for them in navigation, and that using them over the arrow keys keeps your hands on the home row allowing a smoother transition between navigation and input.

Now, you may disagree that there's any loss by using the arrow keys in your workflow. And you may be right. But that certainly does not make the claim "hjkl are useless" universally accurate--which is what started this thread down this argument.


I said "useless", but only because johncoltrane said "worthless" earlier :) But I understand it as "learn to be effective with other movement commands, don't concentrate on hjkl" - and that was my message too.

Anyway, I don't know whether arrows are faster or not. For me they most probably wouldn't, for some people they could be. However, for me right now, when I know and use other commands much more than arrows/hjkl, learning the former would be simply a case of diminishing returns.

I think that proficient use of vi-style keybinding means that movements by one letter are the rarest ones. I don't know, but I feel that I don't use them more that a few times per hour at most. I have macros, scripts and !programs to use, not to mention other movements. And besides, look - Emacs doesn't have hjkl, has wWetc. and is not slower than VIM! (except with startup).

Also I think that insisting on hjkl efficiency even without any proof is not the best thing to do to attract more users to VIM ;)


That's certainly fair. I wasn't trying to come off as a hjkl evangelist, I just thought that the terms 'worthless' and 'useless' were way too strong to support.

I guess I misunderstood the point you guys were making, because I certainly agree that someone learning Vim should learn to be effective with other movement commands, and not concentrate on hjkl. The value of Vim is not just being able to move around text with a standard one character up/down/left/right movement, hands on home row or not.


The back button didn't keep my text.

My original comment was only about hjkl vs motions: I didn't bring arrows in the discussion, the parent did. Also my claim was:

> hjkl are almost worthless compared to other means of navigation

and I stand by it. I didn't write "hjkl are useless" or advocate the use of arrows vs hjkl, IIRC.

hjkl are better than the arrows for short range movements but those short range movements (1-3 cols, 1-3 lines) make up such a small part of the movements we actually do all day long that focusing on hjkl is just absurd.

All the hjkl advocacy can be reduced to "Do whatever you'd do with arrows but with hjkl because it helps you save all those right hand movements… and home row." But char-by-car and line-by-line movement is just as slow and bad with hjkl as it is with arrows.

Saving a few slight translations of the right hand is so worthless compared to the thousands of hjkl or arrows you save with bBwWeEfFtT/?{}() and friends… unless we try to save our wrists but why make productivity claims, then?


I apologize, I did confuse you with the other commentator.

Everyone agrees that using w to move a word at a time is better than llllllll. No one is arguing with you about that. So in that sense, we all agree that for certain movements, hjkl really is worthless compared to alternatives.

But if you want to move a few characters, there's no better option than hljk. Second best are the arrow keys. But there's really no reason to move your hand out of position just to move one character when your finger is already on the key which will do it.

So, I don't think it's at all accurate to say in general that hjkl is worthless compared to other means of navigation. They have their place, and they're quite valuable there since all other means of navigation are almost worthless compared to hjkl when moving a few characters.


Yes, moving by a few characters is indeed best done with hjkl if you touch type.

But the vast majority of movements we do doesn't belong to that category. In a day, I'll do a hundred or a thousand more long range movements and I argue that these long range movements are those that deserve optimization the most. Going back a few words is better done with bbb and (probably) a couple of l than 20 or so h and IMO insisting on new users to disable the arrow keys to learn hjkl is way beside the mark and horribly myopic.

Using hjkl instead of the arrows is better but the gain is ridiculous compared to what you get with motions: if you replace a thousand of arrows with a thousand of hjkl you get a small benefit; if you replace a thousand of hjkl or arrows with a hundred of bw and co. you get a huge benefit. Learning hjkl gets so much emphasis for so little usefulness…

So yeah, hjkl are almost worthless compared to other means of navigation. For a huge percentage of the actual movements we do all day long.


"It's like the difference between touch typing vs hunt and peck typing. Some people are actually quite fast hunt and peck typers. But a touch typist will feel nothing but pity for all the energy they waste hunting and pecking when they could be comfortably and leisurely typing by touch."

You realize that you just offended me? I "hunt and peck" 80 wpm and am quite comfortable with it, thank you. It's enough for me.

Also I'd like to see some proof for oh that faster hjkl versus arrows, especially on non-standard keyboard where the distance is much closer.


I don't think that they are just marginally better.

You are taking for granted that most people are coming from a mouse-oriented workflow.

Switching to a keyboard oriented workflow is a very big step.

hjkl accomplishes the task of training you to keep your hands on the keyboard. Once you've learned that, you can move to more advanced motions.


"Wait. You don't use hjkl and you also don't use the arrow keys anymore. So how would you, say, move left one character?"

Easy:

    :call cursor('.', col('.')+1)
"There's a very good reason for keeping the most-used movement keys on the home row"

I can't touch type, I'm sorry, I know little kittens will die because of me.

"You'll find yourself becoming an hjkl master in no time."

I don't want to.

It's that simple - one has to decide when he should stop searching for efficiency and should start focusing on other thing. For me this moment came when I saw how efficient and pleasant I can be with 4w or 2(ciw. Also, for me - without touch typing - hjkl is meaningless. I'm that much slower than you that moving my hand to arrows doesn't slow me down at all.

Even if I could touch type, I still wouldn't be convinced. I think that M,L,H together with word, sentence and paragraph movements is much more of a gain than hjkl anyway. And I just DON'T move my cursor by one character, because I find ciw, ca" and friends much more convenient.


If you want to beat yourself out of using them (or /gasp/, arrow keys) instead of more appropriate commands, (and can afford the productivity hit and fits of rage when starting off), try using medium-mode[1] (or, if you're really silly, hard-mode[2])

[1] https://github.com/kbarrette/mediummode

[2] https://github.com/wikitopian/hardmode


You're most definitely my favorite VIM curmudgeon.


Thanks.


Is there anything similar for Emacs?

Disclaimer: Now, stop, please. I know of Emacs manual, tutorial and all the other built-in docs. Stop telling me to use them, because I won't, thank you.

I'm recently learning Emacs - I reached high proficiency in Vim and I thought about learning it's competitor, just to feel comfortable with them both. I like Lisps, so that's another motivation.

I had a hard time in the beginning. I was missing tabs (elscreen) and many other features and familiar keybindings, so I installed Evil and made my own mappings. Now I can live with Emacs, but I realized that while I learned a bit about how Emacs works and how to script it, I completely neglected the idea of feeling comfortable in raw Emacs! I probably could M-x and M-: my way on Emacsen other than mine, but that's hardly the point :)

So, is there something interactive one could use to learn Emacs editing basics?


> Now, stop, please. I know of Emacs manual, tutorial and all the other built-in docs. Stop telling me to use them, because I won't, thank you.

Why not? If there are problems like they're hard to read, understand, you've tried them and they don't match your learning style, etc., then it would be better to say that instead. As written, this isn't very constructive since you don't explain why you find fault with the documentation.

I would not know how to fix the problem in that documentation, if I wanted to, or point you to documentation that doesn't have the problem, since I don't know what the problem is.

(Note: I'm not an Emacs expert and have no knowledge of the documentation you're referring to, or any other documentation. I'm responding primarily to your rhetoric.)


"In the next few days detailed Terms and Conditions will be added to the site. Anyone using this site will be bound by these terms and conditions."

This makes your terms and conditions (almost certainly) irrelevant. Judges don't look favorably on asking people to sign a contract that they can't read.


Slightly ironic: doesn't work well with the Vimperator add-on + Firefox, as Vimperator is going to consume the keystrokes (especially the most used ones such as hjkl).

Great idea though (once you turn off Vimperator) :) !


Same with pentadactyl. However with CTRL+z you can temporarily disable pentadactyl (I think it's the same shortcut in vimperator) until you press ESC.

If the developer is here and wants a workaround there is a way to make the game work with pentadactyl/vimperator without disabling them. The h/j/k/l keys do not work in insert mode, so on page load focus in a hidden textbox and capture keys pressed in the textbox.


Same here with Chrome's Vimium. Once the URL is excluded, it works fine.


Doh, I was wondering why I could only move in 'insert' mode. Guess I was entering Vimiums insert mode rather than the game.


Previously on hn, with some good discussion: http://news.ycombinator.com/item?id=3877880


The level of creativity here is mind-blowing.


Really impressive. Very creative and quite polished.


You're kidding, right?

I want to like this game; I love vim, and I agree that the premise of the game is very creative. But the execution is vastly below average. They are using free graphics [1], annoying sounds, and they force the user through a strict tutorial instead of encouraging them to explore [2]. They ask for more (25$) than the vast majority of indie games on Steam [3], all of which are a lot more polished than this. And even then your license is only valid for six months, something I thought was only done by MMORPGs!

[1] http://www.lostgarden.com/2007/05/dancs-miraculously-flexibl...

[2] http://www.lostgarden.com/2010/01/ribbon-hero-turns-learning...

[3] http://store.steampowered.com/genre/Indie/


Yeah, I would gladly pay $10, not $25


I remember giving my e-mail to this, the last time it came around. Didn't get anything though.

A part from that, it's a great way to learn VIM.


First of all, awesome concept. This might just force me to stop using nano all the time.

I'm curious though as to why the developer chose to limit the license to 6 months when charging a flat ~$5 per month might be easier to sell?


Yeh, subscription seems silly. Might be an attempt for corporate users training staff regularly.


As an avid Vim user, I must say this is really great! I'll show this to some friends of mine I'm trying to get them to start using Vim...


i tried to go back a word with control-w and it killed the tab :(


Isn't this website there long time ago? I had given up trying it as Vimium came in the middle but reading from other comments, I could now play in the site going to the insert mode in Vimium.

Might be a good practice for beginners who need to make their fingers type the Vim way.


Amazing !! Wonderful way to practice VIM.


I really want to play! 25 bucks is too much. Can't it be 5 dollars instead?


What do you mean, I "don't have the x key"?!


What about the folks using Dvorak keyboard??


Read here: http://vim.wikia.com/wiki/Using_Vim_with_the_Dvorak_keyboard...

Are there many guys using Dvorak? I only met one in my whole life.


One of the top Ruby User Groups in the world has a large number of Dvorak users. I mimicked them and posted about it on Slashdot years ago: http://ask.slashdot.org/story/07/04/15/0043237/is-dvorak-gai...


I use Dvorak. I never bothered to maintain the QWERTY keyboard for vim movement. Now, it seems completely natural to navigate with the Dvorak mappings for h,j,k,l, etc. I can't easily navigate one-handed, I guess, but that is never really a problem.


Switched to vim and dvorak same day five years ago. Default mapping is very natural - left hand (qwerty "c" and "v") used for vertical movement, right hand (qwerty "j" and "p") for horizontal movement.


That article is probably doing more harm than good. Using Vim with Dvorak came as naturally as switching to Dvorak from QWERTY (that is, it took some work, but now I wouldn't use anything else).


The best hacker I ever knew used dvorak. He went off the grid to become a welder or something, but he was _fast_.


Now you meet two.


Is there any way for a Vim session to span multiple monitors? Multiple terminals? That is what I would like more than anything.


just stretch the window and create windows in vim.

but i bet what you want is to use the system clipboard, so that you can copy from one buffer in one window to another.

http://vim.wikia.com/wiki/VimTip21




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: