views:

6465

answers:

60

A good while ago, I read an article by the creator of viemu, clearing up a lot of the misconceptions about vi, as well as explaining why it's a good idea (and why it's been very popular for the last 30 years+). The same guy also has a great set of graphical cheat sheets that teach the basics a few bits at a time.

I'm convinced.

I've been convinced for the past 2 years in fact. But I still really haven't gotten around to force myself to learn vi as my primary editor, the learning curve is just too high. When I get down to work, acceptable but immediate productivity (using my current editor) has so far won over tremendous productivity farther down the line (using vi).

Does anybody have any good tips to help get past the learning curve? It can be straight out tips, some other tutorial or article, whatever.

Edit: Note that I'm aware of the vim/gVim, Cream and MacVim (etc.) variants of vi. I kept my question about vi to refer to the vi family as a whole. Thanks for all the great answers.

Update (April 2009)

I've been using Vim (more precisely, MacVim) in my day to day professional life since last December. I'm not going back :-)

Good luck to everyone in their Vim mastery.

+2  A: 

delete all other text editor apps.

Then you will have to learn it.

Bob Dizzle
+6  A: 

The simplest way to force yourself might be just to remove all the other editors from your machine. Get rid of temptation :)

Dana
A: 

delete notepad.exe and create a shortcut to vim called notepad instead :)

or do all your coding via ssh or on a machine that has no GUI ;)

shyam
A: 

I've tried keeping a small cheat sheet or sticky notes of common vi commands. I do the same thing for an IDE I use. I find if I put sticky notes of keyboard shortcuts or commands on my monitor(s) it helps me learn them. Once I've used the shortcut enough and think I remember it well, I'll remove the sticky note.

Bob
+30  A: 

The first thing I'd do is lay a piece of paper or a book over your arrow keys and your ins/home/end/pgup/down keys. Those aren't needed in Vi.

Next I'd get used to hitting ctrl+[ whenever you're told to hit escape. It's much faster and you won't need to take your hands off the keyboard.

Then I'd watch my screencasts:

http://www.youtube.com/watch?v=FcpQ7koECgk

http://www.youtube.com/watch?v=c6WCm6z5msk

http://www.youtube.com/watch?v=BPDoI7gflxM

http://www.youtube.com/watch?v=J1_CfIb-3X4

Then, just practice practice practice.

edit The reason for avoiding the arrow keys is that they slow you down. One of the largest benefits of Vim is the speed it allows you. The arrow keys also prevent you from really embracing the modal nature, which is very powerful when mastered.

