红联Linux门户
Linux帮助

vim系统学习七(终结)

发布时间:2008-11-16 13:02:39来源:红联作者:snowflytosky
LESSON 7.1: GETTING HELP
[attach]10457[/attach]

** Use the on-line help system **

Vim has a comprehensive on-line help system. To get started, try one of
these three:
- press the key (if you have one)
- press the key (if you have one)
- type :help

Read the text in the help window to find out how the help works.
type CTRL-W CTRL-W to jump from one window to another
Type :q to close the help window.

You can find help on just about any subject, by giving an argument to the
":help" command. Try these (don't forget pressing ):

:help w
:help c_CTRL-D
:help insert-index

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LESSON 7.2: CREATE A STARTUP SCRIPT


** Enable Vim features **

Vim has many more features than Vi, but most of them are disabled by
default. To start using more features you have to create a "vimrc" file.

1. Start editing the "vimrc" file. This depends on your system:
:e ~/.vimrc for Unix
:e $VIM/_vimrc for MS-Windows

2. Now read the example "vimrc" file contents:
:r $VIMRUNTIME/vimrc_example.vim

3. Write the file with:
:w

The next time you start Vim it will use syntax highlighting.
You can add all your preferred settings to this "vimrc" file.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LESSON 7.3: COMPLETION


** Command line completion with CTRL-D and **

1. Make sure Vim is not in compatible mode: :set nocp

2. Look what files exist in the directory: :!ls or :!dir

3. Type the start of a command: :e

4. Press CTRL-D and Vim will show a list of commands that start with "e".

5. Press and Vim will complete the command name to ":edit".

6. Now add a space and the start of an existing file name: :edit FIL

7. Press . Vim will complete the name (if it is unique).

NOTE: Completion works for many commands. Just try pressing CTRL-D and


. It is especially useful for :help .

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LESSON 7 SUMMARY


1. Type :help or press or to open a help window.

2. Type :help cmd to find help on cmd .

3. Type CTRL-W CTRL-W to jump to another window

4. Type :q to close the help window

5. Create a vimrc startup script to keep your preferred settings.

6. When typing a : command, press CTRL-D to see possible completions.
Press to use one completion.



This concludes the Vim Tutor. It was intended to give a brief overview of
the Vim editor, just enough to allow you to use the editor fairly easily.
It is far from complete as Vim has many many more commands. Read the user
manual next: ":help user-manual".

For further reading and studying, this book is recommended:
Vim - Vi Improved - by Steve Oualline
Publisher: New Riders
The first book completely dedicated to Vim. Especially useful for beginners.
There are many examples and pictures.
See http://iccf-holland.org/click5.html

This book is older and more about Vi than Vim, but also recommended:
Learning the Vi Editor - by Linda Lamb
Publisher: O'Reilly & Associates Inc.
It is a good book to get to know almost anything you want to do with Vi.
The sixth edition also includes information on Vim.


This tutorial was written by Michael C. Pierce and Robert K. Ware,
Colorado School of Mines using ideas supplied by Charles Smith,
Colorado State University. E-mail: bware@mines.colorado.edu.

Modified for Vim by Bram Moolenaar.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
文章评论

共有 0 条评论