Some improvements in the helpfile chapter about the snippet syntax.
This commit is contained in:
parent
8126b9c3f5
commit
304131521d
@ -400,13 +400,13 @@ Snippet Keywords:
|
|||||||
|
|
||||||
- abbr [name] (Optional)
|
- abbr [name] (Optional)
|
||||||
|
|
||||||
Here you can define an abbreviation of the snippet which will be used in
|
You can define an abbreviation for the snippet. It will be displayed in
|
||||||
the drop down menu of neocomplcache.
|
the drop down selection menu of neocomplcache.
|
||||||
|
|
||||||
- alias [aliases] (Optional)
|
- alias [aliases] (Optional)
|
||||||
|
|
||||||
If you specify an alias it will be also used to expand a snippet. You can
|
Alias names can be use as additional keywords to expand a snippet. You can
|
||||||
define multiple aliases either using the separators ' ' or ','.
|
define multiple aliases using either spaces ' ' or commas ',' as separator.
|
||||||
|
|
||||||
Example
|
Example
|
||||||
|
|
||||||
@ -416,7 +416,8 @@ Snippet Keywords:
|
|||||||
|
|
||||||
- regexp [pattern] (Optional)
|
- regexp [pattern] (Optional)
|
||||||
|
|
||||||
This snippet expands when it matched by the regexp pattern only.
|
A pattern can be defined via a regular expression. The snippet expands only
|
||||||
|
when the expression pattern is matched.
|
||||||
|
|
||||||
Example
|
Example
|
||||||
|
|
||||||
@ -426,11 +427,11 @@ Snippet Keywords:
|
|||||||
|
|
||||||
- options [options] (Optional)
|
- options [options] (Optional)
|
||||||
|
|
||||||
Options influence the snippet behavior. The possible options 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. Note: To complete
|
||||||
the trigger in snippets_complete, it must be word(digits or
|
the trigger in snippets_complete, it must be a word character
|
||||||
alphabet characters or "_") characters.
|
(digits, an alphabetical characters or "_").
|
||||||
|
|
||||||
>
|
>
|
||||||
snippet date
|
snippet date
|
||||||
@ -450,22 +451,26 @@ Snippet Keywords:
|
|||||||
endif
|
endif
|
||||||
<
|
<
|
||||||
|
|
||||||
+ indent Neosnippet indents the snippet after expansion to the same
|
+ indentation The horizontal position of the snippet will be adjusted
|
||||||
|
to the indent the snippet after expansion to the same
|
||||||
column as the line above.
|
column as the line above.
|
||||||
|
|
||||||
Below the keywords starts the snippet which gets expanded. After the snippet
|
The snippet itself starts below the part that contains the options, snippet
|
||||||
expansion you can jump to the placeholders and replace them with desired text.
|
aliases and kekywords, described above. It contains the snippet which gets
|
||||||
|
expanded and can contain several place holders. The placeholders are used as
|
||||||
|
jump points inside the snippet. There are several placeholder available and they
|
||||||
|
provide diffrent functionality.
|
||||||
|
|
||||||
The structure of a placeholder can be:
|
The structure of a placeholder can be:
|
||||||
|
|
||||||
- ${number:placeholder text}
|
- ${number:placeholder text}
|
||||||
|
|
||||||
Here the number of the placeholder and the placeholder text that are
|
The number of a placeholder and the placeholder text are separated
|
||||||
separated by a ":" are embraced by a pair of "{}". The text is displayed
|
by a ":". They are embraced by a pair of curly braces "{}". The
|
||||||
after the snippet expansion and gets replaced by your text. If you jump
|
placeholder text is displayed after the snippet expansion and will be
|
||||||
over the snippet and do not insert any text in that position the
|
replaced by your text. If you jump over the snippet and do not insert
|
||||||
placeholder text remains there. This can be used as a standard value for a
|
any text in that position the placeholder text remains there. This can
|
||||||
certain position.
|
be used as a default value for a certain position.
|
||||||
|
|
||||||
Example
|
Example
|
||||||
|
|
||||||
@ -478,9 +483,9 @@ The structure of a placeholder can be:
|
|||||||
|
|
||||||
- ${number:#:placeholder text}
|
- ${number:#:placeholder text}
|
||||||
|
|
||||||
Here the number is followed by the "#" character. If you jump over this
|
In this type of placeholder the number is followed by the "#" character.
|
||||||
placeholder and do not insert any text, the placeholder text will be
|
If you jump over this placeholder and do not insert any text, the placeholder
|
||||||
removed.
|
text will be removed.
|
||||||
|
|
||||||
Example
|
Example
|
||||||
|
|
||||||
@ -493,15 +498,14 @@ The structure of a placeholder can be:
|
|||||||
|
|
||||||
- ${number:TARGET}
|
- ${number:TARGET}
|
||||||
|
|
||||||
This is the target placeholder which will be replaced by the text which is
|
This is the target placeholder which is replaced by text from a visual
|
||||||
selected before snippet expansion.
|
selection. Note: You need to expand your snippet with the key mapping below
|
||||||
Note: You need to expand you snippet with the key mapping below for this to
|
for this to work.
|
||||||
work.
|
|
||||||
|
|
||||||
|<Plug>(neosnippet_expand_target)|.
|
|<Plug>(neosnippet_expand_target)|.
|
||||||
|
|
||||||
This is very useful if you edit text and decide to put something in an
|
This is very useful if you edit text and decide to put something in an
|
||||||
environment or some sort of brackets.
|
environment or some sort of brackets for folding.
|
||||||
|
|
||||||
Example
|
Example
|
||||||
|
|
||||||
@ -514,9 +518,9 @@ The structure of a placeholder can be:
|
|||||||
|
|
||||||
- ${number}
|
- ${number}
|
||||||
|
|
||||||
This is a placeholder which you can use as a simple jump position. This
|
This is a placeholder which you can use as a simple jump position. This can be
|
||||||
can be useful if you edit a placeholder inside of some sort of brackets or
|
useful if you edit a placeholder inside of some sort of brackets or environment
|
||||||
environment and after that want to go on behind that.
|
and after that want to go on behind that.
|
||||||
|
|
||||||
Example
|
Example
|
||||||
|
|
||||||
@ -531,11 +535,11 @@ The structure of a placeholder can be:
|
|||||||
|
|
||||||
- $number
|
- $number
|
||||||
|
|
||||||
This is a synchronized placeholder. Sometimes it is required to repeat a
|
This is a synchronized placeholder. Sometimes it is required to repeat a value
|
||||||
value in several places inside a snippet. If you set the number of this
|
in several places inside a snippet. If you set the number of this placeholder
|
||||||
placeholder to the same number as one of the other placeholders in the
|
to the same number as one of the other placeholders in the snippet, it will
|
||||||
snippet it will repeat its content. $1 is synchronized to ${1} and so on.
|
repeat its content. $1 is synchronized to ${1} and so on. $0 will be the final
|
||||||
$0 will be the final jump placeholder.
|
jump placeholder.
|
||||||
|
|
||||||
Example
|
Example
|
||||||
|
|
||||||
@ -574,8 +578,8 @@ A placeholder value can not contain new lines. The snippet below isn't valid.
|
|||||||
|
|
||||||
Vim has a built-in expression evaluation. You can also use this feature inside
|
Vim has a built-in expression evaluation. You can also use this feature inside
|
||||||
of snippets if you use back ticks like in the example below where "%:t" gets
|
of snippets if you use back ticks like in the example below where "%:t" gets
|
||||||
expanded to name of the current active file when the snippet gets expanded and
|
expanded to the name of the current active file and the current time gets
|
||||||
the current time gets inserted by the expansion of the strftime command.
|
inserted by the expansion of the strftime command.
|
||||||
|
|
||||||
>
|
>
|
||||||
snippet header
|
snippet header
|
||||||
@ -628,8 +632,9 @@ detects this. If you want to overwrite a snippet explicitly, please use:
|
|||||||
After that you can redefine the snippet. But this does not work if you include
|
After that you can redefine the snippet. But this does not work if you include
|
||||||
external snippet files. There will be no warning when snippets get overwritten.
|
external snippet files. There will be no warning when snippets get overwritten.
|
||||||
|
|
||||||
Multi snippet feature in snipMate is available.
|
Multi snippet feature in snipMate is available. Neosnippet substitutes trigger
|
||||||
Neosnippet substitutes trigger and descriptions spaces to '_'.
|
and descriptions spaces to '_'.
|
||||||
|
|
||||||
>
|
>
|
||||||
snippet trigger description1
|
snippet trigger description1
|
||||||
hoge
|
hoge
|
||||||
@ -637,9 +642,9 @@ Neosnippet substitutes trigger and descriptions spaces to '_'.
|
|||||||
piyo
|
piyo
|
||||||
<
|
<
|
||||||
|
|
||||||
If you use hard-tab for indentation in snippet file, neosnippet will use
|
If you use hard-tab for indentation inside a snippet file, neosnippet will use
|
||||||
'shiftwidth' instead of Vim indent plugin. This feature is useful while some
|
'shiftwidth' instead of Vim indent plugin. This feature is useful while some
|
||||||
languages' indent files can not work very well (e.g.: PHP, Python).
|
languages' indent files do not work very well (e.g.: PHP, Python).
|
||||||
>
|
>
|
||||||
snippet if
|
snippet if
|
||||||
if (${1:/* condition */}) {
|
if (${1:/* condition */}) {
|
||||||
|
Loading…
Reference in New Issue
Block a user