Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

My pet peeve is Vim tutorials that start with "use hjkl to move around" instead of "use `set mouse=a` to turn on the mouse." In my opinion you need to make sure that you are very clearly disclaiming that you are teaching a harder way of doing things in exchange for incredibly small productivity gains that will be realized years in the future, if ever.

(This is basically a copy-paste of previous comments I’ve made, I haven’t tried your tutorial beyond the first lesson.)



This may be a little elitist, but if you're not going to use vim the way it's really made to be used, why even bother? I get that `mouse=a` makes it more familiar, but if you're always going to reach for your mouse, you're never going to really get used to the motions.


I use Vim as a secondary editor, when I need to quickly edit a file in my terminal or over an SSH session. I'm not interested in it replacing my primary IDE.

If you're going to disable the mouse and the arrow keys and really commit to the home row, more power to you. That is probably the best way to master Vim. But I think a significant number of people looking at Vim tutorials have never used the editor, and I think they deserve to know that there is an easy way to make the editor more comfortable and more familiar.

Someone down-thread used a metaphor to say 'the best way to learn a new language is by immersion' which is something I would agree with. But opening Vim for the first time feels like being dropped into a foreign country where no one speaks your language. Imagine how frustrated you would be to find that the people there actually do speak a language that you know, they're just refusing to understand you because you haven't issued the magic words, "set mouse=a"


That's certainly valid. I've had friends throughout the years that used vim as you would nano. I don't think vim is any good when you use it like that since the more advanced features just get in your way, but if it works for you then that's cool.

The people who seek out a "learn vim" course are just not that kind of people. In this case you've signed up for a course on how to speak Spanish only to ask the teacher to not speak Spanish.


You're conflating learning aids with actual usage.

Having mouse support gives you a superset of functionality. Often this can be useful, like if you have on your hand on the mouse using another application.

Saying "why even bother" using vim if you add features just makes no sense.


I think they were speaking from a total beginner's perspective, and how to get them up to speed as fast as possible.

I felt the same way when first learning vim, since it was completely different from the code editors I'd used in the past, it was strange not being able to use the mouse in the way I was used to.


I get that, but that strangeness is what pushes you to learn. I find that if I can do something suboptimal, but familiar, it takes way longer for me to change my habits because my subconscious keeps thinking in terms of the familiar.

I find it much more useful to remove the ability to even do the wrong thing, than to simply try and will myself to do the right one.


I get that, but that strangeness is what pushes you to learn.

Yes, exactly. This is analogous to travelling to another country and hoping to learn the local language by immersion. If you then meet people that speak your language you run the risk of only hanging out with your little expat group and never immersing yourself in the local culture. You can end up spending years there and never learning the language.


Oh yes, when I was trying to fully learn vim, I had the mentality that I could just practice it for 10 minutes a day and be able to use it while editing code.

The remaining time I would edit code like normal with vscode, so it turned out that I wasn't really able to pick up vim and use it well.

It wasn't until I switched to a different keyboard layout that I decided to move over to vim cold turkey, and was actually able to learn vim and retain it.


I agree. When I started at my first internship, one of the developers (and now a close friend) put layers of tape over the arrow keys so I couldn't use them. Took a week of pain and then I never went back.


Tbh, one of the biggest issues with vim for me is, that all my coworkers do not use it. When I have to explain something to them, they are completely oblivious as to how they navigate vim without the mouse. So enabling mouse is one of the most important things for me


Vim was designed on qwerty keyboards. On other layouts (e.g. neo2) hjkl are not in a row.


That's somewhat comforting to know. I'm in the beginning stages of building out a keyboard-heavy application, and I keep wondering about how to support different keyboard types. I suppose it's not possible to satisfy all customers if even Vim can't do it.


Just support QWERTY but allow the user to remap everything. Even among programmers, the share of people that use alt layouts is so small that is not worth your time.


I’m a Colemak layout user. I don’t bother remapping anything for Vim because I want it to be consistent with other apps with vi keys.

I have done that briefly years ago but I find it a dead end.

After a while you just get used to the cursor keys being in a different place and if you’re touch typing it doesn’t mater much.

Also what you loose to cursor key placement you gain back on other navigation.

So in short just support qwerty and it’ll be fine.


Very minor issue, speaking as someone who switched to dvorak and then workman while continuing to use vim daily. No keys remapped. It's just not even an issue. Those letters still make those movements. They're in different spots, but I already had to get used to the new spots for writing words in the first place. Doesn't even feel slower.

IIRC dvorak even happens to split the vertical and horizontal movements between hands but while keeping them near each other, almost like RC car controls. Workman is comparatively a bit crazier with its placement, but it still doesn't bother me.


Specifically, it was designed on the ADM3A keyboard, which had the arrows printed on the H, J, K and L keys. Also of note is the key in the upper right, which is labeled with "HOME", ~ and ^ (which explains why shells use "~/" to represent the users home directory).

