- Improved documentation.

This commit is contained in:
Shougo Matsushita 2013-04-23 22:19:53 +09:00
parent 9a524cb0bd
commit d5440b1552

View File

@ -391,25 +391,27 @@ Example:
< <
The snippet syntax is close to the one of |snipMate|. Each snippet starts with The snippet syntax is close to the one of |snipMate|. Each snippet starts with
some keywords that define the name and modify the expansion and treatment of the some keywords that define the name and modify the expansion and treatment of
snippet. the snippet.
Snippet Keywords: Snippet Keywords:
- snippet [name] (Required) - snippet [name] (Required)
Each snippet starts with the keyword "snippet". This keyword is directly Each snippet starts with the keyword "snippet". This keyword is
followed by the snippet name. The snippet name is used to expand the snippet. directly followed by the snippet name. The snippet name is used to
expand the snippet.
- abbr [name] (Optional) - abbr [name] (Optional)
You can define an abbreviation for the snippet name. It will be displayed in You can define an abbreviation for the snippet name. It will be
the drop down selection menu of the neocomplcache plugin. displayed in the drop down selection menu of the neocomplcache plugin.
- alias [aliases] (Optional) - alias [aliases] (Optional)
Alias names can be use as additional keywords to expand the snippet. You can Alias names can be use as additional keywords to expand the snippet.
define multiple aliases using either spaces ' ' or commas ',' as separator. You can define multiple aliases using either spaces ' ' or commas ','
as separator.
Example Example
@ -419,8 +421,8 @@ Snippet Keywords:
- regexp [pattern] (Optional) - regexp [pattern] (Optional)
A pattern can be defined via a regular expression. The snippet expands only A pattern can be defined via a regular expression. The snippet expands
when the expression pattern is matched. only when the expression pattern is matched.
Example Example
@ -432,9 +434,9 @@ Snippet Keywords:
Options influence the snippet behavior. The possible values are: Options influence the snippet behavior. The possible values are:
+ word This snippet expands by a word boundary. Note: To complete + word This snippet expands by a word boundary.
the trigger with snippets_complete, it must be a word character Note: To complete the trigger with snippets_complete, it must
(digits, alphabetical characters or "_"). be a word character (digits, alphabetical characters or "_").
> >
snippet date snippet date
@ -454,25 +456,26 @@ Snippet Keywords:
endif endif
< <
+ indent The horizontal position of the snippet will be adjusted + indent The horizontal position of the snippet will be adjusted
to the indent of the line above the snippet after expansion. to the indent of the line above the snippet after expansion.
The snippet itself starts below the part that contains the options, snippet The snippet itself starts below the part that contains the options, snippet
aliases and keywords, described above. It contains the snippet which gets aliases and keywords, described above. It contains the snippet which gets
expanded which can contain several placeholders. The placeholders are used as expanded which can contain several placeholders. The placeholders are used as
jump points while expanding the snippet. There are several placeholders available jump points while expanding the snippet. There are several placeholders
providing different functionality. available providing different functionality.
The structure of a placeholder can be: The structure of a placeholder can be:
- ${number:placeholder text} - ${number:placeholder text}
The placeholder starts with a dollar sign "$". The number of a placeholder The placeholder starts with a dollar sign "$". The number of a
and the placeholder text are separated by a colon ":". They are surrounded placeholder and the placeholder text are separated by a colon ":".
by a pair of curly braces "{}". The placeholder text is displayed after They are surrounded by a pair of curly braces "{}". The placeholder
the snippet expansion and will be replaced by your text. If you jump over text is displayed after the snippet expansion and will be replaced by
the snippet and do not insert any text in that placeholder position the text your text. If you jump over the snippet and do not insert any text in
remains there. This can be used as a default value for a certain position. that placeholder position the text remains there. This can be used as
a default value for a certain position.
Example Example
@ -485,9 +488,9 @@ The structure of a placeholder can be:
- ${number:#:placeholder text} - ${number:#:placeholder text}
In this kind of placeholder the number is followed by the hash character "#". In this kind of placeholder the number is followed by the hash
If you jump over this placeholder and do not insert any text, the placeholder character "#". If you jump over this placeholder and do not insert
text will be removed. any text, the placeholder text will be removed.
Example Example
@ -501,7 +504,8 @@ The structure of a placeholder can be:
- ${number:TARGET} - ${number:TARGET}
This is the target placeholder which is replaced by text from a visual This is the target placeholder which is replaced by text from a visual
selection. Note: You need to make a visual selection and expand your selection.
Note: You need to make a visual selection and expand your
snippet with the key mapping below for this to work. snippet with the key mapping below for this to work.
|<Plug>(neosnippet_expand_target)|. |<Plug>(neosnippet_expand_target)|.
@ -520,9 +524,9 @@ The structure of a placeholder can be:
- ${number} - ${number}
This is a placeholder which you can use as a simple jump position. This can be This is a placeholder which you can use as a simple jump position.
useful if you edit a placeholder inside of some sort of brackets or environment This can be useful if you edit a placeholder inside of some sort of
and want to go on behind it after that. brackets or environment and want to go on behind it after that.
Example Example
@ -536,12 +540,14 @@ The structure of a placeholder can be:
< <
- $number - $number
- ${0}
This is a synchronized placeholder. Sometimes it is required to repeat a value This is a synchronized placeholder. Sometimes it is required to repeat
in several positions inside a snippet. If you set the number of this placeholder a value in several positions inside a snippet. If you set the number
to the same number as one of the other placeholders in the snippet, it will of this placeholder to the same number as one of the other
repeat its content. $1 is synchronized to ${1} and so on. $0 will be the final placeholders in the snippet, it will repeat its content. $1 is
jump placeholder. synchronized to ${1} and so on. ${0} will be the final jump
placeholder.
Example Example
@ -552,8 +558,9 @@ The structure of a placeholder can be:
} // namespace $1 } // namespace $1
< <
Note: If you like to include characters in snippets that already have a Note: If you like to include characters in snippets that already have
special meaning to neosnippet you need to escape them with a backslash. a special meaning to neosnippet you need to escape them with a
backslash.
> >
snippet code snippet code
@ -570,7 +577,8 @@ The structure of a placeholder can be:
end end
< <
A placeholder value can not contain new lines. The snippet below is not valid. A placeholder value can not contain new lines. The snippet below is
not valid.
> >
snippet invalid snippet invalid
@ -661,8 +669,8 @@ Note: "#{string}" is comment string. But it must be in head.
# It is not comment string! # It is not comment string!
< <
Note: Neosnippet ignores empty or spaces lines in snippet end. If you want to insert empty Note: Neosnippet ignores empty or spaces lines in snippet end. If you want to
line in snippet end, you must insert placeholder. insert empty line in snippet end, you must insert placeholder.
> >
# This is valid. # This is valid.
snippet #! snippet #!