Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have been using an IDE ever since I started programming, but now it is time to move on to something good.

I have decided to use vim. But I feel this entails a steep learning curve.

So what is a good tutorial for learning vim for a beginner?

share|improve this question
1  
There's a front end for Vim called Cream, which respects a lot of standard conventions for keyboard shortcuts etc, cutting down on the learning curve. Mind you, while I was impressed by some of the clever tricks, I still couldn't get on with it myself. – Steve314 Jan 26 '11 at 10:06

5 Answers

Here's, to paraphrase Sinatra, my way:

Step 1: Start using it. Forget about EditPlus, Notepad++, etc. Make sure stuff open in Vim by default. If you need to take an extra step to open something in Vim, chances are you're not going to do it.

Step 2: Learn the most basic shortcuts to get around in Vim and use them! Do not try to remember a whole set of 50 commands in one tutorial you read online. You will not remember them! The only way to remember something like this is through repetition.

Step 3: Once you're comfortable with step 2, think about what you're doing most frequently while editing and find a better way to do it in Vim. Chances are, there is a better way. Start using the new shortcut or a set of shortcuts to do what you normally do and stick with it. Your brain and your fingers must get used to this.

It's going to be tough at first, and more than once you'll say "Arse!" and want to quit. But, don't. Just stick with it and you're going to wake up soon and realize you're not even thinking about the shortcuts anymore. They come naturally, like using WASD in FPSs after the first few "Arse!"s and "Feck!"s.

share|improve this answer

This vi cheat sheet is pinned on my wall. You may find it comes in handy when learning vim.

Vi Cheat Sheet

share|improve this answer

There's tons of documentation/tutorials/books out there on Vim.

Another great resource I found when I was first learning Vim a bit (still don't know hardly enough to be as good as some people) was the program vimtutor, which can be found with most Vim distributions. Basically it's a document that's opened with Vim and edited by you with the instructions that are in the document. It's an interactive tutorial and starting over is as easy as running vimtutor again.

As Zekta Chan has pointed out already, the main site has some information.

A book that some colleagues have around the office is O'Reilly's vi and Vim Editors book and complimentary pocket reference.

bash and Korn shell both support vi mode. Both can be enabled by calling set -o vi (and set +o vi to turn it off). There's only two modes (insert and ex mode) and you also get a vim prompt when you hit v in ex mode. / and ? to search through your history (with regex!), hjkl, word navigation and more are all included in vi mode.

share|improve this answer
+1 The bundled documentation (use <code>:h</code> to access) is also pretty good, but you'll need the tutorial and something that needs editing to get the most out of it. – Larry Coleman Jan 26 '11 at 14:53
Do you have any resource around the Korn shell in vi mode? I've never heard of it, and Google's not helpful. – Florian Margaine Apr 29 '12 at 12:39
@FlorianMargaine updated the answer, hope it helps. – Nitrodist May 2 '12 at 20:38
Nice one, thanks! – Florian Margaine May 2 '12 at 20:47

Check this VIM game, its plain awesome: http://vim-adventures.com/

It's the "Zelda meets text editing" game. Beat the game to master VIM. I finished 2 levels, 3rd under development it seems.

Also check this. Its good: http://www.openvim.com/tutorial.html

share|improve this answer
Regarding Vim-Adventures, there are now 6 levels, but only the first one is free to play. That said, playing the first level is definitely worth a beginner's time. :) – CrazyJugglerDrummer Oct 13 '12 at 21:22

I like vimcast

It takes one subject per video blog and described in detail how to use the feature.
The author then spends some time explaining how to automate the feature using modifications to the rc file. All very cool.

The simplist commands you need are:

:x<enter>        save and exit
:w<enter>        save
:q<enter>        quit (no save)

:w!<enter>       Force a save
:q!<enter>       Force a quite (ignore warnings about not saving)

h                left
l                right
j                up
k                down

/<string><enter> find and move

<Number>G        Goto Line Number. Line 1 is the first line. Line 0 the last.

i                enter insert mode. (Use <esc> to exit).
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.