And while I'm diving into history here, vi (which stands for "visual") was a modification of "ex" to use the newfangled "video terminal" instead of the battle tested teletype machine.


I very whole heartedly disagree. I find vim to be an unusable vi implementation until I turn off mouse support completely. For that matter, I also have to turn off any automatic indentation and any other "smart" feature that people try to ram into their distro-default configurations. It's nearly as annoying as autocorrect is on a desktop computer.


I just created this account to say that I agree wholeheartedly 100%. People always ask me, "How do I get better at Vim?" or say "Vim is too hard" etc, and I always say `set mouse=a` isn't just a gimmick, it's a _very_ useful feature...


Definitely a hurdle to overcome for beginners.

Although, it would help to show beginners exactly why abandoning the mouse will be better in the long run. It wouldn't do well for them to always rely on it in place of more efficient commands. Some people might always use the arrow keys instead of hjkl, for example, when hjkl will be better in the long run since they are on the home row.


I buy the idea that the more advanced features of vim are worth it, being able to quickly cut+paste bits of text around, skip to end of line/bracket/etc.

I don't believe I'd write usefully larger amounts of code by using hjkl instead of arrow keys, and personally I am always going to use the mouse when I want to move more than a couple of lines.


Yup. I had tried to use vim and quit because I thought it was needlessly cumbersome.

What changed my opinion was watching videos of people using vim on youtube that made me interested in learning it for real. It made me realize how much more efficient it could be.


The comparison is not between hjkl, arrows and mouse movements. Vim motions are far richer than that.


a harder way of doing things initially in exchange for incredibly small productivity gains that when applied millions of times over the course of a programming career, make a monumental difference

A key ethos of Vim is that once you climb the initial learning curve, you're on a path of increased efficiency for the long haul. Moving the hand to the mouse, dragging the cursor to the spot you want, then moving the hand back to the keyboard, is objectively slower than key-based movement commands for someone who has climbed the learning curve and I'm confident that could be proven empirically though I'm not aware of any such proof. There may be certain exceptional cases where the mouse is faster, but for most editor usage it would not be. I'm not sure if you agree w/ that and are just criticizing how tutorials introduce people to Vim, that they should start w/ the mouse to lower the learning curve, which might be an okay argument.


Counter point; set mouse support and if you want to use it use and if you don’t don’t.

I’ve been using Vim as my primary editor for 25 years and at this point the keyboard nav is burnt into me.

I still use two finger scrolling on my track pad though. If I’ve been in another window I might also start the cursor at a point with trackpad.

It works fine over ssh too.

I think most newbies that care enough to try Vim know there is a Vim Way. They know about Vim Golf.

That get tiring all the time when you’re starting out. Sometimes they just want to get the job done until they learn, I’m ok with that. Just have a go.

It’s absolutely fine to make use of all the features Vim provides and use it any way you want because you’re always going to me slowly learning more.


I use vi(m) more often on remote servers than locally, and in many cases I don't have much control what software is available. Mouse support is a crapshoot, so I never bothered with that.


Ah, I see. I agree, more context would be better for the beginner to understand why the lessons are the way they are.

I tried to explain the benefits of vim in the "Why Vim?" section, but I should really go into why using and learning vim will be slower at first than using the editor you're already comfortable with, and how it might be worth it in the end.

Thanks for the feedback!


IMO, the choice of nix editor is always somewhat contextual depending on how much full stack work is being done. If one is doing a lot of systems work (ie a lot of bash commands), then one inevitably wants to set a default editor on the systems being used. While I choose vi, it really depends on the number and type of systems being regularly accessed, and your personal preferences. For me the use of a terminal editor is just part of the seamless flow of using the command line for everything else. I personally don't think it is especially valuable to consider terminal editors in isolation away from bash, other than to become familiar with key strokes.


Agreed. Hjkl only makes sense when using a keyboard layout where these 4 keys are located in a row. This fact made most vim tutorials useless for me, as I'm using the neo2 keyboard layout, where arrow keys are located in the middle of the keyboard and hjkl are not in a row. Using vim works well for me, and I can use hjkl for other keybindings.


I posted another comment on this, but I never found this to be an issue when using dvorak or workman. Just as I slowly relearned to type the letters at all and improved over time, I kept using vim and got used to hjkl being moved over time. It doesn't bug me at all.


Interesting. I guess the difference here is that I learned vim after neo2 (https://neo-layout.org), not before. That way I already had proper arrow keys in my home row and hjkl felt cumbersome and redundant.


Interesting, I always move down by page. I find the mouse to keyboard switching disorienting. But I know lots of great engineers who use the mouse extensively. I wonder if I just trained myself into this efficiency (and out of that efficiency) when I was young.

I bet I could untrain with sufficient work but it's no longer worth it.


Huh. I mainly find myself disabling mouse=a if it's on by default. But that's mostly because the only time I'm using my mouse is to copy/paste something out of my term and it breaks that.

Also, I think scaring people away from arrow keys is premature. It's not that big a deal.




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

Search: