Adds 'priority' keyword and removes '!' option.
This commit is contained in:
parent
d6ebf85fc8
commit
c1b41d0fbf
@ -1,6 +1,8 @@
|
|||||||
# This file contains snippets that are always defined. I personally
|
# This file contains snippets that are always defined. I personally
|
||||||
# have snippets for signatures and often needed texts
|
# have snippets for signatures and often needed texts
|
||||||
|
|
||||||
|
priority -50
|
||||||
|
|
||||||
##############
|
##############
|
||||||
# NICE BOXES #
|
# NICE BOXES #
|
||||||
##############
|
##############
|
||||||
@ -91,15 +93,15 @@ snip.rv = box[2] + '\n' + box[3]`
|
|||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet fold "Insert a vim fold marker" !b
|
snippet fold "Insert a vim fold marker" b
|
||||||
`!p snip.rv = _get_comment_format()[0]` ${1:Fold description} `!p snip.rv = foldmarker()[0]`${2:1} `!p snip.rv = _get_comment_format()[2]`
|
`!p snip.rv = _get_comment_format()[0]` ${1:Fold description} `!p snip.rv = foldmarker()[0]`${2:1} `!p snip.rv = _get_comment_format()[2]`
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet foldc "Insert a vim fold close marker" !b
|
snippet foldc "Insert a vim fold close marker" b
|
||||||
`!p snip.rv = _get_comment_format()[0]` ${2:1}`!p snip.rv = foldmarker()[1]` `!p snip.rv = _get_comment_format()[2]`
|
`!p snip.rv = _get_comment_format()[0]` ${2:1}`!p snip.rv = foldmarker()[1]` `!p snip.rv = _get_comment_format()[2]`
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet foldp "Insert a vim fold marker pair" !b
|
snippet foldp "Insert a vim fold marker pair" b
|
||||||
`!p snip.rv = _get_comment_format()[0]` ${1:Fold description} `!p snip.rv = foldmarker()[0]` `!p snip.rv = _get_comment_format()[2]`
|
`!p snip.rv = _get_comment_format()[0]` ${1:Fold description} `!p snip.rv = foldmarker()[0]` `!p snip.rv = _get_comment_format()[2]`
|
||||||
${2:${VISUAL:Content}}
|
${2:${VISUAL:Content}}
|
||||||
`!p snip.rv = _get_comment_format()[0]` `!p snip.rv = foldmarker()[1]` $1 `!p snip.rv = _get_comment_format()[2]`
|
`!p snip.rv = _get_comment_format()[0]` `!p snip.rv = foldmarker()[1]` $1 `!p snip.rv = _get_comment_format()[2]`
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
snippet online "Online resource" b
|
snippet online "Online resource" b
|
||||||
@online{${1:name},
|
@online{${1:name},
|
||||||
author={${2:author}},
|
author={${2:author}},
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
global !p
|
global !p
|
||||||
def newsoa():
|
def newsoa():
|
||||||
import datetime
|
import datetime
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
# TextMate Snippets #
|
# TextMate Snippets #
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
|
priority -50
|
||||||
|
|
||||||
snippet def "#define ..."
|
snippet def "#define ..."
|
||||||
#define ${1}
|
#define ${1}
|
||||||
endsnippet
|
endsnippet
|
||||||
@ -12,7 +14,7 @@ snippet ifndef "#ifndef ... #define ... #endif"
|
|||||||
#endif
|
#endif
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet #if "#if #endif" !b
|
snippet #if "#if #endif" b
|
||||||
#if ${1:0}
|
#if ${1:0}
|
||||||
${VISUAL}${0:${VISUAL/(.*)/(?1::code)/}}
|
${VISUAL}${0:${VISUAL/(.*)/(?1::code)/}}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# From the TextMate bundle
|
# From the TextMate bundle
|
||||||
|
|
||||||
|
priority -50
|
||||||
|
|
||||||
snippet fun "Function" b
|
snippet fun "Function" b
|
||||||
${1:name} = (${2:args}) ->
|
${1:name} = (${2:args}) ->
|
||||||
${0:# body...}
|
${0:# body...}
|
||||||
@ -87,4 +89,3 @@ endsnippet
|
|||||||
snippet log "Log" b
|
snippet log "Log" b
|
||||||
console.log ${1:"${2:msg}"}
|
console.log ${1:"${2:msg}"}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -2,8 +2,12 @@
|
|||||||
# CoffeeScript versions -- adapted from the JS TextMate bundle + additions
|
# CoffeeScript versions -- adapted from the JS TextMate bundle + additions
|
||||||
# for some jasmine-jquery matchers
|
# for some jasmine-jquery matchers
|
||||||
#
|
#
|
||||||
|
priority -50
|
||||||
|
|
||||||
extends coffee
|
extends coffee
|
||||||
|
|
||||||
|
priority -49
|
||||||
|
|
||||||
snippet des "Describe (coffee)" b
|
snippet des "Describe (coffee)" b
|
||||||
describe '${1:description}', ->
|
describe '${1:description}', ->
|
||||||
$0
|
$0
|
||||||
@ -160,4 +164,3 @@ endsnippet
|
|||||||
snippet noscw "expect was not called with (coffee)" b
|
snippet noscw "expect was not called with (coffee)" b
|
||||||
expect(${1:target}).wasNotCalledWith(${2:arguments})
|
expect(${1:target}).wasNotCalledWith(${2:arguments})
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
extends c
|
extends c
|
||||||
|
|
||||||
|
# We want to overwrite everything in parent ft.
|
||||||
|
priority -49
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# TextMate Snippets #
|
# TextMate Snippets #
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
# C# Snippets for UltiSnips #
|
# C# Snippets for UltiSnips #
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
||||||
|
priority -50
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
# classes and structs #
|
# classes and structs #
|
||||||
@ -325,4 +326,3 @@ snippet /// "XML comment" b
|
|||||||
/// $1
|
/// $1
|
||||||
/// </summary>
|
/// </summary>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
# Most of these came from TextMate #
|
# Most of these came from TextMate #
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
|
priority -50
|
||||||
|
|
||||||
snippet ! "!important CSS (!)"
|
snippet ! "!important CSS (!)"
|
||||||
${1:!important}
|
${1:!important}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Simple shortcuts
|
# Simple shortcuts
|
||||||
|
|
||||||
|
priority -50
|
||||||
|
|
||||||
snippet imp "import (imp)" b
|
snippet imp "import (imp)" b
|
||||||
import ${1:std.stdio};
|
import ${1:std.stdio};
|
||||||
endsnippet
|
endsnippet
|
||||||
@ -265,11 +267,11 @@ this(${1:/*args*/})
|
|||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet get "getter property (get)" !
|
snippet get "getter property (get)"
|
||||||
@property ${1:/*type*/} ${2:/*member_name*/}() const pure nothrow {return ${3:$2_};}
|
@property ${1:/*type*/} ${2:/*member_name*/}() const pure nothrow {return ${3:$2_};}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet set "setter property (set)" !
|
snippet set "setter property (set)"
|
||||||
@property void ${1:/*member_name*/}(${2:/*type*/} rhs) pure nothrow {${3:$1_} = rhs;}
|
@property void ${1:/*member_name*/}(${2:/*type*/} rhs) pure nothrow {${3:$1_} = rhs;}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
@ -490,12 +492,11 @@ endsnippet
|
|||||||
# Comments
|
# Comments
|
||||||
|
|
||||||
|
|
||||||
snippet todo "TODO (todo)" !
|
snippet todo "TODO (todo)"
|
||||||
// TODO: ${1}
|
// TODO: ${1}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# DDoc
|
# DDoc
|
||||||
|
|
||||||
snippet doc "generic ddoc block (doc)" b
|
snippet doc "generic ddoc block (doc)" b
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
# Generic Tags
|
# Generic Tags
|
||||||
snippet %
|
snippet %
|
||||||
{% ${1} %}${2}
|
{% ${1} %}${2}
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
# TEXTMATE SNIPPETS #
|
# TEXTMATE SNIPPETS #
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
|
priority -50
|
||||||
|
|
||||||
snippet pat "Case:Receive:Try Clause"
|
snippet pat "Case:Receive:Try Clause"
|
||||||
${1:pattern}${2: when ${3:guard}} ->;
|
${1:pattern}${2: when ${3:guard}} ->;
|
||||||
${4:body}
|
${4:body}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
# TextMate added these variables to cope with changes in ERB handling
|
# TextMate added these variables to cope with changes in ERB handling
|
||||||
# in different versions of Rails -- for instance, Rails 3 automatically
|
# in different versions of Rails -- for instance, Rails 3 automatically
|
||||||
# strips whitespace so that it's no longer necessary to use a form like
|
# strips whitespace so that it's no longer necessary to use a form like
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Snippets for Go
|
# Snippets for Go
|
||||||
|
|
||||||
|
priority -50
|
||||||
|
|
||||||
# when to abbriviate and when not?
|
# when to abbriviate and when not?
|
||||||
# b doesn't work here, because it ignores whitespace
|
# b doesn't work here, because it ignores whitespace
|
||||||
# optional local name?
|
# optional local name?
|
||||||
@ -44,42 +46,42 @@ type ${1:Interface} interface {
|
|||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
# statements
|
# statements
|
||||||
snippet for "For loop" !b
|
snippet for "For loop" b
|
||||||
for ${1:condition}${1/(.+)/ /}{
|
for ${1:condition}${1/(.+)/ /}{
|
||||||
${0:${VISUAL}}
|
${0:${VISUAL}}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet forr "For range loop" !b
|
snippet forr "For range loop" b
|
||||||
for ${2:name} := range ${1:collection} {
|
for ${2:name} := range ${1:collection} {
|
||||||
${0:${VISUAL}}
|
${0:${VISUAL}}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet if "If statement" !b
|
snippet if "If statement" b
|
||||||
if ${1:condition}${1/(.+)/ /}{
|
if ${1:condition}${1/(.+)/ /}{
|
||||||
${0:${VISUAL}}
|
${0:${VISUAL}}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet switch "Switch statement" !b
|
snippet switch "Switch statement" b
|
||||||
switch ${1:expression}${1/(.+)/ /}{
|
switch ${1:expression}${1/(.+)/ /}{
|
||||||
case${0}
|
case${0}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet select "Select statement" !b
|
snippet select "Select statement" b
|
||||||
select {
|
select {
|
||||||
case${0}
|
case${0}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet case "Case clause" !b
|
snippet case "Case clause" b
|
||||||
case ${1:condition}:
|
case ${1:condition}:
|
||||||
${0:${VISUAL}}
|
${0:${VISUAL}}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet default "Default clause" !b
|
snippet default "Default clause" b
|
||||||
default:
|
default:
|
||||||
${0:${VISUAL}}
|
${0:${VISUAL}}
|
||||||
endsnippet
|
endsnippet
|
||||||
@ -104,19 +106,19 @@ func ${1:name}(${2:params})${3/(.+)/ /}${3:type} {
|
|||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
# types and variables
|
# types and variables
|
||||||
snippet map "Map type" !b
|
snippet map "Map type" b
|
||||||
map[${1:keytype}]${2:valtype}
|
map[${1:keytype}]${2:valtype}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet : "Variable declaration :=" !b
|
snippet : "Variable declaration :=" b
|
||||||
${1:name} := ${0:value}
|
${1:name} := ${0:value}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet var "Variable declaration" !b
|
snippet var "Variable declaration" b
|
||||||
var ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value}}
|
var ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value}}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet vars "Variables declaration" !b
|
snippet vars "Variables declaration" b
|
||||||
var (
|
var (
|
||||||
${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value} }
|
${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value} }
|
||||||
)
|
)
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
snippet if "if ... then ... else ..."
|
snippet if "if ... then ... else ..."
|
||||||
if ${1:condition}
|
if ${1:condition}
|
||||||
then ${2:expression}
|
then ${2:expression}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Snippets for VIM Help Files
|
# Snippets for VIM Help Files
|
||||||
|
|
||||||
|
priority -50
|
||||||
|
|
||||||
global !p
|
global !p
|
||||||
def sec_title(snip, t):
|
def sec_title(snip, t):
|
||||||
file_start = snip.fn.split('.')[0]
|
file_start = snip.fn.split('.')[0]
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# TextMate Snippets #
|
# TextMate Snippets #
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
@ -1 +1,3 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
extends html, django
|
extends html, django
|
||||||
|
@ -1 +1,3 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
extends html, jinja2
|
extends html, jinja2
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
###########################################################################
|
priority -50
|
||||||
# TEXTMATE SNIPPETS #
|
|
||||||
###########################################################################
|
|
||||||
|
|
||||||
# Many of the snippets here use a global option called
|
# Many of the snippets here use a global option called
|
||||||
# "g:ultisnips_java_brace_style" which, if set to "nl" will put a newline
|
# "g:ultisnips_java_brace_style" which, if set to "nl" will put a newline
|
||||||
@ -31,7 +29,7 @@ def camel(word):
|
|||||||
|
|
||||||
endglobal
|
endglobal
|
||||||
|
|
||||||
snippet sleep "try sleep catch" !b
|
snippet sleep "try sleep catch" b
|
||||||
try {
|
try {
|
||||||
Thread.sleep(${1:1000});
|
Thread.sleep(${1:1000});
|
||||||
} catch (InterruptedException e){
|
} catch (InterruptedException e){
|
||||||
@ -39,16 +37,16 @@ try {
|
|||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet /i|n/ "new primitive or int" !br
|
snippet /i|n/ "new primitive or int" br
|
||||||
${1:int} ${2:i} = ${3:1};
|
${1:int} ${2:i} = ${3:1};
|
||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet /o|v/ "new Object or variable" !br
|
snippet /o|v/ "new Object or variable" br
|
||||||
${1:Object} ${2:var} = new $1(${3});
|
${1:Object} ${2:var} = new $1(${3});
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet f "field" !b
|
snippet f "field" b
|
||||||
${1:private} ${2:String} ${3:`!p snip.rv = t[2].lower()`};
|
${1:private} ${2:String} ${3:`!p snip.rv = t[2].lower()`};
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
@ -60,15 +58,15 @@ snippet as "assert" b
|
|||||||
assert ${1:test}${2/(.+)/(?1: \: ")/}${2:Failure message}${2/(.+)/(?1:")/};$0
|
assert ${1:test}${2/(.+)/(?1: \: ")/}${2:Failure message}${2/(.+)/(?1:")/};$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet at "assert true" !b
|
snippet at "assert true" b
|
||||||
assertTrue(${1:actual});
|
assertTrue(${1:actual});
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet af "assert false" !b
|
snippet af "assert false" b
|
||||||
assertFalse(${1:actual});$0
|
assertFalse(${1:actual});$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ae "assert equals" !b
|
snippet ae "assert equals" b
|
||||||
assertEquals(${1:expected}, ${2:actual});
|
assertEquals(${1:expected}, ${2:actual});
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
@ -96,7 +94,7 @@ snip.rv = snip.basename or "untitled"`} ${2:extends ${3:Parent} }${4:implements
|
|||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet clc "class with constructor, fields, setter and getters" !b
|
snippet clc "class with constructor, fields, setter and getters" b
|
||||||
public class `!p
|
public class `!p
|
||||||
snip.rv = snip.basename or "untitled"` {
|
snip.rv = snip.basename or "untitled"` {
|
||||||
`!p
|
`!p
|
||||||
@ -242,11 +240,11 @@ snippet map "Collections Map" b
|
|||||||
Map<${1:String}, ${2:String}> ${3:map} = new ${4:Hash}Map<$1, $2>();
|
Map<${1:String}, ${2:String}> ${3:map} = new ${4:Hash}Map<$1, $2>();
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet set "Collections Set" !b
|
snippet set "Collections Set" b
|
||||||
Set<${1:String}> ${2:set} = new ${3:Hash}Set<$1>();
|
Set<${1:String}> ${2:set} = new ${3:Hash}Set<$1>();
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet /Str?|str/ "String" !br
|
snippet /Str?|str/ "String" br
|
||||||
String $0
|
String $0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
@ -298,7 +296,7 @@ public static void main(String[] args)`!p nl(snip)`{
|
|||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet try "try/catch" !b
|
snippet try "try/catch" b
|
||||||
try {
|
try {
|
||||||
$1
|
$1
|
||||||
} catch(${2:Exception} ${3:e}){
|
} catch(${2:Exception} ${3:e}){
|
||||||
@ -306,7 +304,7 @@ try {
|
|||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet mt "method throws" b!
|
snippet mt "method throws" b
|
||||||
${1:private} ${2:void} ${3:method}(${4}) ${5:throws $6 }{
|
${1:private} ${2:void} ${3:method}(${4}) ${5:throws $6 }{
|
||||||
$0
|
$0
|
||||||
}
|
}
|
||||||
@ -318,7 +316,7 @@ ${1:private} ${2:void} ${3:method}(${4}) {
|
|||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet md "Method With javadoc" !b
|
snippet md "Method With javadoc" b
|
||||||
/**
|
/**
|
||||||
* ${7:Short Description}`!p
|
* ${7:Short Description}`!p
|
||||||
for i in getArgs(t[4]):
|
for i in getArgs(t[4]):
|
||||||
@ -338,19 +336,19 @@ ${1:public} ${2:void} ${3:method}($4) ${5:throws $6 }{
|
|||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet /get(ter)?/ "getter" !br
|
snippet /get(ter)?/ "getter" br
|
||||||
public ${1:String} get${2:Name}() {
|
public ${1:String} get${2:Name}() {
|
||||||
return `!p snip.rv = t[2].lower()`;
|
return `!p snip.rv = t[2].lower()`;
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet /set(ter)?/ "setter" !br
|
snippet /set(ter)?/ "setter" br
|
||||||
public void set${1:Name}(${2:String} $1) {
|
public void set${1:Name}(${2:String} $1) {
|
||||||
return this.`!p snip.rv = t[1].lower()` = `!p snip.rv = t[1].lower()`;
|
return this.`!p snip.rv = t[1].lower()` = `!p snip.rv = t[1].lower()`;
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet /se?tge?t|ge?tse?t|gs/ "setter and getter" !br
|
snippet /se?tge?t|ge?tse?t|gs/ "setter and getter" br
|
||||||
public void set${1:Name}(${2:String} `!p snip.rv = t[1].lower()`) {
|
public void set${1:Name}(${2:String} `!p snip.rv = t[1].lower()`) {
|
||||||
this.`!p snip.rv = t[1].lower()` = `!p snip.rv = t[1].lower()`;
|
this.`!p snip.rv = t[1].lower()` = `!p snip.rv = t[1].lower()`;
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# TextMate Snippets #
|
# TextMate Snippets #
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
#
|
priority -50
|
||||||
|
extends javascript
|
||||||
|
priority -49
|
||||||
|
|
||||||
# JavaScript versions -- from the TextMate bundle + some additions
|
# JavaScript versions -- from the TextMate bundle + some additions
|
||||||
# for jasmine-jquery matchers
|
# for jasmine-jquery matchers
|
||||||
#
|
#
|
||||||
extends javascript
|
|
||||||
|
|
||||||
snippet des "Describe (js)" b
|
snippet des "Describe (js)" b
|
||||||
describe('${1:description}', function() {
|
describe('${1:description}', function() {
|
||||||
@ -165,4 +167,3 @@ endsnippet
|
|||||||
snippet noscw "expect was not called with (js)" b
|
snippet noscw "expect was not called with (js)" b
|
||||||
expect(${1:target}).wasNotCalledWith(${2:arguments});
|
expect(${1:target}).wasNotCalledWith(${2:arguments});
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
# JSDoc snippets
|
# JSDoc snippets
|
||||||
|
|
||||||
snippet /* "A JSDoc comment" b
|
snippet /* "A JSDoc comment" b
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
# http://jinja.pocoo.org/
|
# http://jinja.pocoo.org/
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
snippet s "String" b
|
snippet s "String" b
|
||||||
"${1:key}": "${0:value}",
|
"${1:key}": "${0:value}",
|
||||||
endsnippet
|
endsnippet
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
snippet t "Transaction" b
|
snippet t "Transaction" b
|
||||||
${1:`!v strftime("%Y")`}-${2:`!v strftime("%m")`}-${3:`!v strftime("%d")`} ${4:*} ${5:Payee}
|
${1:`!v strftime("%Y")`}-${2:`!v strftime("%m")`}-${3:`!v strftime("%d")`} ${4:*} ${5:Payee}
|
||||||
${6:Expenses} \$${7:0.00}
|
${6:Expenses} \$${7:0.00}
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
extends haskell
|
priority -50
|
||||||
|
|
||||||
|
extends haskell
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
#################################
|
#################################
|
||||||
# Snippets for the Lua language #
|
# Snippets for the Lua language #
|
||||||
#################################
|
#################################
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# From snipmate #
|
# From snipmate #
|
||||||
#################
|
#################
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
###########################################################################
|
priority -50
|
||||||
# SNIPPETS for MARKDOWN #
|
|
||||||
###########################################################################
|
|
||||||
|
|
||||||
###########################
|
###########################
|
||||||
# Sections and Paragraphs #
|
# Sections and Paragraphs #
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# TextMate Snippets #
|
# TextMate Snippets #
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
snippet rs "raise" b
|
snippet rs "raise" b
|
||||||
raise (${1:Not_found})
|
raise (${1:Not_found})
|
||||||
endsnippet
|
endsnippet
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# TextMate Snippets #
|
# TextMate Snippets #
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
## Snippets from SnipMate, taken from
|
## Snippets from SnipMate, taken from
|
||||||
## https://github.com/scrooloose/snipmate-snippets.git
|
## https://github.com/scrooloose/snipmate-snippets.git
|
||||||
|
|
||||||
@ -93,7 +95,7 @@ snippet var "var"
|
|||||||
var_export(${1});${2}
|
var_export(${1});${2}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet getter "PHP Class Getter" !b
|
snippet getter "PHP Class Getter" b
|
||||||
/*
|
/*
|
||||||
* Getter for $1
|
* Getter for $1
|
||||||
*/
|
*/
|
||||||
@ -104,7 +106,7 @@ public function get${1/\w+\s*/\u$0/}()
|
|||||||
$4
|
$4
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet setter "PHP Class Setter" !b
|
snippet setter "PHP Class Setter" b
|
||||||
/*
|
/*
|
||||||
* Setter for $1
|
* Setter for $1
|
||||||
*/
|
*/
|
||||||
@ -116,7 +118,7 @@ public function set${1/\w+\s*/\u$0/}($$1)
|
|||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet gs "PHP Class Getter Setter" !b
|
snippet gs "PHP Class Getter Setter" b
|
||||||
/*
|
/*
|
||||||
* Getter for ${1/(\w+)\s*;/$1/}
|
* Getter for ${1/(\w+)\s*;/$1/}
|
||||||
*/
|
*/
|
||||||
@ -136,7 +138,7 @@ public function set${1/(\w+)\s*;/\u$1/}($${1/(\w+)\s*;/$1/})
|
|||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet pub "Public function" !b
|
snippet pub "Public function" b
|
||||||
public function ${1:name}(${2:$param})
|
public function ${1:name}(${2:$param})
|
||||||
{
|
{
|
||||||
${VISUAL}${3:return null;}
|
${VISUAL}${3:return null;}
|
||||||
@ -144,7 +146,7 @@ public function ${1:name}(${2:$param})
|
|||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet pro "Protected function" !b
|
snippet pro "Protected function" b
|
||||||
protected function ${1:name}(${2:$param})
|
protected function ${1:name}(${2:$param})
|
||||||
{
|
{
|
||||||
${VISUAL}${3:return null;}
|
${VISUAL}${3:return null;}
|
||||||
@ -152,7 +154,7 @@ protected function ${1:name}(${2:$param})
|
|||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet pri "Private function" !b
|
snippet pri "Private function" b
|
||||||
private function ${1:name}(${2:$param})
|
private function ${1:name}(${2:$param})
|
||||||
{
|
{
|
||||||
${VISUAL}${3:return null;}
|
${VISUAL}${3:return null;}
|
||||||
@ -160,7 +162,7 @@ private function ${1:name}(${2:$param})
|
|||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet pubs "Public static function" !b
|
snippet pubs "Public static function" b
|
||||||
public static function ${1:name}(${2:$param})
|
public static function ${1:name}(${2:$param})
|
||||||
{
|
{
|
||||||
${VISUAL}${3:return null;}
|
${VISUAL}${3:return null;}
|
||||||
@ -168,7 +170,7 @@ public static function ${1:name}(${2:$param})
|
|||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet pros "Protected static function" !b
|
snippet pros "Protected static function" b
|
||||||
protected static function ${1:name}(${2:$param})
|
protected static function ${1:name}(${2:$param})
|
||||||
{
|
{
|
||||||
${VISUAL}${3:return null;}
|
${VISUAL}${3:return null;}
|
||||||
@ -176,7 +178,7 @@ protected static function ${1:name}(${2:$param})
|
|||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet pris "Private static function" !b
|
snippet pris "Private static function" b
|
||||||
private static function ${1:name}(${2:$param})
|
private static function ${1:name}(${2:$param})
|
||||||
{
|
{
|
||||||
${VISUAL}${3:return null;}
|
${VISUAL}${3:return null;}
|
||||||
@ -184,7 +186,7 @@ private static function ${1:name}(${2:$param})
|
|||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet fu "Function snip" !b
|
snippet fu "Function snip" b
|
||||||
function ${1:name}(${2:$param})
|
function ${1:name}(${2:$param})
|
||||||
{
|
{
|
||||||
${VISUAL}${3:return null;}
|
${VISUAL}${3:return null;}
|
||||||
@ -199,7 +201,7 @@ foreach ($${1:variable} as $${3:value}){
|
|||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet new "New class instance" !b
|
snippet new "New class instance" b
|
||||||
$$1 = new $1($2);
|
$$1 = new $1($2);
|
||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
@ -213,7 +215,7 @@ if (${1:/* condition */}) {
|
|||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet class "Class declaration template" !b
|
snippet class "Class declaration template" b
|
||||||
/**
|
/**
|
||||||
* Class ${1:`!p snip.rv=snip.fn.split('.')[0]`}
|
* Class ${1:`!p snip.rv=snip.fn.split('.')[0]`}
|
||||||
* @author ${2:`!v g:snips_author`}
|
* @author ${2:`!v g:snips_author`}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Snippets for Puppet
|
priority -50
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# Python helper code #
|
# Python helper code #
|
||||||
@ -129,23 +129,23 @@ endsnippet
|
|||||||
# See http://docs.puppetlabs.com/references/latest/function.html #
|
# See http://docs.puppetlabs.com/references/latest/function.html #
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
snippet alert "Alert Function" !b
|
snippet alert "Alert Function" b
|
||||||
alert("${1:message}")${0}
|
alert("${1:message}")${0}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet crit "Crit Function" !b
|
snippet crit "Crit Function" b
|
||||||
crit("${1:message}")${0}
|
crit("${1:message}")${0}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet debug "Debug Function" !b
|
snippet debug "Debug Function" b
|
||||||
debug("${1:message}")${0}
|
debug("${1:message}")${0}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet defined "Defined Function" !b
|
snippet defined "Defined Function" b
|
||||||
defined(${1:Resource}["${2:name}"])${0}
|
defined(${1:Resource}["${2:name}"])${0}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet emerg "Emerg Function" !b
|
snippet emerg "Emerg Function" b
|
||||||
emerg("${1:message}")${0}
|
emerg("${1:message}")${0}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ snippet extlookup "Extlookup with defaults and custom data file" b
|
|||||||
$${1:Variable} = extlookup("${2:Lookup}", ${3:Default}, ${4:Data Source})${0}
|
$${1:Variable} = extlookup("${2:Lookup}", ${3:Default}, ${4:Data Source})${0}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet fail "Fail Function" !b
|
snippet fail "Fail Function" b
|
||||||
fail("${1:message}")${0}
|
fail("${1:message}")${0}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
@ -193,39 +193,39 @@ snippet hiera_include "Hiera Include Function" b
|
|||||||
hiera_include("${1:Lookup}")${0}
|
hiera_include("${1:Lookup}")${0}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet include "Include Function" !b
|
snippet include "Include Function" b
|
||||||
include ${1:classname}${0}
|
include ${1:classname}${0}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet info "Info Function" !b
|
snippet info "Info Function" b
|
||||||
info("${1:message}")${0}
|
info("${1:message}")${0}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet inline_template "Inline Template Function" !b
|
snippet inline_template "Inline Template Function" b
|
||||||
inline_template("<%= ${1:template} %>")${0}
|
inline_template("<%= ${1:template} %>")${0}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet notice "Notice Function" !b
|
snippet notice "Notice Function" b
|
||||||
notice("${1:message}")${0}
|
notice("${1:message}")${0}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet realize "Realize Function" !b
|
snippet realize "Realize Function" b
|
||||||
realize(${1:Resource}["${2:name}"])${0}
|
realize(${1:Resource}["${2:name}"])${0}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet regsubst "Regsubst Function" !b
|
snippet regsubst "Regsubst Function" b
|
||||||
regsubst($${1:Target}, '${2:regexp}', '${3:replacement}')${0}
|
regsubst($${1:Target}, '${2:regexp}', '${3:replacement}')${0}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet split "Split Function" !b
|
snippet split "Split Function" b
|
||||||
$${1:Variable} = split($${1:Target}, '${2:regexp}')${0}
|
$${1:Variable} = split($${1:Target}, '${2:regexp}')${0}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet versioncmp "Version Compare Function" !b
|
snippet versioncmp "Version Compare Function" b
|
||||||
$${1:Variable} = versioncmp('${1:version}', '${2:version}')${0}
|
$${1:Variable} = versioncmp('${1:version}', '${2:version}')${0}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet warning "Warning Function" !b
|
snippet warning "Warning Function" b
|
||||||
warning("${1:message}")${0}
|
warning("${1:message}")${0}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# TEXTMATE SNIPPETS #
|
# TEXTMATE SNIPPETS #
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
###########################################################################
|
priority -50
|
||||||
# GENERATED FROM get_tm_snippets.py #
|
|
||||||
###########################################################################
|
|
||||||
|
|
||||||
snippet anaf "accepts_nested_attributes_for"
|
snippet anaf "accepts_nested_attributes_for"
|
||||||
accepts_nested_attributes_for :${1:association_name}${2:${3:, :allow_destroy => true}${4:, :reject_if => proc \{ |obj| ${5:obj.blank?} \}}}
|
accepts_nested_attributes_for :${1:association_name}${2:${3:, :allow_destroy => true}${4:, :reject_if => proc \{ |obj| ${5:obj.blank?} \}}}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# General Stuff #
|
# General Stuff #
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
snippet "^#!" "#!/usr/bin/env ruby" r
|
snippet "^#!" "#!/usr/bin/env ruby" r
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
$0
|
$0
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
snippet /@?imp/ "@import '...';" br
|
snippet /@?imp/ "@import '...';" br
|
||||||
@import '${1:file}';
|
@import '${1:file}';
|
||||||
endsnippet
|
endsnippet
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
global !p
|
global !p
|
||||||
import vim
|
import vim
|
||||||
|
|
||||||
|
@ -1,16 +1,14 @@
|
|||||||
#########################
|
priority -50
|
||||||
# SNIPPETS for SNIPPETS #
|
|
||||||
#########################
|
|
||||||
|
|
||||||
# We use a little hack so that the snippet is expanded
|
# We use a little hack so that the snippet is expanded
|
||||||
# and parsed correctly
|
# and parsed correctly
|
||||||
snippet snip "Snippet definition" !
|
snippet snip "Snippet definition" b
|
||||||
`!p snip.rv = "snippet"` ${1:Tab_trigger} "${2:Description}" ${3:!b}
|
`!p snip.rv = "snippet"` ${1:Tab_trigger} "${2:Description}" ${3:b}
|
||||||
$0
|
$0
|
||||||
`!p snip.rv = "endsnippet"`
|
`!p snip.rv = "endsnippet"`
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet global "Global snippet" !
|
snippet global "Global snippet" b
|
||||||
`!p snip.rv = "global"` !p
|
`!p snip.rv = "global"` !p
|
||||||
$0
|
$0
|
||||||
`!p snip.rv = "endglobal"`
|
`!p snip.rv = "endglobal"`
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# TEXTMATE SNIPPETS #
|
# TEXTMATE SNIPPETS #
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
extends texmath
|
extends texmath
|
||||||
|
|
||||||
snippet "b(egin)?" "begin{} / end{}" br
|
snippet "b(egin)?" "begin{} / end{}" br
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
##############
|
##############
|
||||||
# MATH STUFF #
|
# MATH STUFF #
|
||||||
##############
|
##############
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# SnipMate Snippets #
|
# SnipMate Snippets #
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
@ -1 +1,3 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
extends html
|
extends html
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
snippet xml "XML declaration" b
|
snippet xml "XML declaration" b
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
|
priority -50
|
||||||
|
|
||||||
extends sh
|
extends sh
|
||||||
|
|
||||||
snippet #! "shebang" !
|
priority -49
|
||||||
|
|
||||||
|
snippet #! "shebang" b
|
||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet !env "#!/usr/bin/env (!env)" !
|
snippet !env "#!/usr/bin/env (!env)" b
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
@ -130,9 +130,10 @@ function! UltiSnips#FileTypeChanged()
|
|||||||
return ""
|
return ""
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! UltiSnips#AddSnippet(trigger, value, description, options, ...)
|
function! UltiSnips#AddSnippet(trigger, value, description, options, ...)
|
||||||
" Takes the same arguments as SnippetManager.add_snippet:
|
" Takes the same arguments as SnippetManager.add_snippet.
|
||||||
" (trigger, value, description, options, ft = "all", globals = None)
|
echoerr "Deprecated UltiSnips#AddSnippet called. Please use UltiSnips#AddSnippetWithPriority." | sleep 1
|
||||||
exec g:_uspy "args = vim.eval(\"a:000\")"
|
exec g:_uspy "args = vim.eval(\"a:000\")"
|
||||||
exec g:_uspy "trigger = vim.eval(\"a:trigger\")"
|
exec g:_uspy "trigger = vim.eval(\"a:trigger\")"
|
||||||
exec g:_uspy "value = vim.eval(\"a:value\")"
|
exec g:_uspy "value = vim.eval(\"a:value\")"
|
||||||
@ -142,9 +143,20 @@ function! UltiSnips#AddSnippet(trigger, value, description, options, ...)
|
|||||||
return ""
|
return ""
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! UltiSnips#AddSnippetWithPriority(trigger, value, description, options, filetype, priority)
|
||||||
|
exec g:_uspy "trigger = vim.eval(\"a:trigger\")"
|
||||||
|
exec g:_uspy "value = vim.eval(\"a:value\")"
|
||||||
|
exec g:_uspy "description = vim.eval(\"a:description\")"
|
||||||
|
exec g:_uspy "options = vim.eval(\"a:options\")"
|
||||||
|
exec g:_uspy "filetype = vim.eval(\"a:filetype\")"
|
||||||
|
exec g:_uspy "priority = vim.eval(\"a:priority\")"
|
||||||
|
exec g:_uspy "UltiSnips_Manager.add_snippet(trigger, value, description, options, filetype, priority)"
|
||||||
|
return ""
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! UltiSnips#Anon(value, ...)
|
function! UltiSnips#Anon(value, ...)
|
||||||
" Takes the same arguments as SnippetManager.expand_anon:
|
" Takes the same arguments as SnippetManager.expand_anon:
|
||||||
" (value, trigger="", description="", options="", globals = None)
|
" (value, trigger="", description="", options="")
|
||||||
exec g:_uspy "args = vim.eval(\"a:000\")"
|
exec g:_uspy "args = vim.eval(\"a:000\")"
|
||||||
exec g:_uspy "value = vim.eval(\"a:value\")"
|
exec g:_uspy "value = vim.eval(\"a:value\")"
|
||||||
exec g:_uspy "UltiSnips_Manager.expand_anon(value, *args)"
|
exec g:_uspy "UltiSnips_Manager.expand_anon(value, *args)"
|
||||||
|
@ -16,7 +16,7 @@ UltiSnips *snippet* *snippets* *UltiSnips*
|
|||||||
3.3 Snippet Search Path |UltiSnips-snippet-search-path|
|
3.3 Snippet Search Path |UltiSnips-snippet-search-path|
|
||||||
3.4 Warning About Select Mode Mappings |UltiSnips-warning-smappings|
|
3.4 Warning About Select Mode Mappings |UltiSnips-warning-smappings|
|
||||||
3.5 Functions |UltiSnips-functions|
|
3.5 Functions |UltiSnips-functions|
|
||||||
3.5.1 UltiSnips#AddSnippet |UltiSnips#AddSnippet|
|
3.5.1 UltiSnips#AddSnippetWithPriority |UltiSnips#AddSnippetWithPriority|
|
||||||
3.5.2 UltiSnips#Anon |UltiSnips#Anon|
|
3.5.2 UltiSnips#Anon |UltiSnips#Anon|
|
||||||
3.5.3 UltiSnips#SnippetsInCurrentScope |UltiSnips#SnippetsInCurrentScope|
|
3.5.3 UltiSnips#SnippetsInCurrentScope |UltiSnips#SnippetsInCurrentScope|
|
||||||
3.6 Missing python support |UltiSnips-python-warning|
|
3.6 Missing python support |UltiSnips-python-warning|
|
||||||
@ -373,13 +373,14 @@ complete definition as listed by the |:smap| command. >
|
|||||||
UltiSnips provides some functions for extending core functionality.
|
UltiSnips provides some functions for extending core functionality.
|
||||||
|
|
||||||
|
|
||||||
3.5.1 UltiSnips#AddSnippet *UltiSnips#AddSnippet*
|
3.5.1 UltiSnips#AddSnippetWithPriority *UltiSnips#AddSnippetWithPriority*
|
||||||
|
|
||||||
The first function is UltiSnips#AddSnippet(trigger, value, description,
|
The first function is UltiSnips#AddSnippetWithPriority(trigger, value, description,
|
||||||
options, filetyp="all"). It adds a new snippet with the provided trigger, value,
|
options, filetyp, priority). It adds a new snippet with the provided trigger, value,
|
||||||
description, and options to the current list of snippets. See
|
description, and options to the current list of snippets. See
|
||||||
|UltiSnips-syntax| for details on the meaning of the function arguments. All
|
|UltiSnips-syntax| for details on the meaning of the function arguments. The
|
||||||
arguments are strings.
|
Priority is a number that defines which snippet should be preferred over
|
||||||
|
others. See the priority keyword in|UltiSnips-add-snippets|.
|
||||||
|
|
||||||
|
|
||||||
3.5.2 UltiSnips#Anon *UltiSnips#Anon*
|
3.5.2 UltiSnips#Anon *UltiSnips#Anon*
|
||||||
@ -390,9 +391,9 @@ discarded again. Anonymous snippets are not added to the global list of
|
|||||||
snippets, so they cannot be expanded a second time unless the function is
|
snippets, so they cannot be expanded a second time unless the function is
|
||||||
called again. The function takes three optional arguments, in order: trigger,
|
called again. The function takes three optional arguments, in order: trigger,
|
||||||
description, options. Arguments coincide with the arguments of the
|
description, options. Arguments coincide with the arguments of the
|
||||||
|UltiSnips#AddSnippet| function of the same name. The trigger and options
|
|UltiSnips#AddSnippetWithPriority| function of the same name. The trigger and
|
||||||
arguments can change the way the snippet expands. The description is unused at
|
options arguments can change the way the snippet expands. The description is
|
||||||
this point.
|
unused at this point.
|
||||||
|
|
||||||
An example use case might be this line from a reStructuredText plugin file:
|
An example use case might be this line from a reStructuredText plugin file:
|
||||||
|
|
||||||
@ -504,14 +505,13 @@ a dotted filetype for the CUDA C++ framework, e.g. ":set ft=cuda.cpp", then
|
|||||||
UltiSnips will search for and activate snippets for both the cuda and cpp
|
UltiSnips will search for and activate snippets for both the cuda and cpp
|
||||||
filetypes.
|
filetypes.
|
||||||
|
|
||||||
UltiSnips doesn't understand multiple filetypes in snippet filenames, so a
|
The snippets file syntax is simple. All lines starting with a # character are
|
||||||
snippet file named "cuda.cpp.snippets" won't match the "cuda" or "cpp"
|
considered comments. Comments are ignored by UltiSnips. Use them to document
|
||||||
filetypes, which means it won't be activated for files with the dotted
|
snippets.
|
||||||
filetype "cuda.cpp" either.
|
|
||||||
|
|
||||||
The extends directive provides an alternative way of combining snippet files.
|
A line beginning with the keyword 'extends' provides a way of combining
|
||||||
When the extends directive is included in a snippet file, it instructs
|
snippet files. When the 'extends' directive is included in a snippet file, it
|
||||||
UltiSnips to include all snippets from the indicated filetypes.
|
instructs UltiSnips to include all snippets from the indicated filetypes.
|
||||||
|
|
||||||
The syntax looks like this: >
|
The syntax looks like this: >
|
||||||
extends ft1, ft2, ft3
|
extends ft1, ft2, ft3
|
||||||
@ -520,12 +520,17 @@ For example, the first line in cpp.snippets looks like this: >
|
|||||||
extends c
|
extends c
|
||||||
When UltiSnips activates snippets for a cpp file, it first looks for all c
|
When UltiSnips activates snippets for a cpp file, it first looks for all c
|
||||||
snippets and activates them as well. This is a convenient way to create
|
snippets and activates them as well. This is a convenient way to create
|
||||||
specialized snippet files from more general ones. Multiple "extends" lines are
|
specialized snippet files from more general ones. Multiple 'extends' lines are
|
||||||
permitted in a snippet file, and they can be included anywhere in the file.
|
permitted in a snippet file, and they can be included anywhere in the file.
|
||||||
|
|
||||||
The snippets file syntax is simple. All lines starting with a # character are
|
|
||||||
considered comments. Comments are ignored by UltiSnips. Use them to document
|
A line beginning with the keyword 'priority' sets the priority for all
|
||||||
snippets.
|
snippets defined in the current file after this line. The default priority for
|
||||||
|
a file is always 0. When a snippet should be expanded, UltiSnips will collect
|
||||||
|
all snippet definitons from all sources that match the trigger and keep only
|
||||||
|
the ones with the highest priority. For example, all shipped snippets have a
|
||||||
|
priority < 0, so that user defined snippets always overwrite shipped snippets.
|
||||||
|
|
||||||
|
|
||||||
A line beginning with the keyword 'snippet' marks the beginning of snippet
|
A line beginning with the keyword 'snippet' marks the beginning of snippet
|
||||||
definition and a line starting with the keyword 'endsnippet' marks the end.
|
definition and a line starting with the keyword 'endsnippet' marks the end.
|
||||||
@ -575,15 +580,6 @@ single characters. The 'options' characters for a snippet are combined into
|
|||||||
a word without spaces.
|
a word without spaces.
|
||||||
|
|
||||||
The options currently supported are: >
|
The options currently supported are: >
|
||||||
! Overwrite - A snippet with this option will overwrite all previously
|
|
||||||
defined snippets with an identical tab trigger. What previously means
|
|
||||||
in this context depends on the order UltiSnips traverses the
|
|
||||||
'runtimepath'. (Compare g:UltiSnipsDontReverseSearchPath). This might
|
|
||||||
depend on your installation type (Pathogen, Bzr, Vundle). The default
|
|
||||||
behavior is to display list of snippets matching the tab trigger and
|
|
||||||
let the user pick the one they want. Use this option to overwrite
|
|
||||||
bundled snippets with user defined ones.
|
|
||||||
|
|
||||||
b Beginning of line - A snippet with this option is expanded only if the
|
b Beginning of line - A snippet with this option is expanded only if the
|
||||||
tab trigger is the first word on the line. In other words, if only
|
tab trigger is the first word on the line. In other words, if only
|
||||||
whitespace precedes the tab trigger, expand. The default is to expand
|
whitespace precedes the tab trigger, expand. The default is to expand
|
||||||
|
@ -43,7 +43,7 @@ function! UltiSnips_JumpForwards()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! UltiSnips_AddSnippet(...)
|
function! UltiSnips_AddSnippet(...)
|
||||||
echoerr "Deprecated UltiSnips_AddSnippet called. Please use UltiSnips#AddSnippet." | sleep 1
|
echoerr "Deprecated UltiSnips_AddSnippet called. Please use UltiSnips#AddSnippetWithPriority." | sleep 1
|
||||||
return call(function('UltiSnips#AddSnippet'), a:000)
|
return call(function('UltiSnips#AddSnippet'), a:000)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -20,23 +20,7 @@ class SnippetProvider(object):
|
|||||||
found_snippets = []
|
found_snippets = []
|
||||||
for ft in filetypes:
|
for ft in filetypes:
|
||||||
found_snippets += self._find_snippets(ft, before, possible)
|
found_snippets += self._find_snippets(ft, before, possible)
|
||||||
|
return found_snippets
|
||||||
# Search if any of the snippets overwrites the previous
|
|
||||||
# Dictionary allows O(1) access for easy overwrites
|
|
||||||
snippets = {}
|
|
||||||
for snip in found_snippets:
|
|
||||||
if (snip.trigger not in snippets) or snip.overwrites_previous:
|
|
||||||
snippets[snip.trigger] = []
|
|
||||||
snippets[snip.trigger].append(snip)
|
|
||||||
|
|
||||||
# Transform dictionary into flat list of snippets
|
|
||||||
selected_snippets = set(
|
|
||||||
[item for sublist in snippets.values() for item in sublist])
|
|
||||||
# Return snippets to their original order
|
|
||||||
snippets = [snip for snip in found_snippets if
|
|
||||||
snip in selected_snippets]
|
|
||||||
|
|
||||||
return snippets
|
|
||||||
|
|
||||||
def _find_snippets(self, ft, trigger, potentially=False, seen=None):
|
def _find_snippets(self, ft, trigger, potentially=False, seen=None):
|
||||||
"""Find snippets matching 'trigger' for 'ft'. If 'potentially' is True,
|
"""Find snippets matching 'trigger' for 'ft'. If 'potentially' is True,
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
"""Handles manually added snippets through UltiSnips#AddSnippet or
|
"""Handles manually added snippets UltiSnips_Manager.add_snippet()."""
|
||||||
UltiSnips_Manager.add_snippet()."""
|
|
||||||
|
|
||||||
from UltiSnips.providers._base import SnippetProvider
|
from UltiSnips.providers._base import SnippetProvider
|
||||||
|
|
||||||
|
@ -148,6 +148,7 @@ class UltiSnipsFileProvider(SnippetProvider):
|
|||||||
def _parse_snippets(self, ft, filename):
|
def _parse_snippets(self, ft, filename):
|
||||||
"""Parse the file 'filename' for the given 'ft' and watch it for
|
"""Parse the file 'filename' for the given 'ft' and watch it for
|
||||||
changes in the future. 'file_data' can be injected in tests."""
|
changes in the future. 'file_data' can be injected in tests."""
|
||||||
|
current_snippet_priority = 0
|
||||||
self._snippets[ft].addfile(filename)
|
self._snippets[ft].addfile(filename)
|
||||||
file_data = open(filename, "r").read()
|
file_data = open(filename, "r").read()
|
||||||
for event, data in parse_snippets_file(file_data):
|
for event, data in parse_snippets_file(file_data):
|
||||||
@ -167,11 +168,14 @@ class UltiSnipsFileProvider(SnippetProvider):
|
|||||||
filetypes, = data
|
filetypes, = data
|
||||||
self._add_extending_info(ft, filetypes)
|
self._add_extending_info(ft, filetypes)
|
||||||
elif event == "snippet":
|
elif event == "snippet":
|
||||||
trigger, value, description, options, globals = data
|
trigger, value, description, options, global_pythons = data
|
||||||
self._snippets[ft].add_snippet(
|
self._snippets[ft].add_snippet(
|
||||||
SnippetDefinition(trigger, value, description, options,
|
SnippetDefinition(current_snippet_priority, trigger, value,
|
||||||
globals), filename
|
description, options, global_pythons), filename
|
||||||
)
|
)
|
||||||
|
elif event == "priority":
|
||||||
|
priority, = data
|
||||||
|
current_snippet_priority = priority
|
||||||
else:
|
else:
|
||||||
assert False, "Unhandled %s: %r" % (event, data)
|
assert False, "Unhandled %s: %r" % (event, data)
|
||||||
|
|
||||||
|
@ -115,5 +115,11 @@ def parse_snippets_file(data):
|
|||||||
yield snippet
|
yield snippet
|
||||||
elif head == "clearsnippets":
|
elif head == "clearsnippets":
|
||||||
yield "clearsnippets", (tail.split(),)
|
yield "clearsnippets", (tail.split(),)
|
||||||
|
elif head == "priority":
|
||||||
|
try:
|
||||||
|
priority = int(tail.split()[0])
|
||||||
|
yield "priority", (priority,)
|
||||||
|
except (ValueError, IndexError):
|
||||||
|
yield "error", ("Invalid priority %r" % tail, lines.line_index)
|
||||||
elif head and not head.startswith('#'):
|
elif head and not head.startswith('#'):
|
||||||
yield "error", ("Invalid line %r" % line.rstrip(), lines.line_index)
|
yield "error", ("Invalid line %r" % line.rstrip(), lines.line_index)
|
||||||
|
@ -39,7 +39,8 @@ class SnippetDefinition(object):
|
|||||||
_INDENT = re.compile(r"^[ \t]*")
|
_INDENT = re.compile(r"^[ \t]*")
|
||||||
_TABS = re.compile(r"^\t*")
|
_TABS = re.compile(r"^\t*")
|
||||||
|
|
||||||
def __init__(self, trigger, value, description, options, globals):
|
def __init__(self, priority, trigger, value, description, options, globals):
|
||||||
|
self._priority = priority
|
||||||
self._trigger = as_unicode(trigger)
|
self._trigger = as_unicode(trigger)
|
||||||
self._value = as_unicode(value)
|
self._value = as_unicode(value)
|
||||||
self._description = as_unicode(description)
|
self._description = as_unicode(description)
|
||||||
@ -49,8 +50,8 @@ class SnippetDefinition(object):
|
|||||||
self._globals = globals
|
self._globals = globals
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "SnippetDefinition(%s,%s,%s)" % (
|
return "SnippetDefinition(%r,%s,%s,%s)" % (
|
||||||
self._trigger, self._description, self._opts)
|
self._priority, self._trigger, self._description, self._opts)
|
||||||
|
|
||||||
def _re_match(self, trigger):
|
def _re_match(self, trigger):
|
||||||
""" Test if a the current regex trigger matches
|
""" Test if a the current regex trigger matches
|
||||||
@ -160,16 +161,17 @@ class SnippetDefinition(object):
|
|||||||
|
|
||||||
return match
|
return match
|
||||||
|
|
||||||
@property
|
|
||||||
def overwrites_previous(self):
|
|
||||||
"""Does this snippet overwrite previous with the same trigger?"""
|
|
||||||
return "!" in self._opts
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def description(self):
|
def description(self):
|
||||||
"""Descriptive text for this snippet."""
|
"""Descriptive text for this snippet."""
|
||||||
return ("(%s) %s" % (self._trigger, self._description)).strip()
|
return ("(%s) %s" % (self._trigger, self._description)).strip()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def priority(self):
|
||||||
|
"""The snippets priority, which defines which snippet will be preferred
|
||||||
|
over others with the same trigger."""
|
||||||
|
return self._priority
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def trigger(self):
|
def trigger(self):
|
||||||
"""The trigger text for the snippet."""
|
"""The trigger text for the snippet."""
|
||||||
|
@ -169,21 +169,17 @@ class SnippetManager(object):
|
|||||||
|
|
||||||
@err_to_scratch_buffer
|
@err_to_scratch_buffer
|
||||||
def add_snippet(self, trigger, value, description,
|
def add_snippet(self, trigger, value, description,
|
||||||
options, ft="all", globals=None):
|
options, ft="all", priority=0):
|
||||||
"""Add a snippet to the list of known snippets of the given 'ft'."""
|
"""Add a snippet to the list of known snippets of the given 'ft'."""
|
||||||
self._added_snippets_provider.add_snippet(ft, SnippetDefinition(
|
self._added_snippets_provider.add_snippet(ft, SnippetDefinition(
|
||||||
trigger, value, description, options, globals or {})
|
priority, trigger, value, description, options, {})
|
||||||
)
|
)
|
||||||
|
|
||||||
@err_to_scratch_buffer
|
@err_to_scratch_buffer
|
||||||
def expand_anon(self, value, trigger="", description="",
|
def expand_anon(self, value, trigger="", description="", options=""):
|
||||||
options="", globals=None):
|
|
||||||
"""Expand an anonymous snippet right here."""
|
"""Expand an anonymous snippet right here."""
|
||||||
if globals is None:
|
|
||||||
globals = {}
|
|
||||||
|
|
||||||
before = _vim.buf.line_till_cursor
|
before = _vim.buf.line_till_cursor
|
||||||
snip = SnippetDefinition(trigger, value, description, options, globals)
|
snip = SnippetDefinition(0, trigger, value, description, options, {})
|
||||||
|
|
||||||
if not trigger or snip.matches(before):
|
if not trigger or snip.matches(before):
|
||||||
self._do_snippet(snip, before)
|
self._do_snippet(snip, before)
|
||||||
@ -403,7 +399,12 @@ class SnippetManager(object):
|
|||||||
snippets = []
|
snippets = []
|
||||||
for provider in self._snippet_providers:
|
for provider in self._snippet_providers:
|
||||||
snippets.extend(provider.get_snippets(filetypes, before, possible))
|
snippets.extend(provider.get_snippets(filetypes, before, possible))
|
||||||
return snippets
|
if not snippets:
|
||||||
|
return []
|
||||||
|
|
||||||
|
# Only keep the snippets with the highest priority.
|
||||||
|
highest_priority = max(snip.priority for snip in snippets)
|
||||||
|
return [s for s in snippets if s.priority == highest_priority]
|
||||||
|
|
||||||
def _do_snippet(self, snippet, before):
|
def _do_snippet(self, snippet, before):
|
||||||
"""Expands the given snippet, and handles everything
|
"""Expands the given snippet, and handles everything
|
||||||
|
@ -17,7 +17,7 @@ syn match snipString '"[^"]*"'
|
|||||||
syn match snipTabsOnly "^\t\+$"
|
syn match snipTabsOnly "^\t\+$"
|
||||||
syn match snipLeadingSpaces "^\t* \+"
|
syn match snipLeadingSpaces "^\t* \+"
|
||||||
|
|
||||||
syn match snipKeyword "\(\<\(end\)\?\(snippet\|global\)\>\)\|extends\|clearsnippets" contained
|
syn match snipKeyword "\(\<\(end\)\?\(snippet\|global\)\>\)\|extends\|clearsnippets\|priority" contained
|
||||||
|
|
||||||
" extends definitions
|
" extends definitions
|
||||||
syn match snipExtends "^extends.*" contains=snipKeyword
|
syn match snipExtends "^extends.*" contains=snipKeyword
|
||||||
@ -40,6 +40,7 @@ syn region snipGlobal fold keepend start="^global" end="^endglobal" contains=sni
|
|||||||
|
|
||||||
" snippet clearing
|
" snippet clearing
|
||||||
syn match snipClear "^clearsnippets"
|
syn match snipClear "^clearsnippets"
|
||||||
|
syn match snipPriority "^priority"
|
||||||
|
|
||||||
" highlighting rules
|
" highlighting rules
|
||||||
|
|
||||||
@ -66,5 +67,6 @@ hi link snipGlobalEnd Statement
|
|||||||
hi link snipGlobal Normal
|
hi link snipGlobal Normal
|
||||||
|
|
||||||
hi link snipClear Statement
|
hi link snipClear Statement
|
||||||
|
hi link snipPriority Statement
|
||||||
|
|
||||||
let b:current_syntax = "snippet"
|
let b:current_syntax = "snippet"
|
||||||
|
108
test.py
108
test.py
@ -330,13 +330,16 @@ class _VimTest(unittest.TestCase):
|
|||||||
sv, content = s[:2]
|
sv, content = s[:2]
|
||||||
description = ""
|
description = ""
|
||||||
options = ""
|
options = ""
|
||||||
|
priority = 0
|
||||||
if len(s) > 2:
|
if len(s) > 2:
|
||||||
description = s[2]
|
description = s[2]
|
||||||
if len(s) > 3:
|
if len(s) > 3:
|
||||||
options = s[3]
|
options = s[3]
|
||||||
|
if len(s) > 4:
|
||||||
|
priority = s[4]
|
||||||
|
|
||||||
self.send_py("UltiSnips_Manager.add_snippet(%r, %r, %r, %r)" %
|
self.send_py("UltiSnips_Manager.add_snippet(%r, %r, %r, %r, priority=%i)" %
|
||||||
(sv, content, description, options))
|
(sv, content, description, options, priority))
|
||||||
|
|
||||||
ft, file_data = self.snippets_test_file
|
ft, file_data = self.snippets_test_file
|
||||||
self._temporary_directory = ""
|
self._temporary_directory = ""
|
||||||
@ -403,6 +406,22 @@ class ParseSnippets_UnknownDirective(_VimTest):
|
|||||||
wanted = "testsnip" + EX
|
wanted = "testsnip" + EX
|
||||||
expected_error = r"Invalid line 'unknown directive' in \S+:2"
|
expected_error = r"Invalid line 'unknown directive' in \S+:2"
|
||||||
|
|
||||||
|
class ParseSnippets_InvalidPriorityLine(_VimTest):
|
||||||
|
snippets_test_file = ("all", r"""
|
||||||
|
priority - 50
|
||||||
|
""")
|
||||||
|
keys = "testsnip" + EX
|
||||||
|
wanted = "testsnip" + EX
|
||||||
|
expected_error = r"Invalid priority '- 50' in \S+:2"
|
||||||
|
|
||||||
|
class ParseSnippets_InvalidPriorityLine1(_VimTest):
|
||||||
|
snippets_test_file = ("all", r"""
|
||||||
|
priority
|
||||||
|
""")
|
||||||
|
keys = "testsnip" + EX
|
||||||
|
wanted = "testsnip" + EX
|
||||||
|
expected_error = r"Invalid priority '' in \S+:2"
|
||||||
|
|
||||||
class ParseSnippets_ExtendsWithoutFiletype(_VimTest):
|
class ParseSnippets_ExtendsWithoutFiletype(_VimTest):
|
||||||
snippets_test_file = ("all", r"""
|
snippets_test_file = ("all", r"""
|
||||||
extends
|
extends
|
||||||
@ -2034,33 +2053,86 @@ class Multiple_ManySnippetsOneTrigger_ECR(_VimTest):
|
|||||||
keys = "test" + EX + " " + ESC + ESC + "ahi"
|
keys = "test" + EX + " " + ESC + ESC + "ahi"
|
||||||
wanted = "testhi"
|
wanted = "testhi"
|
||||||
# End: Selecting Between Same Triggers #}}}
|
# End: Selecting Between Same Triggers #}}}
|
||||||
# Snippet Options {{{#
|
# Snippet Priority {{{#
|
||||||
class SnippetOptions_OverwriteExisting_ECR(_VimTest):
|
class SnippetPriorities_MultiWordTriggerOverwriteExisting(_VimTest):
|
||||||
|
snippets = (
|
||||||
|
("test me", "${1:Hallo}", "Types Hallo"),
|
||||||
|
("test me", "${1:World}", "Types World"),
|
||||||
|
("test me", "We overwrite", "Overwrite the two", "", 1),
|
||||||
|
)
|
||||||
|
keys = "test me" + EX
|
||||||
|
wanted = "We overwrite"
|
||||||
|
class SnippetPriorities_DoNotCareAboutNonMatchings(_VimTest):
|
||||||
|
snippets = (
|
||||||
|
("test1", "Hallo", "Types Hallo"),
|
||||||
|
("test2", "We overwrite", "Overwrite the two", "", 1),
|
||||||
|
)
|
||||||
|
keys = "test1" + EX
|
||||||
|
wanted = "Hallo"
|
||||||
|
class SnippetPriorities_OverwriteExisting(_VimTest):
|
||||||
snippets = (
|
snippets = (
|
||||||
("test", "${1:Hallo}", "Types Hallo"),
|
("test", "${1:Hallo}", "Types Hallo"),
|
||||||
("test", "${1:World}", "Types World"),
|
("test", "${1:World}", "Types World"),
|
||||||
("test", "We overwrite", "Overwrite the two", "!"),
|
("test", "We overwrite", "Overwrite the two", "", 1),
|
||||||
)
|
)
|
||||||
keys = "test" + EX
|
keys = "test" + EX
|
||||||
wanted = "We overwrite"
|
wanted = "We overwrite"
|
||||||
class SnippetOptions_OverwriteTwice_ECR(_VimTest):
|
class SnippetPriorities_OverwriteTwice_ECR(_VimTest):
|
||||||
snippets = (
|
snippets = (
|
||||||
("test", "${1:Hallo}", "Types Hallo"),
|
("test", "${1:Hallo}", "Types Hallo"),
|
||||||
("test", "${1:World}", "Types World"),
|
("test", "${1:World}", "Types World"),
|
||||||
("test", "We overwrite", "Overwrite the two", "!"),
|
("test", "We overwrite", "Overwrite the two", "", 1),
|
||||||
("test", "again", "Overwrite again", "!"),
|
("test", "again", "Overwrite again", "", 2),
|
||||||
)
|
)
|
||||||
keys = "test" + EX
|
keys = "test" + EX
|
||||||
wanted = "again"
|
wanted = "again"
|
||||||
class SnippetOptions_OverwriteThenChoose_ECR(_VimTest):
|
class SnippetPriorities_OverwriteThenChoose_ECR(_VimTest):
|
||||||
snippets = (
|
snippets = (
|
||||||
("test", "${1:Hallo}", "Types Hallo"),
|
("test", "${1:Hallo}", "Types Hallo"),
|
||||||
("test", "${1:World}", "Types World"),
|
("test", "${1:World}", "Types World"),
|
||||||
("test", "We overwrite", "Overwrite the two", "!"),
|
("test", "We overwrite", "Overwrite the two", "", 1),
|
||||||
("test", "No overwrite", "Not overwritten", ""),
|
("test", "No overwrite", "Not overwritten", "", 1),
|
||||||
)
|
)
|
||||||
keys = "test" + EX + "1\n\n" + "test" + EX + "2\n"
|
keys = "test" + EX + "1\n\n" + "test" + EX + "2\n"
|
||||||
wanted = "We overwrite\nNo overwrite"
|
wanted = "We overwrite\nNo overwrite"
|
||||||
|
class SnippetPriorities_AddedHasHigherThanFile(_VimTest):
|
||||||
|
snippets_test_file = ("all", r"""
|
||||||
|
snippet test "Test Snippet" b
|
||||||
|
This is a test snippet
|
||||||
|
endsnippet
|
||||||
|
""")
|
||||||
|
snippets = (
|
||||||
|
("test", "We overwrite", "Overwrite the two", "", 1),
|
||||||
|
)
|
||||||
|
keys = "test" + EX
|
||||||
|
wanted = "We overwrite"
|
||||||
|
class SnippetPriorities_FileHasHigherThanAdded(_VimTest):
|
||||||
|
snippets_test_file = ("all", r"""
|
||||||
|
snippet test "Test Snippet" b
|
||||||
|
This is a test snippet
|
||||||
|
endsnippet
|
||||||
|
""")
|
||||||
|
snippets = (
|
||||||
|
("test", "We do not overwrite", "Overwrite the two", "", -1),
|
||||||
|
)
|
||||||
|
keys = "test" + EX
|
||||||
|
wanted = "This is a test snippet"
|
||||||
|
class SnippetPriorities_FileHasHigherThanAdded(_VimTest):
|
||||||
|
snippets_test_file = ("all", r"""
|
||||||
|
priority -3
|
||||||
|
snippet test "Test Snippet" b
|
||||||
|
This is a test snippet
|
||||||
|
endsnippet
|
||||||
|
""")
|
||||||
|
snippets = (
|
||||||
|
("test", "We overwrite", "Overwrite the two", "", -5),
|
||||||
|
)
|
||||||
|
keys = "test" + EX
|
||||||
|
wanted = "This is a test snippet"
|
||||||
|
# End: Snippet Priority #}}}
|
||||||
|
|
||||||
|
|
||||||
|
# Snippet Options {{{#
|
||||||
class SnippetOptions_OnlyExpandWhenWSInFront_Expand(_VimTest):
|
class SnippetOptions_OnlyExpandWhenWSInFront_Expand(_VimTest):
|
||||||
snippets = ("test", "Expand me!", "", "b")
|
snippets = ("test", "Expand me!", "", "b")
|
||||||
keys = "test" + EX
|
keys = "test" + EX
|
||||||
@ -2278,14 +2350,6 @@ class MultiWordSnippet_Simple(_VimTest):
|
|||||||
snippets = ("test me", "Expand me!")
|
snippets = ("test me", "Expand me!")
|
||||||
keys = "test me" + EX
|
keys = "test me" + EX
|
||||||
wanted = "Expand me!"
|
wanted = "Expand me!"
|
||||||
class MultiWord_SnippetOptions_OverwriteExisting_ECR(_VimTest):
|
|
||||||
snippets = (
|
|
||||||
("test me", "${1:Hallo}", "Types Hallo"),
|
|
||||||
("test me", "${1:World}", "Types World"),
|
|
||||||
("test me", "We overwrite", "Overwrite the two", "!"),
|
|
||||||
)
|
|
||||||
keys = "test me" + EX
|
|
||||||
wanted = "We overwrite"
|
|
||||||
class MultiWord_SnippetOptions_OnlyExpandWhenWSInFront_Expand(_VimTest):
|
class MultiWord_SnippetOptions_OnlyExpandWhenWSInFront_Expand(_VimTest):
|
||||||
snippets = ("test it", "Expand me!", "", "b")
|
snippets = ("test it", "Expand me!", "", "b")
|
||||||
keys = "test it" + EX
|
keys = "test it" + EX
|
||||||
@ -2395,16 +2459,16 @@ class Anon_Trigger_Opts(_AnonBase):
|
|||||||
class _AddFuncBase(_VimTest):
|
class _AddFuncBase(_VimTest):
|
||||||
args = ""
|
args = ""
|
||||||
def _options_on(self):
|
def _options_on(self):
|
||||||
self.send(":call UltiSnips#AddSnippet("
|
self.send(":call UltiSnips#AddSnippetWithPriority("
|
||||||
+ self.args + ')\n')
|
+ self.args + ')\n')
|
||||||
|
|
||||||
class AddFunc_Simple(_AddFuncBase):
|
class AddFunc_Simple(_AddFuncBase):
|
||||||
args = '"test", "simple expand", "desc", ""'
|
args = '"test", "simple expand", "desc", "", "all", 0'
|
||||||
keys = "abc test" + EX
|
keys = "abc test" + EX
|
||||||
wanted = "abc simple expand"
|
wanted = "abc simple expand"
|
||||||
|
|
||||||
class AddFunc_Opt(_AddFuncBase):
|
class AddFunc_Opt(_AddFuncBase):
|
||||||
args = '".*test", "simple expand", "desc", "r"'
|
args = '".*test", "simple expand", "desc", "r", "all", 0'
|
||||||
keys = "abc test" + EX
|
keys = "abc test" + EX
|
||||||
wanted = "simple expand"
|
wanted = "simple expand"
|
||||||
# End: AddSnippet Function #}}}
|
# End: AddSnippet Function #}}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user