Live data from Hacker News

Vim Cheat Sheet - For Programmers By Programmers

michael.peopleofhonoronly.com

41–50 of 64 posts

Re: Vim Cheat Sheet - For Programmers By Programmers

#41
post #22

This is why I only use the most basic features of vim. There are simply too many commands to learn and many of these tutorial and cheatsheets present you with too much information. I don't think the time investment makes sense, and I don't understand why there has to be so much noise: how many of those commands save a significant amount of time; how often are they used? The questions I would like to ask advanced vim…

The thing is.. there's a really step learning curve in learning the fundamentals of vim, but once you know them, it takes a second to learn a new command.

For instance, dt' will delete characters until it matches a'. But also, dtf' will delete characters until it matches a' but also delete that '. T and F goes backward.. you can put a number in front of the command to delete until it matches the nth ', etc. It looks like a lot of command.. but it's all the same basic ideas.

So to answer your question, yes you can use vim effectively with less than 10 commands.. but once you know those 10, it's a matter of seconds to learn 100+ which would make you extremely more effective.

And as my "top" commands.. I'd say definitely:

  ciw *deleting the current word*
  cit *deleting between the current html tag*
  ci) *deleting between the ()*

  With surround plugin:
  ds' *deleting the surrounding '*
  cs'" *changing the surrounding ' for "s*
  / *incremental search*
  o/O inserting new lines.

Re: Vim Cheat Sheet - For Programmers By Programmers

#43
post #15

Earlier quoted context omitted.

"wollw" and "DrJ" I am talking about command auto completion, not word auto completion inside the editor. In emacs, for word auto completion M-/ is just too awesome.

Pressing Tab completes commands in command-line mode, and its very smart. (Be sure to :set wildmenu to see a list of all matching commands as well.)

Even without wildmenu option, repeatedly pressing TAB key will cycle through the list of matches.

Re: Vim Cheat Sheet - For Programmers By Programmers

#44
post #33
post #7

I started out vim, with bare minimum commands but later on went to emacs. With emacs I have an option M-x tab auto complete In case I don't get to remember something. I would like to know what are vim equivalents of this? Some how I feel deep down inside that vim was not designed bottom for this kind of complexity. I mean to say when you want to design something to scale you have to clearly decide what goes into the…

Vi is like touch typing or driving a stick shift, it needs to be muscle memory to get full benefit from it, but it takes a while to learn and a long time to really sink in. Learning touch typing was worth the effort for me; I'm not sure at this point if all the time I spend 'learning' (i.e, mucking about with) Vi will be worth it purely in time saved. However I do love the ease and speed with which I can edit now, so…

Touch typing is a great analogy. I was a pretty good hunt-and-peck typer in 6th grade; I would even do 2-3 finger "rolls" across keys to type faster.

Learning to touch-type was frustrating at first: I knew I could go faster with my usual methods. But with perseverance, I became much faster with touch typing than I ever was before.

Vim is the same way. At first, it feels terrible to have to use these awkward keystrokes instead of the GUI editor commands you're used to. But eventually, with muscle memory and intentional practice, editing in Vim becomes very fast and efficient.

Re: Vim Cheat Sheet - For Programmers By Programmers

#45
post #22

This is why I only use the most basic features of vim. There are simply too many commands to learn and many of these tutorial and cheatsheets present you with too much information. I don't think the time investment makes sense, and I don't understand why there has to be so much noise: how many of those commands save a significant amount of time; how often are they used? The questions I would like to ask advanced vim…

I am an avid Vim user, and I also find such cheat sheets overwhelming. My pattern has been slow, incremental learning.

Starting from scratch is very intimidating. But when you have 10 commands in muscle memory, learning #11 seems pretty easy. When you know 50, #51 seems easy.

At first, using Vim was terrible. In a couple of weeks, I was back to "normal" productivity. In the 3 or so years since, I've continued to learn a new "trick" every few weeks or so, making notes in a Google Doc.

There is a long tail of commands, and no, you don't need all of them. But yesterday I created a macro that called a second macro, performing many complicated edits in my file in a few seconds that would have taken 10 minutes otherwise.

Was that worth it? Heck yes. It saved time, but even better, it felt awesome. The computer did my bidding.

Isn't that what programming is all about?

Re: Vim Cheat Sheet - For Programmers By Programmers

#46
post #4

vi(m) is for sys-admins. Programmers need to know :q! $ emacs !$ Let the war continue ;P

I remember the old joke of emacs standing for Eight Megabytes (of RAM) And Constantly Swapping. Oh for the days when that was a lot of system memory.. Not really.

Re: Vim Cheat Sheet - For Programmers By Programmers

#48
post #41
post #22

This is why I only use the most basic features of vim. There are simply too many commands to learn and many of these tutorial and cheatsheets present you with too much information. I don't think the time investment makes sense, and I don't understand why there has to be so much noise: how many of those commands save a significant amount of time; how often are they used? The questions I would like to ask advanced vim…

The thing is.. there's a really step learning curve in learning the fundamentals of vim, but once you know them, it takes a second to learn a new command. For instance, dt' will delete characters until it matches a' . But also, dtf' will delete characters until it matches a' but also delete that ' . T and F goes backward.. you can put a number in front of the command to delete until it matches the nth ' , etc. It loo…

->For instance, dt' will delete characters until it matches a'. But also, dtf' will delete characters until it matches a' but also delete that '.

dtf' should be df' in the above

Re: Vim Cheat Sheet - For Programmers By Programmers

#49
post #22

This is why I only use the most basic features of vim. There are simply too many commands to learn and many of these tutorial and cheatsheets present you with too much information. I don't think the time investment makes sense, and I don't understand why there has to be so much noise: how many of those commands save a significant amount of time; how often are they used? The questions I would like to ask advanced vim…

The first Vim commands people learn generally fall into this set: i, i_, gg, h, j, k, l, yy, dd, p, :w, :q. But any computer literate person should be able to operate on this level in a basic "Notepad" application. The be highly productive in Vim, I think you'll need to learn closer to 50 commands.

Now, if you think learning 50 commands is hard, think about your ability to touch type: that's at least 50 keys. Think about your programming language vocabulary. Think about your English language vocabulary. (Frankly, if I lost the ability to remember more than 10 Vim commands, re-learning Vim would be the least of my worries.)

Re: Vim Cheat Sheet - For Programmers By Programmers

#50
As a new programmer (I started learning Ruby and ROR about a month ago), the added value of learning VIM has already been paying off. Adding a new learning element into the mix (in this case VIM) does take some time at first, but once you realize how much time you can save in the long run there is no turning back.
Post reply on HN