I\'m a Ruby programming trying to switch from Textmate to MacVim, and I\'m having trouble wading through the gargantuan lists of things you can do in VIM and all of the keyp
Here's a tip sheet I wrote up once, with the commands I actually use regularly:
<Esc>
gets you out of any mode and back to command modeAll insertion commands are terminated with <Esc>
to return to command mode.
<motion>
changes text in the direction of the motion<motion>
deletes in the direction of the motionname
write file to disk as name
tags
file); ^T return to previous position (arbitrary stack of positions maintained)Vim has some features that make it easy to highlight lines that have been changed from a base version in source control. I have created a small vim script that makes this easy: http://github.com/ghewgill/vim-scmdiff
http://www.viemu.com/a_vi_vim_graphical_cheat_sheet_tutorial.html
This is the greatest thing ever for learning VIM.
Here is a great cheat sheet for vim:
I can't imagine everyone uses all 20 different keypresses to navigate text, 10 or so keys to start adding text, and 18 ways to visually select an inner block. Or do you!?
I do.
In theory, once I have that and start becoming as proficient in VIM as I am in Textmate, then I can start learning the thousands of other VIM commands that will make me more efficient.
That's the right way to do it. Start with basic commands and then pick up ones that improve your productivity. I like following this blog for tips on how to improve my productivity with vim.
tuxfiles.org holds a pretty good cheat sheet. I think there are a couple of points to learning the commands:
d$
), go a quick google search to see if you can find a command for it.Besides these tips, there are some basic concepts you should understand.
d$
. To highlight a line after a particular character use v$
. So notice that $
indicates you will be doing something to the end of the line from where your cursor currently is.u
is undo, and ctrl+r
is redo.3dd
will delete the line your cursor is on and the two lines that follow, similarly 3yy
will copy the line your cursor is on and the two lines that follow.:ls
to list the buffers, and :bn
, :bp
to cycle through them.:help
This is probably the best way to 'learn the ropes', and the rest of the commands you will learn through usage.What most people do is start out with the bare basics, like maybe i, yw, yy, and p. You can continue to use arrow keys to move around, selecting text with the mouse, using the menus, etc. Then when something is slowing you down, you look up the faster way to do it, and gradually add more and more commands. You might learn one new command per day for a while, then it will trickle to one per week. You'll feel fairly productive in a month. After a year you will have a pretty solid repertoire, and after 2-3 years you won't even consciously think what your fingers are typing, and it will look weird if you have to spell it out for someone. I learned vi in 1993 and still pick up 2 or 3 new commands a year.