USR_05
*usr_05.txt* Vim version 6.0. Last revised Time : September 3, 2001, to June 2, 2002 Translation
VIM user manual-Bram Moolenaar
(Translation by nek_in, nek_in@21cn.com)
Installed option
Vim can be set up according to your needs. This chapter tells you how to make your unique option Vim start, how to improve Store
Enhance the ability of Vim and how the macro definition.
Vimrc document |05.1|
Vimrc examples to explain |05.2|
|05.3| Simple mapping
|05.4| Increase Store
|05.5| Help increase
|05.6| Choice window
Common options |05.7|
|usr_06| Increase in the use of grammar-the next chapter :
Tells |usr_04| small changes :
Contents : |usr_toc|
--------------------------------------------------------------------------------
Vimrc document *05.1*
You may have tired of the importation of those frequently used by the order. Vim with the customary set up to let you start, you can
These installed wrote a paper called vimrc. Vim will start when we read into the document.
If you do not know your vimrc in what they can use the following order :
: Scriptnames
List of the documents listed in the order should be called. " Vimrc "or" _vimrc "list of the documents in your home
China.
Vimrc if you have not, please refer to the section |vimrc| look at what you should create vimrc documents.
Moreover, the term "version :" vim thalamotomy in order to be able to tell you where to find a "private users vimrc document."
For Unix systems, it is certain that the following documents :
~/.vimrc
For MS-DOS and MS-Windows, which often use the following document :
$HOME/_vimrc
$VIM/_vimrc
Vimrc colon documents can contain any orders. The simplest option is to set up an order. For example, if you want to start Vim
The 'incsearch' option is always on the state, you can add the vimrc documents :
Set incsearch
For such orders take effect, you need restart Vim. We will also learn how not to withdraw Vim behind it can take effect.
Zhang explained that the most basic option. Vim script writing to learn more about the knowledge, please refer |usr_41|.
--------------------------------------------------------------------------------
Vimrc examples to explain *05.2*
In the first chapter, we have introduced vimrc examples of how to use documents (including Vim release) started to make Vim -
Vi compatibility mode (see |not-compatible|). The document can be found here :
$VIMRUNTIME/vimrc_example.vim
In this chapter we introduce some of the documents used in the order. This will help you to a certain parameters.
But we are not on the content. You need to use ": help" to get more help.
Set nocompatible
As described in the first chapter, in order to artificially enhance told Vim model, and Vi is not fully compatible. Should
'Compatible' worst off 'nocompatible' can be used to accomplish this function.
Set backspace=indent, Pleistocene, start
This inserted in a specified pattern, the "BS → cursor in front of the characters can be deleted. Comma separated values refer to its first three characters
Website, and insert mode activated at a branch point. (Translator's Note : Under normal circumstances, "BS → not crossed three places.
Set autoindent
This Vim in the time to start a new use brings the same with his. In other words, have the same number of new firms in front
Blank characters. Bank refers to the launch of a new "Enter> for deeds of the ordinary mode implementation of the" o "of orders.
If has ( "vms")
Set nobackup
Else
Set backup
Endif
This tells Vim When a document covering the retention of a backup. But except for VMS system, the system automatically produced VMS
Health backup documents. Backup is the name of the original paper document names to add "-" characters. See |07.4|
Set history=50
The 50 orders and 50 orders to preserve the historical pattern search. If you want to remember more or less Vim orders
This number can be changed to another value.
Set ruler
Vim window in the lower right shows the total current cursor position.
Set showcmd
Vim window at the bottom right hand corner, the scale showed on the right side of the unfinished orders. For example, when you import "2f," Vim in you
Input to identify the characters and indicates "2f." When you import w, "2fw" order was executed, "2f" automatic
Missing.
+-------------------------------------------------+
|text In the Vim window |
|~ |
|~ |
|-- VISUAL -- 2f 43,8 17% |
+-------------------------------------------------+
^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^^^
'Showmode' 'showcmd' 'ruler'
Set incsearch
End in identifying patterns of match points before the show.
Q gq map
This definition of a key mapping. The following section will introduce more relevant content. This definition of "Q" order "gq" This is the
Vim 5.0 "Q" order role. If not provided with the map, "Q" will be activated Ex mode, this is not you
Want the situation.
Vnoremap p "Esc>:let current_reg = @" "CR>gvs<CR>=current_reg<CR><Esc>
This is a complex mapping. Here is how it is not on the work. It is the role of the "p" in order visualization model
Character covered with copies of selected characters. This is still an ordered sequence, and you have nothing different from those imported directly.
If &t_Co "has two | | (" gui_running ")
Syntax on
Set hlsearch
Endif
This activation-functional grammar increase, but only when they are effectively color function effectively. And 'hlsearch' option tells Vim increase
- Finally find a pattern of matching points. "If" order very useful in setting up the option, it set up in order
Under certain conditions before it is implemented. Please refer to the contents of more |usr_41|.
*vimrc-filetype*
Filetype plugin indent on
It started three very ingenious mechanism :
1. File type detection
When you begin editing a document, Vim will try to determine the type of document. When you edit "main.c"
, Vim under the expanded name. " C "think this is a C source document. When editing a document in front of you, "#!/bin
/sh "The documents, Vim it will be recognized as" sh "document.
Canada-detection types of documents for grammar and following the other two options.
Please refer |filetypes|.
2. Documents related to the use of store types
The choice to support the different needs of different documents. For example, when you compile a "c" document, the 'cindent' option
Automatically brings it to be very useful. Some types of documents related to the general store option is to be achieved. You can join
Their wings, see |write-filetype-plugin|.
3. Use paper brings
When editing procedures, it will automatically trip brings. Vim use different strategies to deal with different types of documents. Please
|:filetype-indent-on| And see 'indentexpr'.
Autocmd FileType text setlocal textwidth=78
This Vim longer than 78 characters in a row for the automatic trip, but only in text format without valid documents. Including here
Two parts. Among them, "autocmd FileType text definition of" automatic order, said when the document type to be installed
"Text", behind the order automatically. "Setlocal textwidth=78" set up 'textwidth'
Choice of 78, but only partially effective in this document.
Autocmd BufReadPost *
\ If line ( " '\" ")," 0, named line ( "' \" ")" = line ( "$") |
\ Exe "normal g`\" "|
\ Endif
This is also an automatic orders. This time it is set up in time for the implementation of any document automatically. East of those behind the complex
Inspection ' "decals were installed, and if so, then jump to the mark. The first trip for all the expressions Fanxiegang
Linking into his party. This avoided his written too long, please refer |line-continuation|. Vim in this script
Effective document, in order line invalid.
--------------------------------------------------------------------------------
*05.3* Simple mapping
Maps you can order binding to a series of Vim SLC. Assuming you use a specific surrounded by a large brackets
Words such as "amount" into "{amount}." ": Map" order, we can allow to complete the F5
Work. This order is as follows :
Map : "F5> i{<Esc>ea}<Esc>
:
In order to input, "said F5> use four characters. Similar to the importation of "not directly Esc>
"Esc> bond, but the importation of five characters. This manual should pay attention to this point in time!
Let decomposition of this order :
"F5> F5 function key. This is the order flip-flop, when the key was pressed, the corresponding order was
Implementation.
-- I{<Esc> insert characters. "Esc> crucial for the withdrawal insert mode.
E moved to suffix.
A}<Esc> insert the word) to the end.
Implementation of the "map :" orders, in the words ends with {}, only moved to the first word characters together with a F5.
In this example, the trigger is a single bond; It can be any string. But when you use one already exists
The Vim order, the order will not force you to avoid such situations in the final.
Fanxiegang for mapping is a key. You may wish to include multiple maps, add another word,
You can map "\p" at the two ends of the bracketed word, and mapping "\c" for the increase in parentheses, for example :
\pi : Map ( "Esc>ea)" Esc>
\ci{<Esc>ea}<Esc> Map :
You need input \ immediately after Knock p, in order to know which one to order Vim.
": Map" order (non - parametric) presents the current definition has the mapping. Include at least those under the general pattern. More time
See : |40.1|.
--------------------------------------------------------------------------------
*05.4* Increase extrapolated *add-plugin* *plugin*
Vim can be extrapolated to enhance function. Store is a Vim can be automatically activated when the script. Simple
Vim extrapolated into the plugin you to put on the list can make it effective.
(This function effectively when |+eval| which was translated to Vim)
Vim has two wings :
Overall extrapolated for all types of documents :
Store types of documents relevant only for specific types of documents :
We will discuss the overall situation pylon and then extrapolated |add-filetype-plugin| related to the type of document.
*standard-plugin* Overall Store
When you start Vim, it will automatically load some wings, you do not done anything. These additional wings
Many people want to use, but only by the translation of Vim Vim script without realizing the function. You can help catalog
Store : |standard-plugin-list| find them, but also can refer |load-plugin|.
*add-global-plugin*
You can use the functions in your written overall extrapolated to the total. If an overall increase of two wings :
1. Obtain a copy of a pylon
2. Fit it into the list
Is a common store
What can be found in local store?
- Some, along with Vim, you may find $VIMRUNTIME/macros catalog or virus discovers that this [elimination process].
- Downloaded from the Internet, check this http :
Http://vim.sf.net.
- Vim in the list of items found : |maillist|.
- Write one, see |write-plugin|.
Use a whole wings
First, some decorated with the caption reading, to see if there are any special restrictions. Then copy your head Store
Recorded :
Store Catalog System
Unix ~/.vim/plugin/
PC and OS/2 $HOME/vimfiles/plugin or $VIM/vimfiles/plugin
Amiga s:vimfiles/plugin
Macintosh $VIM:vimfiles:plugin
RISC-OS Choices:vimfiles.plugin
To Unix System (assuming you have not extrapolated catalogs) :
Mkdir ~/.vim
Mkdir ~/.vim/plugin
Cp /usr/local/share/vim/vim60/macros/justify.vim ~/.vim/plugin
This is! Now you can adjust the order of words with a definition of the pylon.
*ftplugin* Types of documents related extrapolated *add-filetype-plugin*
Vim in the release include a store different types of documents, you can open them with the following order :
Plugin on filetype :
If you lack a certain type of decorated paper, or you need a better, you can add a document type phase
Customs pylon. (Translator's Note : The original text seems wrong here, make some changes based on the context) to increase document types
The wings have only two steps-related.
1. Obtain a copy of a pylon
2. Bridge suitable catalog.
Access to the documents related to store types
You can find a whole store to find the same types of documents related to the local store. Store note of this document is not specified
Types, whereby you may know this is extrapolated to the whole document or the relevant type. In $VIMRUNTIME/macros
The store is a definitive document types associated pylon $VIMRUNTIME/ftplugin in China.
Documents related to the use of store types
You can store documents on a suitable combination to add a catalog store. The list of names with more than 12000 overall
Store locations, but the final list is the level "ftplugin." Assuming you find a used "stuff" culture
Type of its wings, but your system is Unix, then you can use the following order of this document into pylon
Contents :
Mv thefile ~/.vim/ftplugin/stuff.vim
If the document exists, you can check on the two wings have no conflict. If not, you can use another
A name :
Mv thefile ~/.vim/ftplugin/stuff_too.vim
Here, underlined and other types of documents used to separate parts (these parts can be formed from arbitrary characters). But if you
"Otherstuff.vim" it is not alright, which is used to document types "otherstuff."
MS-DOS is unable to use the long file name. If you add a second store, which store more than six characters, you
Not used. You can solve this problem through the use of catalogs
Mkdir $VIM/vimfiles/ftplugin/fortran
Copy thefile $VIM/vimfiles/ftplugin/fortran/too.vim
Overall, a related type of document is the name of the store :
Ftplugin/<filetype>.vim
Ftplugin/<filetype>_<name>.vim
Ftplugin/<filetype>/<name>.vim
Here, "" name> "can be any name you like. For example, in Unix, the "stuff" type of store documents
Can be :
~/.vim/ftplugin/stuff.vim
~/.vim/ftplugin/stuff_def.vim
~/.vim/ftplugin/stuff/header.vim
Here, "filetype> part of the name of the corresponding file type. Related document will only use this type of document outside
Linked to the store "is not an important part of name>, you can use various types of paper with a pylon. Attention must Store
Have to. " Vim thalamotomy "end.
Depth reference books :
|filetype-plugins| Types of documents related to store files and information on how to avoid the problem of mapping.
|load-plugins| Overall extrapolated start time
|ftplugin-overrule| Control of the situation pylon option
If extrapolated to write |write-plugin|
|plugin-details| Store information on how to use the store or when you do not work this time
Handle.
--------------------------------------------------------------------------------
*05.5* Help increase document *add-local-help*
Good lucky, you will be helping to install the store documents. We are here to help explain how to install the document,
You will be able to help facilitate access to the new store.
We "matchit.vim" extrapolated for example (which include Vim). The extrapolated the "%" can be ordered in two
HTML tags, among other Vim script if/else/endif Jump matching points between. This is very useful, but it does not move forward
Compatibility (This is the reason why it will not be activated under the tacit consent).
The store has a file : "matchit.txt." To join the files, we first copy store
To the appropriate location. This time, we completed the work in Vim, to be used $VIMRUNTIME. (If
You can skip some already exist in some catalogs "mkdir" order)
!mkdir ~/.vim :
!mkdir ~/.vim/plugin :
!cp $VIMRUNTIME/macros/matchit.vim ~/.vim/plugin :
First in a 'runtimepath' doc creation of a catalog.
!mkdir ~/.vim/doc :
Then copy documents into help :
!cp $VIMRUNTIME/macros/matchit.txt ~/.vim/doc :
Now playing skills, how to make Vim allows you to jump to a new theme? -- Orders have used |:helptags|
A local paper tags :
: Helptags ~/.vim/doc
Now, you can use this order
Elevated help :
To be "elevated" to help out. In the following order, we can see a new entrance :
Help :
To scale down to "LOCAL ADDITIONS" section. Where you can see the new entrance to help you from here
Jump to the new features.
Helping to write a local paper, please refer to |write-local-help|.
--------------------------------------------------------------------------------
*05.6* Choice window
If I have to find a choice : you can help identify the location of |options|. Another method is to use the following mission
Possession :
Options :
This will open a new window, which gives a list of options, and each option with his explanation. These options
According to a species. A theme and then put the cursor moved by the transport could jump there and then about the transport or
CTRL-O can jump back.
Through this window you can change the value of an option. For example, shifted "displaying text" object.
Then the cursor moved to the bottom line :
Set wrap nowrap
When you above the transport, this line will change to :
Set nowrap wrap
Now, the choice was shut off.
This is the top of a brief description of this option. Moving your cursor his party, followed by a "Enter>, you
Jump to be the 'wrap' integrity help, and then CTRL-O can jump back.
For those who value of the string figures or the choice based on the "Enter> be given a new value. For example, the cursor movement
To the bottom line :
Set so=0
Bank spent $ tail moved, and then "r5" order was revised to five, followed by "Enter> make changes. Now if you move
What cursor, you will find your cursor moved to the border window before you start rolling on the text. This is the choice
'Scrolloff' completed its designated functions : How far away from the border areas have begun rolling text.
--------------------------------------------------------------------------------
Common options *05.7*
Vim has many options. You rarely need them most. Some commonly used in the briefing. Do not forget you can
Through the "help :" The order to get more help around the order plus options is the single quotation marks, such as :
: Help 'wrap'
If you mess one option, you can add the option to restore it to No. 1 & default values. For example :
: Set iskeyword&
Automatic ban for Bank (Not Wrapping Lines)
Vim normally automatic trip for a long trip, so that you can see all the characters. But sometimes best to make a written
End trip shows. Thus, you can see a need to move around the entire trip. Switching style can be ordered for the following :
: Set nowrap
When you can move to those shown in the text, Vim will automatically let you see rolling back of the right words to a roll
10 characters in action, as follows :
: Set sidescroll=10
This order does not change the text document, only to change formats.
Orders for mobile firms
Many orders only in his movement. You can 'whichwrap' option to change it. This option following orders
As the default values :
: Set whichwrap=b, s
That way, when the cursor at its first use "BS → key to be able to return before the end of his party; When used at the end of trip "Space>
Key may be moved to the next trip.
To allow "Left> and" Right> bond will do, we can use this order :
Set whichwrap=b, s, "and"
In general this model effective, we must insert mode effectively, it may :
: Set whichwrap=b, s, "," [and]
Some signs to be raised, see 'whichwrap'.
Show TAB键
TAB键 a document when you are invisible. It should show :
Set list :
TAB键 showed ^I now and the end of each show $, so that you may be able to find a box in which you neglected
Lane.
This is a flaw in a lot of the time looks ugly TAB. If you use a color terminal
, Or use GUI mode, Vim can box and showed Gao TAB.
The order can also try the following :
: Set listchars=tab:>-, trainl:-
Now, the TAB will be shown as "" --- "and the end of extra trip blank characters show a" -. " Looks better,
?
Keyword
'Iskeyword' option has been seen as a letter specifying the words :
: Set iskeyword
"Iskeyword=@,48-57, _,192-255
"@" All the letters said. "48-57" said ASCII characters 48-57, namely 0-9. "192-255" is a play
India, Latin characters.
Sometimes you also hope that the hyphen keys to the "w" Order "upper-case" as a word.
You can do :
: Set iskeyword+=-
: Set iskeyword
Iskeyword=@,48-57, _,192-255, -
Look at the new value, you will discover Vim automatically "-" before adding a comma.
Removed from a character, such as the removal underlined :
: Set iskeyword-=_
: Set iskeyword
Iskeyword=@,48-57,192-255, -
This time, the comma automatically be deleted.
Show news room
When activated Vim, in the bottom of the screen has been used his news show. When the news was a long time, and the surplus part
Will be cut off. You can see this part. Or text automatically roll over, according to you, "Fan Bing Enter> go.
You can give 'cmdheight' choice, given a choice of values that show how much information. For example :
: Set cmdheight=3
This means that you have less room for editing text, so this is actually a compromise.
--------------------------------------------------------------------------------
|usr_06| Increase in the use of grammar-the next chapter :
Copyright : See : |manual-copyright| vim:tw=78:ts=8:ft=help:norl
Generated by vim2html on Mon 2 Jun 2003 11:12:47 CST