Skip to content

Commit c0cddc9

Browse files
committed
ruby: count from 1, not 0 (I think its very important to think about the name)
add static_var snippet
1 parent b2771b3 commit c0cddc9

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

Diff for: UltiSnips/ruby.snippets

+2-2
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,8 @@ end
432432
endsnippet
433433

434434
snippet dov "do |<key>| ... end" i
435-
do |${0:v}|
436-
$1
435+
do |${1:v}|
436+
$2
437437
end
438438
endsnippet
439439

Diff for: snippets/php.snippets

+7
Original file line numberDiff line numberDiff line change
@@ -405,3 +405,10 @@ snippet aw
405405
array_walk($${1:foo}, function(&$${2:v}, $${3:k}) {
406406
$$2 = ${4};
407407
});
408+
409+
# static var assign once
410+
snippet static_var
411+
static $${1} = null;
412+
if (is_null($$1)){
413+
$$1 = ${2};
414+
}

Diff for: snippets/ruby.snippets

+2-2
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,8 @@ snippet do
422422
# not be worth adding another snippet. should 0/1 placeholders change order?
423423
# its a good idea to think about the var name, so use it first
424424
snippet dov
425-
do |${0:v}|
426-
${1}
425+
do |${1:v}|
426+
${2}
427427
end
428428
snippet :
429429
:${1:key} => ${2:"value"}${3}

0 commit comments

Comments
 (0)