vi / vim tutorial recommendations

5

Being a common tool for *nix System Administrators, I'm looking for recommendations for vi/vim tutorials. After seeing this 'how do I do [this] in vim' question in Stack Overflow, I realize that I have yet to find a helpful-to-beginners tutorial which teaches not only the basic commands, but also ties in the logical mindset of vim (no snickering, emacs users). I have seen plenty of cheat-sheets (with varying levels of helpfulness), but they never tie in how to modify commands.

An example is that I know that to delete a line you use dd, but to delete a set number of lines use (three in this example), use d3d.

Another is that if you want a new line (to push the current line down) use a capital O, but to insert a line after this line, use lowercase o. (I think of it as the smaller, meeker version is more polite, while the big one shoves other lines out of it's way.)

Tying those together, to copy a line, use yy, and p where you want to paste. If you want to copy multiple lines (say 7), do y7y. Capital P to shove the current line down, or lowercase p to paste after the current line.

What are some 'tying it all together' tutorials?

gWaldo

Posted 2011-10-12T12:35:58.240

Reputation: 318

I'm surprised that this is being marked off-topic. Especially as vim is available on almost every platform (aside from Cisco, perhaps) which SysAds may be needed. Would it be better served on another site or as a wiki? – gWaldo – 2011-10-12T13:39:11.070

1(or are the close votes coming from emacs lovers?) – gWaldo – 2011-10-12T13:41:07.743

I'm surprised that someone with 4k rep would consider it on topic in serverfault. – None – 2011-10-12T13:45:54.007

Answers

6

I am working on an interactive tutorial for basic commands. You can find it at: http://www.openvim.com There is already a sandbox page that has a context sensitive menu, so that if you press '5' you can see what possibilities you have after that, e.g. 5w.

There will be new concept, a teaching box, later on, which deals with the wholesome experience of Vim; i.e. opening of files, splitting windows, etc.

Most of the basic functionality is there already. Currently I'm adding visual and visual block modes.

And hopefully I have energy to add some Vim based games.

egaga

Posted 2011-10-12T12:35:58.240

Reputation:

That sounds awesome, but you're not the first persons to mention it, but I personally would be thrilled about that! Thanks for working on that! – gWaldo – 2011-10-12T13:16:06.940

@gWaldo You're welcome! I am happy to hear people find it useful :) – None – 2011-10-12T13:27:48.950

8

Run vimtutor. It's a great tutorial that will give you just the right amount of knowledge necessary to get started with vim.

ciupinet

Posted 2011-10-12T12:35:58.240

Reputation:

4

You can also try the command 'vimtutor' for a tutorial. I came across this recently which seems neat: Interactive VIM tutorial

sinping

Posted 2011-10-12T12:35:58.240

Reputation:

3

Typing ":help" in vi(m) will open up quite a world of information for you. Also, you may want to check out this tutorial: http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/

objectified

Posted 2011-10-12T12:35:58.240

Reputation: 251

That does look like an excellent tutorial. Thanks! – gWaldo – 2011-10-12T13:38:15.440

3

If you prefer dead tree materials, O'Reilly is hard to beat.

Ward - Reinstate Monica

Posted 2011-10-12T12:35:58.240

Reputation: 687

Ha! I forgot about that! – gWaldo – 2011-10-12T14:15:24.957

2

Derek Wyatt has a series of tutorial videos that I've found quite helpful. They cover basic stuff through fairly advanced, and are in short manageable portions.

JKubecki

Posted 2011-10-12T12:35:58.240

Reputation: 121

1

It probably depends on what kind of learner you are but I don't think OpenVim is more useful than simply running $ vimtutor : it's longer, less exhaustive and too gimmicky. Plus it's a very poor and limited Vim emulation. Use the real vim instead.

From your question I gather that you already know the basics, anyway. Openvim is very basic so you won't learn many things from it.

The next step after vimtutor is to exercise on real text and real code with real vim.

That's when you'll notice by yourself that everything is tied together: using vim is speaking a language with a rich vocabulary and a very simple set of grammar rules (with their exceptions).

romainl

Posted 2011-10-12T12:35:58.240

Reputation: 19 227

0

to be honest, i'd advise learning the commands when you find you need them. Everyone works in different ways, and you shouldnt really allow a tutorial to give you one mind set.

I say edit how you want, and look into commands with a view to making that way easier. For example, i do a fair bit of python coding, so to me code folding and indentation is key, for others searching is more important so they focus on those commands.

Sirex

Posted 2011-10-12T12:35:58.240

Reputation: 10 321

That is what I have been doing, but I'm looking for the 'tie it all together' bit. – gWaldo – 2011-10-17T21:50:41.847