aaronjensen
I don't think modern Vi / Vim users should avoid the cursor keys. You probably won't ever use Vi on a system without cursor keys, so learning to avoid them is unnecessary, and they work fine (these days).
tialaramex
I've remapped the Caps-Lock key on my keyboard to Escape. Even faster than ctrl+[!
Chris AtLee
I agree with avoiding the cursor keys. One of the advantages of Vi's approach to movement is that once you're accustomed to it, you're set for all situations (read: on a cramped laptop layout or in remote sessions on weird OSes aka old Unices or through weird terminals)
webmat
Damn, I'd like to be able to accept 2 answers... AJ's answer is not about how to force yourself per se (which is why I picked Lucas' answer over this one). However the screencasts are very interesting. Thanks :-)
webmat
+1 on avoiding arrow keys.
jop
video links appear to be broken (both flash and download link below it)
Wim Coenen
I used the cursors until I disabled them in my .vimrc :map <Up> ""map <Down> ""map <Right> ""map <Left> ""My wrists are thankful that I got rid of that habit!
kotlinski
When using vim, what about when you're in insert mode? Aren't arrow keys useful there? The keys you list only apply to normal mode, as the `i` `0` `$` `Ctrl+B` `Ctrl+F` keys/combos merely insert characters and garbage in insert mode.
Joey Adams
Joey, arrow keys would indeed be useful, but it's almost always better to leave insert mode, navigate to where you want to be and reenter insert or change or whatever mode to do what you want to do. Hitting escape or ^[ is faster than moving your hands there and back.
aaronjensen
Personally, I've mapped the arrow keys to large-scale movements that I don't otherwise do. (basically, they navigate the tabs feature for me) Since the feature goes away when I'm using 'vi', and I do use vi occasionally, it's not a problem.
jkerian
+3  A: 

Write down all the short-cuts and features that you use in your current editor while you're using it at work. Then sit down on Saturday morning and using Google and stack overflow find out how to do each one of those in vi. Probably best if you use a sheet (or sheets) of paper for this.

Now disable/delete the other editors at work so that it'll take you longer to find and re-install them than look at your comparison sheet and do it in vi - i.e. you have no choice.

Lastly, publish your list of crossover shortcuts from your old editor to your new one on your blog.

Good luck!

Guy
+46  A: 

First of all, you may want to pick up Vim; it has a vastly superior feature set along with everything vi has.

That said, it takes discipline to learn. If you have a job and can't afford the productivity hit (without getting fired), I'd suggest taking on a weekend project for the sole purpose of learning the editor. Keep its documentation open as you work, and be disciplined enough not to chicken out. As you learn more, become efficient and start relying on muscle memory, it won't be as hard to stick with it.

I've been using Vim for so long that I don't even think about what keys to press to search or navigate or save. And my hands never leave the keyboard. To use Vim is one of the best choices I've made in my programming career.

Lucas Oman
I learned it at work and I couldn't avoid a productivity hit. It did help having a vimmer next to me to continuously ask questions. Find someone who knows vim well and make friends with them! Quickly look at the nav keys and get a handle on the modes. Try it out in 15 min chunks, you'll get it.
camflan
I agree, just keep at it. You'll know you are there once you are forced to used nano or notepad and it drives you crazy!
Kyle Walsh
After starting and stopping using Vim for a year I found that buying the Vim book and making myself go through it helped quite a bit. Also I try to keep a mindset of "There got to be a faster way to do this" and constantly keep looking in the :help for ways to do things better.
JD
Also, keep a handy list of features you want to get comfortable with. I've been using vim for over 5 years now, and I still keep a Tomboy note with new things I've learned that I want to remember to use.
Lucas Oman
A: 

umm, the is more of a physcology question than a programming question, but the best way I have been able to do things that I really didn't want to do is to just do it, and stop trying to thing of ways to motivate myself to do it.

Just think of it as brushing your teeth. Do you have to motivate yourself to do it? No, you just do it.

Craig H
A: 

Best possible and efficient thing you can do is to not bother. If you don't have a need for it, you shouldn't use it. The time investment will not pay off. Be rational. Quick mousework with normal shortcut keys in a legible text editor along with a keyboard you're fast with is going to be just fine. Textmate/Darkroom/SciTE seem to work for most.

alnayyir
+1  A: 

My recommendation is to come up with some simple programs and write them, start to finish, using VI.

Odds are, you will be too frustrated at first by the learning curve to force yourself to use them at work or in any time-sensitive environment.

I've done this before to get familiar with environments/editors, and it works pretty well.

If you are having problems coming up with things to write, I recommend redoing projects you did in school (or anything else that you've done previously). This method has the added bonus of letting you see how much of a better developer you have become. :)

Edit: forgot to mention that you should do this entirely from the console to avoid any temptation to use the mouse!

TM
A: 

Spend ten years posting to Usenet from a machine where only vi and emacs were available (and where emacs had an annoying long startup time when invoked from 'rn').

That's how I learned it.

But for a quicker approach, all I can recommend is that you just commit yourself to learning it, and spend a few hours working on some source code. Install vim if you don't have it already - it has wonderful syntax highlighting features.

It's well worth it. I know that I can go to just about any Unix machine, anywhere in the western world, perhaps even through a slow dialup connection or on a GUI-less machine, and be fully productive within minutes.

Matt Hucke
+6  A: 

You should start with vim (Vi IMproved) and especially its GUI - gVim. The GUI has menus and on Windows you can use the copy, cut and paste shortcuts, so you can replace Notepad immediately. And since the menus display the shortcuts (vim commands) you could learn a lot.

Another thing that you should do from the beginning is to configure vi for your needs. For example, you can transform vim into a Python IDE. By doing this, you'll have no excuse for using another editor, because vi will offer you everything you need.

Cristian Ciupitu
Depending on the terminal emulator, using the gui is also faster. :)
Arafangion
+3  A: 

Don't use X11?

$ sudu rm /usr/local/bin/emacs

Change your login shell to vi?

First, force yourself to use ed, then vi will seem like a luxury?

Use the vi key bindings in bash?

Just start using vi all the time?

It seems to me that learning an editor isn't terribly different from learning a language. Immersion works best.

I use vi for really quick edits or when I can't use X11 for some reason, but I live in emacs. Really powerful editors are worth taking the time to learn.

Jon Ericson
+11  A: 

For me VI is a good emergency editor, but not something I want to use if there is any other alternative available. I realize this is not for everyone though, I'm not saying it's horrid or anything, I just personally prefer a discoverable UI.

But you really have to know VI if you do anything significant in Linux!

So just learn the basics: i=insert mode esc=leave insert mode :wq=save and quit :q!=don't save and quit x=when not in insert mode, delete the character. /=search

That will get you through any editing emergency. There is nothing you can't do with those few commands (and navigation of course). The rest you can "Tack on" as you need them.

Keep a reference or book available though--when you NEED to use VI, you probably won't be able to browse the web--but the man page may be somewhat useful.

Bill K
the :help command is one of the most useful ones you can learn at first - who needs reference books or the web when it's built in to the editor?
zigdon
No reference book required if you learn to use :help. As for "you probably won't be able to browse the web," get familiar with the lynx and links browsers. In a pinch, you can even use them to browse the filesystem.
converter42
+1  A: 

You could get your hands on one of the original Happy Hacker keyboards (no arrow keys) and place your (wireless) mouse out of reach each time you start editing.

Garth Gilmour
+1  A: 

It's easy to write out a big list of commands/shortcuts, but it's difficult to remember them all without practice.

Focus on one new command at a time. When it becomes automatic, say after using it for a week or two, add another to your repertoire.

You'll be taking the long way around to accomplish certain things in the short term - these are obvious opportunities for new shortcuts to learn.

In my experience it was easier when I tried not to take on too much at once.

Craig Hyatt
A: 

Wait until you have to debug a wierd and wondeful problem in a live environment where all you can do is get to the command line. You might not end up liking VI, but it will save you a lot of time and you'll learn loads of tricks to step through massive (log) files.

Andrew Harmel-Law
+1  A: 

My number one suggestion: learn to type fast, without needing to look at the keyboard.

If you can't touch type and are always hunting-and-pecking for the colon or the hjkl or :%s/foo/bar, forget about it. Typing can be faster than using the mouse, but if that's not the case for you, vi's not going to work.

But combine good typing skills, ssh and screen and vi will be natural.

Michael Cramer
A: 

Print out one of the many Vi/Vim cheat sheets you can find on the internet and force yourself to stick with it for a few weeks.

Once you learn some basic commands you can be pretty efficient. From there, just keep plugging away and learn a new command every once in a while. There is no way you can learn ALL the vi commands. I believe there are more vi commands than there are atoms in the universe!! :)

