Hacker News new | comments | show | ask | jobs | submit login

I want to learn Vim, but I cannot even dream to remember even the most primitive commands.



There is definitely a basic set of commands to remember, but the real power of vim is that it forms a succinct and consistent text-editing language where complex operations can very often be synthesized from what you already know about it.

For example, there are a set of commands that move the cursor in different ways (beginning of line, end of line, first line, last line, line #x, next word, previous word, etc. (that's ^/$/gg/G/g#/w/b) ), and a set of commands that performs actions (copy, cut mostly (y/d)). The real magic is how the two sets interact.

I don't have to memorize the sequence of keys to delete a word; I know the key to cut (d), and the key to move a word forward (w). I press d, then w, and the word is gone! It's a whole world of editing possibilities.

My secret shame: since I use GUI vims almost exclusively, I've never developed the muscle memory for hjkl movement; I use the arrow keys. When I started out, I knew i, esc, and that, and I figured out the rest as I needed it.


I think the real joy of vim is in the next level, when you start depending less on movement commands in favor of text objects.


or you try to finish your HN comment with :w


Yeah, vim follows you everywhere. I'm forced to edit someone's Word document and I have to erase the vim commands that I embedded in the text. Etc.


I press d, then w, and the word is gone!

There's got to be a better reason to use vim than this. I mean...the standard for every other editor is ctrl-shift-left arrow, then the delete key and the word is gone! Whoopee.

It works in most editors, even Microsoft notepad and this textarea I'm typing in right now. I use unfashionable, clumsy old eclipse most of the time and could probably list 100 important things it does that vim never could. Things that actually matter. Maybe I'm wrong, but I doubt vim can launch and debug and continuously deploy to Apache tomcat. That sort of thing.


Treat learning vim like you'd treat learning a natural language. You weren't having conversations when you were two years old, but you were learning words that you'd need later when you were ready to string them into sentences. That's how vim works.

I've been using vim for 10 years and I learn new things all the time.


That's the best thing about vim... there is always more to learn. I think it might be boring otherwise


My fingers remember the primitive command but my mind doesnt. If you ask me for a command and its function, I will not be able to answer some of it. But if I start typing on the keyboard my fingers know what to do.


Yes, it's funny how our brain works. I wouldn't be able to write down passwords that I use daily. Therein lies a pitfall - once you start think about a particular password, it becomes much harder to type it in.


It's like when I was a kid in New York. I could walk anywhere without thinking about it, but if someone asked me for directions I had no idea how to tell him to get where he wanted to go.


To be honest, I found that the only way to remember the commands is to commit them to muscle memory. However, this means coding enough in vim that you look things up enough for them to just stick.


Once you know how to switch between modes, it's easy to use vim as a basic text editor using the cursor keys.

At that point I wouldn't start looking things up all the time. Just set out to learn one new command or shortcut every two days, applying it in your daily use. Usually that's enough to get them in your mid-term muscle memory, so that you continue to use when you move on to the next command. The Vim pocket guide is great to choose what's up next.

I was already fairly adept at Vim when I applied this method to teach myself less frequently used Vim commands.


The Vim Adventures games is actually pretty useful for getting use to sticking with the keyboard and laying off the mouse.


the best way to learn VIM is to learn the basic commands, and then make your own




Applications are open for YC Winter 2018

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: