I've been brainstorming some ideas for a tool or service to help people learn and get faster at Vim, and was curious what HNers have done to learn Vim. Of course there's Vimtutor, and Vimcasts, but I'm especially interested in how people have overcome the "practice hump" where Vim initially slows you down due to a lack of muscle memory.
[+] [-] godshatter|4 years ago|reply
So I would suggest maybe a curated list of problems that need to be solved and their vim solutions, with a method of searching for them when needed and a way of suggesting one of those problems/solutions every so often. Kind of like a daily/weekly helpful tip that gives them out in order of complexity. These would be things like how to swap two lines, keyword search and replace, how to insert something at the start of a set of lines, how to join lines, how to use buffers, etc. Ideally, a vim plugin could watch for the basic ways of doing more complicated things, like someone deleting the same number of characters one at a time on each line, repeatedly, and let them know about repeat counts, or seeing someone deleting characters one at a time stopping at a space and typing new text in multiple times and let them know about "ce".
[+] [-] vgel|4 years ago|reply
Agreed. I think, leaning on my metaphor of natural language, that just like you don't learn how to conjugate every verb form in your first week of Spanish, you don't need to learn every Vim noun or verb right away, but you do want to be learning a system that will make slotting in those new operators natural as you learn them.
> So I would suggest maybe a curated list of problems that need to be solved and their vim solutions, with a method of searching for them when needed and a way of suggesting one of those problems/solutions every so often.
Yep, this is similar to what I was considering. I like your ideas for problems, so definitely will be using some of those :)
> Ideally, a vim plugin could watch for the basic ways of doing more complicated things
I like this a lot. Not sure if it would fit with the model I'm imagining, but I'll have to think about it more, since it seems quite useful.
[+] [-] ttymck|4 years ago|reply
[+] [-] meitham|4 years ago|reply
I started learning Vim 2009 when an older and much more experienced colleague of mine was making funny comments about me using Notepad++. "Get a real text editor" he was saying. At the time, I never really thought about the need of learning a new text editor, specially one as old as Vim. Though to impress this colleague I decided to learn Vim, and demonstrate powerful Vim tricks that my colleague didn't know. This carried on into an obsession with Vim. Drew Neil, the author of Practical Vim book, and the maker of the Vimcasts, used to run a Vim Dojo in London circa 2013, and I found that to be a great source of learning Vimscripts and writing tests with Vim.
This could be hard to explain, but the more I learned Emacs the more I found better ways of doing the same Emacy thing in Vim.
[+] [-] SuboptimalEng|4 years ago|reply
Inspired by him, I made a 20 minute React JS tutorial[2] going over how to build a web app that teaches you Vim.
[0] https://www.vim.so
[1] https://news.ycombinator.com/item?id=25846347
[2] https://www.youtube.com/watch?v=BwTI9RT0q-A
[+] [-] johncoltrane|4 years ago|reply
I was on the market for a TextMate replacement that worked both on Mac OS X (at work) and Linux (at home) so I searched far and wide and came up with a list of editors and IDEs, GUI and TUI. I approached all of them with the same strategy:
1. follow the introductory tutorials, if any,
2. if the first contact was promising, use it for a while, learning and configuring as I go,
3. move to the next editor/IDE in the list.
For some, I gave up after half an hour, for others it went on for a few weeks, but I wanted to give all of them a fair chance so I eventually ended up at the bottom of the list, with Vim and its weirdo reputation.
So I did `$ vimtutor` and I was instantly hooked. As instructed, I graduated to the user manual which I stupidly rushed only to fall into the blogosphere trap and its many "here is my setup" posts. The winner was clear at that point and, after wasting a couple months trying to shoehorn my TextMate workflow, I finally decided to throw my `.vim` through the window and learn Vim properly this time, with the user manual.
Two months after that I was finally able to replace TextMate with Vim and I have never looked back.
Second, thoughts on learning Vim.
- Random online snippets, quick tips and tricks, tweets, etc. are useless because they lack context. They are also wrong very often.
- Using it right away for work is a bad idea because it forces you to copy other people's config and install lots of plugins that hide Vim and ultimately prevent you from learning it properly.
- Learning/using Vim has nothing to do with muscle memory. This is a common misconception that leads to rote learning and, since Vim has hundreds of commands, the use of flawed ready-made cheatsheets _and_ the looking for ways to bypass that horrifying learning curve.
- A flight simulator is not a plane and a tool-for-learning-vim-that-is-not-vim is not Vim. There are very good reasons for doing part of one's learning on a flight simulator but learning Vim in Vim is as free and safe as it gets so there is no point learning it via a third party tool.
Third, thoughts on your project.
There is no _need_ for anything else than `$ vimtutor` and `:help user-manual`.
[+] [-] vgel|4 years ago|reply
Completely agree on rote learning vs learning the actual language of Vim and being able to compose commands fluently.
I guess my feeling on muscle memory is similar to muscle memory in a natural language. If someone was learning English, you wouldn't encourage them to simply memorize phrases from a phrasebook, but it still is important to practice -- it's not possible to hold a long conversation where you need to think about verb conjugations every sentence, to become fluent it needs to become automatic.
In the same way, I'm familiar enough with Vim to know "Oh I want to delete the contents of this string, OK that's delete=d + inner=i + string=' -> di', oh crap it was a double quoted string, ok u+di", uh what was I doing again?" I've struggled with finding a good way to practice Vim to the point where I don't make those kinds of mistakes and don't need to think about the operations, in the same way that when I speak English I don't (usually) think about the verb conjugations.
My thought on this tool would be basically a set of drills of the form "Change this file to look like this", which each force you to compose Vim commands in a certain way. In the same way a Spanish textbook might ask you to translate "I went to the store", "She went to the library", "They went to the soccer game", this would have you drill using these manipulation operators in different combinations and contexts until it became automatic.
I know Vimtutor has a little of this, but from what I remember doing it a few months ago, it focuses mostly on the simple commands that are pretty easy to pick up via analogy from other editors (ok dd is delete line, like ctrl+k in sublime), and doesn't have the repetition aspect (you can just do vimtutor multiple times, but then you don't get variety).
[+] [-] andresgaitan|4 years ago|reply
[+] [-] karmakaze|4 years ago|reply
To learn 'vi' I had an 8.5 x 11 tri-fold cheetsheet that I printed out, pinned to the wall of my cubicle (yeah, it was a while ago) and referred to in constantly. Even when I wasn't editing, I'd take it down and browse up and down the columns to see what I knew/used that I hadn't before and recognize more stuff that made sense now when I had to memorize it without reason. Eventually you see how all the patterns fit together and how small it all is, wondering how you couldn't see it all from the start.
As for the muscle memory. Just get over the hump. Another pro tip. If you were thinking about using a custom keyboard layout, sort that out, because vi(m) muscle memory has nothing to do with alphabetic letters. It would be more like a musical instrument with the scale keys shuffled nonsensically. Sadly I had shooting pains up the backs of my hands, switched layouts and typing words is back but my vim's still slow, rebuilding muscle memory, so I'm with you on that.
[+] [-] cratermoon|4 years ago|reply
[+] [-] drekipus|4 years ago|reply
Then used it like glorified notepad for ages, eventually finding little hacks like "oh, O will put me on insert mode on the line above"
The starting the grammar, diw, etc
[+] [-] miccah|4 years ago|reply
For vim specifically, I think mode changes are the most important to learn first. Past that, it's building muscle memory for all the keybinds (and actually discovering the keybinds).
[+] [-] cardz|4 years ago|reply
[+] [-] dokem|4 years ago|reply
[+] [-] BeFlatXIII|4 years ago|reply
1. I've been using the Colemak layout longer than vim, so hjkl is no longer the right-hand home row like it is under QWERTY. 2. My main keyboard at the moment is a Poker ][ and the arrow keys are fn+WASD (or WARS if you're being pedantic about the Colemak layout rather than the printed label on the caps)
[+] [-] smackeyacky|4 years ago|reply
boss: "You need to learn vi" Me: "Why, this Sun has a text editor on it" Boss: "We own more than Sun workstations, go do this job on the Pyramid" Me: "rsh...ok I'm in. Ok. Uh, how does vi work?"
Not sure it's a real necessity these days when Nano exists but vi or its modern equivalent is on OSX, all(?) Linux distributions and generally shows up in WSL on Windows.
The Vim mode in VSCode is...OK I guess but you do need to be a bit careful with cut and paste, as the paste menu item doesn't necessarily give a hoot about the Vim mode you're in and stuffs things wherever you right clicked rather than where the need the text to go.
[+] [-] auslegung|4 years ago|reply
[+] [-] brhsagain|4 years ago|reply
I started using vim because in high school a guy I respected at the time started using it, and I wanted to look like a cool hacker or something, so I used it for my programming class assignments.
But yeah, you just have to use it. You should generally structure your life so that you can commit to the expense of learning something new for two weeks.
Edit: oops, I just read that you’re asking in the context of helping other people learn. Still, my advice for getting over the hump is to get over the hump, one keystroke at a time.
[+] [-] softwaredoug|4 years ago|reply
One never really learns “vim” TBH. Over the years I periodically take a dip in productivity to learn a knew thing and customize my experience. Some things are firmly in my muscle memory. But many things will never make it in there.
That’s the nature of the problem. Vim wants you to take a high level of ownership over the parts you want to emphasize. It’s hard to teach that.
Some people will get great value as a “dumb editor that works over ssh” while others have gone very deep into obscure corners to memorize whatever arcana helps them. All are valid ways to vim IMO.
[+] [-] oolfreak|4 years ago|reply
[+] [-] vgel|4 years ago|reply
[+] [-] Syntonicles|4 years ago|reply
Recently I did the same with Emacs. I'm a big fan of learning through complete immersion.
My opinion is that my method is horrendously inefficient and arduous. There's a lot of room for deliberate practice.
Here's one: https://www.shortcutfoo.com/app/dojos/vim/learn
If you can improve on that method please do.
[+] [-] vgel|4 years ago|reply
Agreed with immersion being important. Ultimately, you can't learn anything without work, but considering how useful tools like Anki have been for me in learning languages, I think there's room for something like that to, as you said, improve on that method :)
[+] [-] zwieback|4 years ago|reply
What really helped me were my coworkers who already knew vi and showed me a few tricks. Like using "." for repetitive tasks.
I think some example scenarios would be helpful. I rarely use vi these days but I have a soft spot for retro technologies so I think specifically pointing out a few of vi's strong points and contrasting them with the way most editors handle it would be good.
Mouse-free navigation with a few keys and little wrist movement is another strong point so maybe show a few animations how to make the most of that.
[+] [-] ducharmdev|4 years ago|reply
I used the VSCode vim extension too, which I believe eased me into it since I was already comfortable with VSCode.
I know the extensions are limited compared to straight vim, but IMO at a certain point you get diminishing returns with time spent learning your tools. Personally for me, getting proficient in normal, insert & visual mode was most worth it; I'm sure I'd benefit from learning how to do crazy macros, but didn't see a need to go beyond that.
[+] [-] atsaloli|4 years ago|reply
I based it on the paper "An Introduction to Display Editing with Vi" by Bill Joy and Mark Horton http://www.verticalsysadmin.com/vi/vi_editor__bill_joy.pdf
Bill Joy is the author of Vi.
[+] [-] unknown|4 years ago|reply
[deleted]