A: 

The best way? Set your terminal to use vi keybindings.

chiggsy
+1  A: 

Face the fact that it will create an immediate performance hit. When learning a new tool you need to be able to do something that you know how to do with other tools so the problem isn't your problem. After using the new tool a while it will disappear and you will be only focusing on the underlying problem.

With something like vim (as others have said, vim is vastly superior to vi) it is important to reread and browse the documentation periodically. The interface is completely undiscoverable without it. With each new reading you will see a feature and say, "ah ha, that would have solved this issue I was trying to figure out last week", and will file it away in your brain. Solutions connected to real-world problems that you've had are much easier for you to remember than random shortcuts.

In the end you can use vim with a fairly small subset of it's features, so don't be overwhelmed with all the bells and whistles. Think of all the features in Word, do 99% of the people use them?

Matt Price
+1  A: 

gVIM has a really good tutorial (link in the Start menu group).

I found working through that helped to get over the initial learning hump; and then switching my Visual Studio to ViEMU helped me hone my VI skills.

Also, the screencasts at http://vimcasts.org/ are great!

David Laing
+9  A: 

You asked for good tips to help get past the learning curve on the vi text editor. Many of the previous answers suggest you use no other editors. I think that is good advice. Switching to vi from a more graphical editor requires a change in mindset. It requires thinking in terms of commands, rather than visual changes.

