tests and docs
This commit is contained in:
parent
1356560f9a
commit
14ea90385b
@ -42,6 +42,7 @@ UltiSnips *snippet* *snippets* *UltiSnips*
|
||||
4.10.1 Pre-expand actions |UltiSnips-pre-expand-actions|
|
||||
4.10.2 Post-expand actions |UltiSnips-post-expand-actions|
|
||||
4.10.3 Post-jump actions |UltiSnips-post-jump-actions|
|
||||
4.11 Autotrigger |UltiSnips-autotrigger|
|
||||
5. UltiSnips and Other Plugins |UltiSnips-other-plugins|
|
||||
5.1 Existing Integrations |UltiSnips-integrations|
|
||||
5.2 Extending UltiSnips |UltiSnips-extending|
|
||||
@ -690,6 +691,9 @@ The options currently supported are: >
|
||||
python expression. This option can be specified along with other
|
||||
options, like 'b'. See |UltiSnips-context-snippets| for more info.
|
||||
|
||||
A Snippet will be triggered automatically, when condition matches.
|
||||
See |UltiSnips-autotrigger| for more info.
|
||||
|
||||
The end line is the 'endsnippet' keyword on a line by itself. >
|
||||
|
||||
endsnippet
|
||||
@ -1599,6 +1603,35 @@ def $1():
|
||||
endsnippet
|
||||
------------------- SNAP -------------------
|
||||
|
||||
4.11 Autotrigger *UltiSnips-autotrigger*
|
||||
----------------
|
||||
|
||||
Many language constructions can occur only at specific places, so it's
|
||||
possible to use snippets without manually triggering them.
|
||||
|
||||
Snippet can be marked as autotriggered by specifying 'A' option in the snippet
|
||||
definition.
|
||||
|
||||
After snippet is defined as being autotriggered, snippet condition will be
|
||||
checked on every typed character and if condition matches, then snippet will
|
||||
be triggered.
|
||||
|
||||
Consider following snippets, that can be usefull in Go programming:
|
||||
------------------- SNIP -------------------
|
||||
snippet "^p" "package" rbA
|
||||
package ${1:main}
|
||||
endsnippet
|
||||
|
||||
snippet "^m" "func main" rbA
|
||||
func main() {
|
||||
$1
|
||||
}
|
||||
endsnippet
|
||||
------------------- SNAP -------------------
|
||||
|
||||
When "p" character will occur in the beginning of the line, it will be
|
||||
automatically expanded into "package main". Same with "m" character.
|
||||
|
||||
==============================================================================
|
||||
5. UltiSnips and Other Plugins *UltiSnips-other-plugins*
|
||||
|
||||
|
22
test/test_Autotrigger.py
Normal file
22
test/test_Autotrigger.py
Normal file
@ -0,0 +1,22 @@
|
||||
from test.vim_test_case import VimTestCase as _VimTest
|
||||
from test.constant import *
|
||||
|
||||
|
||||
class Autotrigger_CanMatchSimpleTrigger(_VimTest):
|
||||
files = { 'us/all.snippets': r"""
|
||||
snippet a "desc" A
|
||||
autotriggered
|
||||
endsnippet
|
||||
"""}
|
||||
keys = 'a'
|
||||
wanted = 'autotriggered'
|
||||
|
||||
|
||||
class Autotrigger_CanMatchContext(_VimTest):
|
||||
files = { 'us/all.snippets': r"""
|
||||
snippet a "desc" "snip.line == 2" Ae
|
||||
autotriggered
|
||||
endsnippet
|
||||
"""}
|
||||
keys = 'a\na'
|
||||
wanted = 'autotriggered\na'
|
Loading…
x
Reference in New Issue
Block a user