Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I know that vim (like emacs) is very powerful editor for programmers, as long as you know how to use it, its shortcuts, and so on. What steps can I take and what tutorials can I read to become an advanced vim user?

share|improve this question

closed as not constructive by Seth, AgentCool, Flimm, Jorge Castro, vasa1 Apr 23 '13 at 16:36

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

    
You might want to refer to the community wiki here -- ubuntu.stackexchange.com/questions/804/… –  myusuf3 Aug 5 '10 at 13:38

12 Answers 12

up vote 96 down vote accepted

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 the keyboard preferences to swap Caps Lock and Escape - seriously, how often do you use Caps Lock? Using vim you will be using Escape all the time, and having it available on the home row makes a huge difference. With the standard Ubuntu desktop, go through the menus: System -> Preferences -> Keyboard -> Layouts tab. Then hit the "Layout Options" button, click on the triangle next to "Caps Lock key behaviour" and select "Swap ESC and CapsLock".

Step 2: 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 3: use vim everywhere. See this question from StackOverflow 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 4: learn more about vim. You will only have scratched the surface with vimtutor. You can

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 5: Profit :)

share|improve this answer
9  
can't up vote this enough :) –  tutuca Aug 5 '10 at 17:33
    
Thank you very mush for the best answer! Fortunately, I'm already touch typist. :) So, I will follow next steps ... –  Zango Aug 5 '10 at 18:00
1  
Step 2 is so important. Changed vim from a being a pain to my favorite editor. –  Matthew Oct 24 '10 at 22:41
2  
I want to push Step 3, you can even use (g)vim on Windows or Mac or ... (see vim.org/download.php) Only using one editor will make you more familiar with it. –  ddeimeke Oct 25 '10 at 6:26
    
Make caps lock an extra control (or swap them). Vim has plenty of uses of ctrl, more than I use escape (I imap kj to escape anyway), but that handy, easier control key is useful in every other program I use, too. –  Roger Pate Oct 28 '10 at 11:27

http://www.linuxconfig.org/Vim_Tutorial

That is a pretty good tutorial. It has videos and such.

share|improve this answer

"vimtutor" form package "vim" is probably the best place to start.

share|improve this answer
1  
thanks, this is really a good start. –  Zango Aug 5 '10 at 18:01

PeepCode's Smash into VIM 1 & 2 are a great resource. You can also check out Rob Conery's blog, he has some good VIM related information/blogs available there.

share|improve this answer

I used a book that I found from Vim's website

share|improve this answer

Two things:

  1. Learn touch-typing. There's really no other way. Then bind ESC to ";;" so you never have to leave your home row: inoremap ;; <esc>

  2. Search github for other people's .vimrcs

And a third: VimCasts

share|improve this answer

This will sound silly, but get to know vim's help command. The help system is remarkably intuitive and easy to navigate.

Help is available by typing :help . You can find out about a specific topic by including that on the command line (eg :help insert). You can cycle through topics by hitting tab after typing one or more characters of topic.

The help is hyperlinked, with links denoted at either bold or coloured text. You can follow links by hitting <Ctrl-]> when your cursor is on it, and <Ctrl-t> to go back. To get out of help, type :q.

share|improve this answer
1  
And it has two complete manuals in it: user's manual and reference manual. You don't need anything more than vimtutor and :help to become a Vim expert. –  Marius Gedminas Aug 29 '10 at 18:38

Some great answers. Definitely try to integrate it into daily life and make sure you don't try to flood your brain with too much at a time. There's just too much to vim to learn it all in a week.

At first just start with one/two new commands/keys a week. Use them and ingrain them into your brain. You don't want to have to refer to a cheat sheet all day.

I've got a sample vim config setup that's really well documented I publish for people: http://github.com/mitechie/pyvim

Don't just copy/paste though. Make sure you understand what's going into your vim config so you don't forget/misunderstand what it's doing for you.

and I've started doing some vim screencasts: http://lococast.net/archives/111

share|improve this answer

I know that I might get negative feedback for this answer, as it may hurt vim fans and users: First ask yourself what you want to do. And only if vim is the best tool for that specific task, do what all the other answers tell you.

Or to say it with more images: You can try to get twice as fast or good with a hammer than you are now. But depending on the situation a screw driver may help more than the hammer. :)

share|improve this answer
4  
Yea, as a vim fan I have to say that vim's a bit more than a hammer. It can provide helpful uses for anyone from sysadmin, db admin, programmer (of any language) and even just plain no frills text editor. It's installed by default on every system for a reason and I don't know that there's much of a case for "well do you really need to know it at all" Beyond that, the user posted this explicitly for finding ways/help to advancing their vim knowledge and experience. –  Rick Aug 30 '10 at 0:15
1  
I totally agree with you! –  ddeimeke Oct 25 '10 at 10:51

I haven't really learned Vim yet but I think that by doing all my browsing with the Pentadactyl extension for Firefox it will be less difficult when I get around to do so.

Any text fields and the command line can be treated like Vim normal mode with a Ctrl T (or automatically, if you change a setting); however, here's where it falls down at the moment for me since many actions are interpreted to be global e.g. attempting to paste with p opens a url with the text that's in the buffer and attempting to overwrite text with r reloads the page. But you can open the text field in Gvim by pressing Control I, so it's not really an issue.

Another problem is that it makes websites like Gmail or Remember the Milk trickier to use since you have yet another mode to contend with.

share|improve this answer

See the answers on beginner's tips for learning Vim from Programmers SE

To reiterate my answer from that question:


I learnt a lot from the O'Reilly book "Learning the Vi and Vim editors". It's the best Vim book I've read.

I'd also recommend checking out:

share|improve this answer

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