I used nothing but vi for many years and believe the only way you can be productive is to memorize the commands you regularly use. The way I did this was to make a short list of the most common keyboard commands. I grouped and color-coded these commands by function, i.e. Moving the Cursor, Editing, Searching, etc. I was careful to only include the most commonly used commands I did not know. The idea is to create a quick reference that is also an aid in memorization – not to replace the available help screens. Then I printed this list and taped it to the wall behind my monitor so I could see it easily. (The graphical cheat sheets you mentioned might work better for some, but are probably a better reference source than a memorization tool.)

Here's the key. As I became comfortable with one of the commands, I drew a line through it with a pencil. I could still see it if I needed it, but it was symbolic to me that I had mastered that command. That gave me confidence and motivation as I could see regular progress. Once I had most of them crossed off, I removed them and added some of the more rarely used commands. I continued this process until I was satisfied with my command of vi. I knew I had reached that point when I realized I had not crossed off any commands or even looked at the list in a long time.

A couple years ago I had need to work on a UNIX platform where vi was the only editor available. I bought a little pocket reference book on vi, but hardly used it. I ended up making lists and posting them on the wall as I did the first time I used vi. By the end of the first week, I was very comfortable even though it had been five years since I had used vi.

TMarshall
I think this is excellent advice and applies equally to learning other tools like an IDE, debugger, or even something like Excel.
davidavr
A: 

I only learned vi when I started working for an ISP where the scripts for editing domains only opened vi on a terminal. I had no choice but to learn it, but I've never regretted it.

In short, put yourself in a situation where you have no choice but to learn it.

Nathan Fellman
A: 

I learned vi from the excellent O'Reilly book "Learning the vi editor".

Phillip Wells
+12  A: 

I've been a on-again, off-again user of vim throughout the years (doing the occasional sys admin job). I just recently started spending more time doing my programming work in it. I'd suggest starting with gvim too. It integrates well with most OS environments, and (even better), you can fall back to the mouse when you need to :).

To get going with vim, run through the vimtutor (bundled with gVim) once or twice (takes an hour or so). I can't overstate how helpful it was for me! Especially the first parts about the different ways to move through a document, and how edit actions are recorded with motion commands, etc, etc. After that, things will be MUCH clearer.

Then, start doing quick, minor edits with it (notepad-replacement stuff) 'till you are comfortable enough to do useful editing at a rapid clip. Then try doing your day-to-day work in it. You'll find yourself pining for the "repeat last action" command in other editors in no time!

Brian
you can use the mouse in normal vim by running ":set mouse=a".
StephenPaulger
A: 

Google is your friend. Keep a window or tab handy and when you have something that you need to do several times, say indent code or search with a regex, look it up. The best hints sites will become familar, bookmark some and perhaps print out a cheat sheet.

sammyo
+1  A: 

ESC gg=G to reindent code and :retab to convert tabs to spaces or spaces to tabs was what hooked me to vim. So actually you don't need to be forced to use it, you just have to learn when it can help you increase your speed.

Go through vimtutor.

Start using vim for simple editing, like config files or html. Learn the commands as you need them.

Search google for a good .vimrc used by someone who uses a toolchain that resembles yours. Turn on syntax highlighting. Find a nice color scheme.

Learn macros because Vim is the best for automated tasks and snippet insertion, like formatting a few words into a complex XML tag or converting a CSV to an HTML table.

Edward Hyde
+2  A: 

I remember when I first started learning emacs, it was after I was already very comfortable with Vim, and I was in the same or similar boat that you were, where I knew how to get a lot done in another editor, so as I started using emacs, it was always painfully slow.

However, I think what you'll have to do is just absorb a little bit of the pain, and always, always, ALWAYS make sure that you look up the documentation for doing something that you know you can do in your previous editor, such as moving to the end of a line, or selecting a region of text.

It also helps if you have a local vi-expert on hand that you can ask questions, or if you're like our company, you promote pair programming. That way when you're trying to do something that should be easy, you can simply ask someone, they'll show you how, and if you're using the editor regularly for a few weeks, you shouldn't have to ask more then a couple of times before it becomes second nature.

