Add "b" options to JS for and ford snippets

`for` loops usually appear at the beginning of the line. This commit
makes these snippets more context-aware by adding the "b" option that
prevents them from being triggered if they are preceded with something
other than whitespace, as suggested by @SirVer[1].

[1]: https://github.com/SirVer/ultisnips/pull/123/files#r8686514
This commit is contained in:
Joe Lencioni 2014-01-06 22:16:05 -08:00
parent 5c36a8945c
commit 983d494752

View File

@ -32,13 +32,13 @@ ${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) {
endsnippet
snippet ford "for (...) {...} (counting down, faster)"
snippet ford "for (...) {...} (counting down, faster)" b
for (var ${2:i} = ${1:Things.length} - 1; $2 >= 0; $2--) {
${3:${1/([^.]+).*/$1/}[$2]}${VISUAL}$0
}
endsnippet
snippet for "for (...) {...} (counting up)"
snippet for "for (...) {...} (counting up)" b
for (var ${1:i} = 0, ${2:len} = ${3:Things.length}; $1 < $2; $1++) {
${4:${3/([^.]+).*/$1/}[$1]}${VISUAL}$0
}