22

As a complete beginner with no vi experience, how can I learn to use Vim using just Vim itself? Is there a built-in tutorial, and how can I access it?

Assume I have a laptop with Linux and Vim installed, and no Internet connection.

  • 3
    Start with vimtutor for the first 30 minutes. Continue with real practice for the rest of the week. Boom! You can fluently use Vim and have all its pros. – gon1332 Feb 3 '15 at 19:28
  • I found this eBook by Swaroop C H, very useful: files.swaroopch.com/vim/byte_of_vim_v051.pdf – senpai Feb 23 '16 at 0:00
26

vimtutor is a program that comes with vanilla vim installations. It's a 30-minute-ish tutorial program that explains the basics of vim. On *nix systems, you generally only need to execute vimtutor on the command-line. Unix also has gvimtutor available, if you'd prefer a GUI version.

On Windows, vimtutor.bat is located in $VIMRUNTIME (generally something like C:\Program Files (x86)\Vim\vim74 or similar). vimtutor.bat will default to GUI vim on Windows; pass -console if you want to force it to use console vim. On Windows 8, at least, you can also just search for 'vim tutor' (without the quotes, of course) from the Start Menu to open the tutor.

16

You can learn Vim by reading :help from top to bottom. When you enter :help, it looks like this:

*help.txt*      For Vim version 7.3.  Last change: 2010 Jul 20

                        VIM - main help file
                                                                         k
      Move around:  Use the cursor keys, or "h" to go left,            h   l
                    "j" to go down, "k" to go up, "l" to go right.       j
Close this window:  Use ":q<Enter>".
   Get out of Vim:  Use ":qa!<Enter>" (careful, all changes are lost!).

Jump to a subject:  Position the cursor on a tag (e.g. |bars|) and hit CTRL-].
   With the mouse:  ":set mouse=a" to enable the mouse (in xterm or GUI).
                    Double-click the left mouse button on a tag, e.g. |bars|.
        Jump back:  Type CTRL-T or CTRL-O (repeat to go further back).

Get specific help:  It is possible to go directly to whatever you want help
                    on, by giving an argument to the |:help| command.
                    It is possible to further specify the context:

As you can see, it starts from the essentials, such as moving around, jumping to subjects and back, and so on. If you scroll down a little bit, this list of documents becomes visible:

------------------------------------------------------------------------------
                                                *doc-file-list* *Q_ct*
BASIC:
|quickref|      Overview of the most common commands you will use
|tutor|         30 minutes training course for beginners
|copying|       About copyrights
|iccf|          Helping poor children in Uganda
|sponsor|       Sponsor Vim development, become a registered Vim user
|www|           Vim on the World Wide Web
|bugs|          Where to send bug reports

USER MANUAL: These files explain how to accomplish an editing task.

|usr_toc.txt|   Table Of Contents

Getting Started
|usr_01.txt|  About the manuals
|usr_02.txt|  The first steps in Vim
|usr_03.txt|  Moving around

Using the navigation tips that were given at the top (and Ctrl] to follow a link) you can start visiting the sections, for example starting from tutor. (This is actually how I learned Vim in the first place.)

  • This makes me feel silly that I never ran this command. I use the built-in help all the time. I learned the Ctrl-] and Ctrl-t shortcuts from a random tips website, and I thought they were ingenious and tremendously useful, and wondered why I hadn't heard about them...duh...I never ran just :help and started reading. – Wildcard Oct 11 '15 at 3:23
7

Like others have mentioned vimtutor is a good place to start, there are several other resources available to you for improving on your knowledge & understanding of the vim philosophy, which needless to say is not only brilliant but surprisingly & pleasantly intuitive.

However I would still like to use an example to draw a parallel to how one should approach learning vim.

As we are born, we are pretty much immobile, we need to be carried to wherever we need to go, slowly our legs & arms develop muscles and gradually with practice we learn both how to use them & control them precisely to make use of them to start crawling so we can explore our surrounds ourselves. As we grow further and develop more muscles, strength & coordination we start to walk and with some more of the same we eventually are able to run. Now you might think this would be the end of it but it isn't, after we're fairly comfortable walking / running to wherever we desire, we feel the need to go farther and farther and realise the need for more tools (different vehicles) to go farther and faster.

Learning vim IMO should be similar to that, in that you should learn enough that you can allow for your mind to grasp quickly and with practice it would seep into your muscle memory and become second nature, that would the time for you to learn further more tricks and repeat the cycle.

After spending enough time & effort in understanding & making vim philosophy so that it's in your muscle memory you will left frustrated at how painfully slow & awful it is to use other applications & editors that don't have some support for mimicking vim.

6

You can learn the basics by running vimtutor at the command line. This ships with vim and provides a basic interactive tutorial on it's use.

protected by Martin Tournoij Feb 23 '16 at 0:10

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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