If you don't have any local resources, there are plenty of books/tutorials/reference sheets online that should be able to answer most of your questions.

Ultimately, learning Vi is like learning other skills, there's no silver bullet, and you'll have to accept that, for a while, you're going to be less productive in it then your current editor. Just keep telling yourself, "Other people have been able to learn Vi, and I'm at least as smart as them" (That's what I tell myself anyway :) )

ben.prew
+5  A: 

Everytime you're doing a complex editing task, keep wondering if there is a more efficient way to do it. Most times, when it's something that you can describe in simple terms (like "swap paragraphs of text" or "delete everything after the X character in commented lines"), it's something you can do in just a couple of keystrokes in vim.

There are some key features that are extremely useful, and you'll end using all the time. The ones I love the most are:

  • Block selection (Ctrl-V)
  • Macro recording (q)
  • Virtual editing (:set ve=all)
  • Regular expressions
  • Piping to external unix programs
  • Key mappings
  • Autocompletion (C-p, C-x C-p, C-x C-f)
  • The operation+movement combination (this is amazingly powerful)

Ask other programmers what features they find most useful and adopt the ones that fit better your brain. Steal ideas from other people's vimrcs (here's mine)

Roberto Bonvallet
+5  A: 

I wrote a guide to efficient editing with Vim a while back. You may find it helpful.

I'd step back for a minute and ask yourself "why do I want to learn this editor? What makes me think it'll be faster or better than my current text editor?" Then learn those features that will make Vi(m) indispensible to you.

For instance, Vim's CTags integration is completely indispensible for me. I work with a very, very large codebase, and the ability to jump to a function or class definition in one keystroke (regardless of which file it's in) is an absolutely killer feature, one I have trouble working without.

Use your .vimrc file to make macros that automate common tasks.

Your autopilot editor-chooser will pick the editor that will get the job done quickest and with the least amount of mental effort. A little prep-work will ensure that editor is Vim. :-)

Jonathan
+1  A: 

force yourself not. the path to mastery love is.

A: 

I would start with argdo, and once you fall in love with that, the rest is easy...

Kearns
A: 

Spend a couple hours at the vi lover's site http://nereida.deioc.ull.es/html/vilovers.html - loads of tutorials, links, etc. with enthusiastic fans of vi.

DarenW
A: 

I've started using VI because it's the default editor on pretty much every operating system except for Windows. Then again I don't do a lot of coding on Windows so that helps.

If you want to force yourself on a *NIX/OSX system just remove the other editors or alias them. For the rest it's up to yourself. Everytime you don't use VI to edit a file you won't get a cookie.

Kristian
A: 

I used it to edit files on the webserver which was linux instead of using FTP. That was 9 years ago and I have since mastered the skills.

The other thing is find something great you can do in VI such as global search and replace or something even more powerful, and use VI whenever you need to do that.

Brian G
+1  A: 

You might want to start out with Cream. Cream describes itself as "a modern configuration" of vim. Basically, it is a special version of vim which looks and feels like any other text editor for all practical purposes. But enable the "expert mode" and you have all the power and behavior of vim.

So you can start using Cream as a regular text editor and then experiment with the "expert mode" until you are comfortable enough to fully switch to vim.

A: 

One thing that I found really confusing in modern vi (vim?) is the input mode that allows for some, but not all features of command mode. I feel much more comfortable when input mode is fully dumbed down to "overwrite only, no cursor movement possible" kind of thing that old Solaris vi has. The true vi requires you to stay in command mode most of the time.

That being said, there is no need to learn vi nowadays - emacs is just as ubiquitous. :)

Arkadiy
emacs is ubiquitous!?!? Not on a default server install it isn't ...
Hamish Downer
+1  A: 

Install gVim on all platforms you use.

Then run through the the vimtutor (:help vimtutor or vimtutor at the command line).

Watch the following lecture and follow its advice: 7 Habits For Effective Text Editing 2.0

I say you definitely want to start using it for all your editing. If you fear a loss of productivity then take a weekend to practice it solid (I once did this to switch to dvorak from qwerty and had my productivity high enough by Monday and managed to stick with it after).

It's worth the effort and you won't look back!

+5  A: 

Two things that will greatly improve your vi skills:

  1. Practice, practice, practice
  2. Nethack
Dr. UNIX
A: 

symlink every terminal editor on your system to vim and symlink every graphical editor on your system to a script that opens a new terminal window with vim running.

Steve Losh
A: 

The way I did it was to take a few minutes initially to go over the most basic stuff -- moving the cursor around, searching forwards and back, jumping to next and previous words/sentences/paragraphs, etc. Inserting, appending. Whatever you can fit in your head. Then, when you've got something to do that doesn't have to be done in the next 15 seconds, make yourself use it.

When you're pretty comfortable with the basics, slowly learn the more advanced commands -- especially those that leverage your previous learning (like replacing the next 3 words, or deleting to the next search target)

I love using VI, once I learned how. The advanced commands are far more powerful than what most of the GUI editors seem to offer, and the fact that it's ubiquitous and text-based, and so available over ssh, is all the better.

A: 

If you force yourself to use it for a few days you will see that the commands soon become second-nature. If you are on a posix system, I recommend you start with the BSD-licensed nvi, a classical 1:1 vi clone, and then move on to vim. If you start with vim, it is likely you only use a subset of the editing commands because its INSERT mode is very similar to GUI editors.

jbcreix
+1  A: 

Personally, what I had to do was make sure that I could use the Vim key-bindings (or at least, close enough) in several applications. Having to completely switch how I edited text whenever I changed editors made it too hard to get the Vim editing style committed to muscle memory.

In my case, Viemu + vimperator did the trick.

tomasr
I use Komodo Edit, which has built-in vi-bindings, so a switch to those and an install of vimperator helped tremendously. Now if I could only change rtorrent...
Xiong Chiamiov
A: 

I have VI on Windows, the version I use is listed below, if I am in a console window I always default to VI, then regardless of what OS I am running on I know I can edit the file. Conversely if I am in UI mode, I use Notepad++ go figure.

NT VI - Version 0.23 Developed by: Tony Andrews Based on a program by: Tim Thompson

titanae
A: 

Play lots of nethack. That's what I did when I was in college, and I found out later that the cursor movement was the same. Although at this point you may need to change the setting to use the vi style keymap.

+3  A: 

My suggestion: start small. Just start by memorizing a small set of most useful commands. When I started vi, these were my top 10:

  • (Esc) to return to command mode (most important!)
  • a to add text after cursor
  • A to add text at end of current line
  • x to delete 1 character
  • dd to delete 1 line
  • R to replace text (overwrite)
  • u to undo
  • :q! (Enter) to quit without saving
  • :w (Enter) to save
  • ZZ to save and quit

A lot of basic editing can be done using only these commands. Once you get comfortable, the rest don't look too difficult.

BTW, I'd like to add that I used to rely on vi for my primary text editor, but now only if I have to. In my case, productivity is better when I use tools like Emacs or Visual Studio (please note: "in my case"). Try more than one tool and choose the one that helps your productivity the most. Good luck!

Lahur
A: 

I made myself a handy one-page cheat sheet and used it to learn all the non-basic features. However, practice is about the only way to master anything.

vi is nice because it's on every UNIX-type computer, Mac OS X, Solaris, Linux. Find an old decstation box on eBay? It's got vi. How about Sun OS 4? vi again.

A: 

While i'm a great fan of vi in general, and vim in particular, there are many powerful editors, and you shouldn't feel you need to use vi, or it in some way is some absolute perfect editor, because it's not.

If you have to force yourself to use vi, I would be concerned that you don't feel productive using it. However, if you insist on persisting, I would probably just make sure I used vi for every single editing task. Whenever I need to do something and I don't quite no the best way to do it, I'd try to find the optimal (in terms of minimal keystrokes) to do it in vi after I did it a non-optimal normal way. I'd then make a post-it note with this little tip (or maybe just a text file) so I would remember it for next time.

Over time, your productivity with vi will dramatically improve.

Brian Mitchell
A: 

Why don't I pitch in with my very own low-friction way to force myself? :-)

What I do is simple: I try to make my git commit messages with vim (default editor when you don't specify a message at the command-line).

Of course a commit message is so short that it barely helps. But when re-editing a message with git commit --amend it's more helpful.

webmat
A: 

Do what I did. Use it for everything, and hang out in #vim on freenode.

Jeremy Cantrell
A: 

When you need to quickly search for something, having it all on one page can help.

webmat
+1  A: 

Use the post-it note method :-)

When using gvim, allow your self to use the menus. Read a book/tutorial about vim so you know the basics. (insert and command mode)

Select some really cool functions you think you need and write those on post-it notes and then stick those on the lower part off your monitor.

A good start is probably i, a, o, gg, G, :10 ,/something

and some cut and paste like yy, dd, p

and just top off with v, V (the visual mode) + cut and paste

Then when you know them, replace on post-it with a new one that has a even cooler function, and repeat until you are happy.

/Johan

Johan
+3  A: 

It sounds silly, but playing roguelike games (such as Nethack or Angband) is a fun way to get comfortable with using the h/j/k/l keys for cursor navigation.

bk1e
A: 

I was forced to learn Vim for my first programming job when I was 16 (the boss wouldn't let us use anything else), but I didn't make any real progress until I read Steve Oualline's Vim Book - it is highly recommended as a starting point if you want to get serious with vim.

Vim actually takes more time to master than do some programming languages (the features are that complex). Trying to 'master' Vim by printing cheat sheets would be like trying to master Haskell by reading a couple of blog posts. Be prepared to invest some serious time and you will be well rewarded.

too much php
+4  A: 

Step 0: learn to touch type. Seriously - if your fingers don't know where the keys are then vim is going to be a pain. And even if you reject vim, touch typing will improve your programming (ask Steve Yegge ) by making the mind to monitor link friction free. There is a lot of software that can help you improve your typing.

Step 1: use vimtutor to get you started. It is in gvim (under the help menu I think) or you can just type 'vimtutor' at the command line. It will take 30-45 minutes of your time and then your fingers will know the basics of vi/vim and you should be able to edit files without wanting to hurl your keyboard out of the window.

Step 2: use vim everywhere. See this question for tips and links for using vim and vi key bindings at the command line, from your web browser, for composing emails, in your IDE ... You need to use vim to embed the key bindings in your muscle memory.

Step 3: learn more about vim. You will only have scratched the surface with vimtutor. You can watch this video or read this article (both about the "Seven habits of effective text editing". You can read about tips and tricks on StackOverflow. You can browse vimtips. Learn a litle often would be my advice - there is so much out there that sticking to bite-size chunks will be the best way to make the knowledge stick.

Step 4: Profit :)

Hamish Downer
A: 

When I was a lot younger (eleven), my family moved to Germany for a couple of years. I was able to learn the language through immersion - I simply had no choice but to speak the language (although if I was in a dire situation I could find an English speaker).

My suggestion is that you do the same - unless you're in an absolutely desperate situation (e.g. "ok, I just deleted /etc/passwd and need to put back root"), make the conscious decision to do your best with vi. It actually doesn't take that long to learn the basics, if you're willing.

As others have suggested,

vim-tutor

can be a really good starting point, as can this image.

A: 

The main reason for me to use vi is ssh (or Putty on Windows): When you're logged into a Unix server remotely, then vi is always available. And it works with VT100 when neither the cursor keys nor backspace/delete are mapped.

Also having a book like VI Editor Pocket Reference helps greatly.

Aaron Digulla
A: 

How to force yourself ? My advice is to be in a work environment where you have to maintain 10 unix boxes by telnetting/puttying into them from windows. You will quickly realise that the only way to efficiently edit text on multiple variants of *nix is to use a standard editor that comes with almost every distro I know. Also, when X11 does not start up on a fresh install, vi is your only friend :)

Excalibur2000
+2  A: 
  1. Use a spaced repetition flash card program such as mnemosyne, supermemo, or anki to incorporate learning and retaining new commands into your daily routine. It's not enough to be using vim as your daily editor. To master it, you have to be storing those codes in your head, laying in wait for the time when they're the ideal solution to the task at hand.
  2. Maintain a .vimrc with customizations
  3. Write or edit a vim plugin
Peter Nore