1
0
mirror of https://github.com/amix/vimrc synced 2025-07-06 16:05:01 +08:00

Merge with master

This commit is contained in:
jaegukhyun
2022-10-23 02:19:31 +09:00
120 changed files with 371 additions and 5095 deletions

View File

@ -27,12 +27,6 @@ snippets by typing the name of a snippet hitting the expansion mapping.
snippets/*
- [github.com/Shougo/neosnippet](https://github.com/Shougo/neosnippet.vim):
VimL, supports snippets/* with some configuration.
- [github.com/dcampos/nvim-snippy](https://github.com/dcampos/nvim-snippy):
Lua, supports snippets/* with some configuration.
- [github.com/L3MON4D3/LuaSnip](https://github.com/L3MON4D3/LuaSnip):
Lua, supports snippets/* with some configuration.
Also supports redefining snippets without changing the priority, unlike
nvim-snippy.
- [github.com/drmingdrmer/xptemplate](https://github.com/drmingdrmer/xptemplate):
Totally different syntax, does not read snippets contained in this file, but
it is also very powerful. It does not support vim-snippets (just listing it
@ -52,9 +46,6 @@ If you have VimL only (vim without python support) your best option is using
[garbas/vim-snipmate](https://github.com/garbas/vim-snipmate) and cope with the
minor bugs found in the engine.
If you use Neovim and prefer Lua plugins,
[L3MON4D3/LuaSnip](https://github.com/L3MON4D3/LuaSnip) is the best option.
**Q**: Should snipMate be deprecated in favour of UltiSnips?
**A**: No, because snipMate is VimL, and UltiSnips requires Python.

View File

@ -30,11 +30,6 @@ endglobal
###########################################################################
# TextMate Snippets #
###########################################################################
snippet ponce "#pragma once include guard"
#pragma once
endsnippet
snippet main
int main(int argc, char *argv[])
{
@ -72,14 +67,6 @@ namespace${1/.+/ /m}${1:`!p snip.rv = snip.basename or "name"`}
}${1/.+/ \/* /m}$1${1/.+/ *\/ /m}
endsnippet
snippet nsa "namespace alias"
namespace ${1:alias} = ${2:namespace};
endsnippet
snippet using "using directive/using declaration/type alias"
using ${1:namespace}`!p snip.rv = ' ' if t[1] == 'namespace' else ' = ' if t[1] != '' else ''`${2:name};
endsnippet
snippet readfile "read file (readF)"
std::vector<char> v;
if (FILE *fp = fopen(${1:"filename"}, "r"))

View File

@ -104,11 +104,11 @@ snippet local "local x = 1"
local ${1:x} = ${0:1}
endsnippet
snippet use "Use" b
snippet use "Use" Ab
use { '$1' }
endsnippet
snippet req "Require" b
snippet req "Require"
require('$1')
endsnippet

View File

@ -1,28 +0,0 @@
# snippets for smarty3
extends html
extends javascript
extends css
# https://www.smarty.net/docs/en/language.function.append.tpl
snippet append "{append} is used for creating or appending template variable arrays during the execution of a template."
{append var='${1}' value='${2}'${3: index='${4|first,last|}'}${5: scope='${6|parent,root,global|}'}}
endsnippet
# https://www.smarty.net/docs/en/language.function.assign.tpl
snippet assign "{assign} is used for assigning template variables during the execution of a template."
{assign var='${1}' value='${2}'${3: scope='${4|parent,root,global|}'}}
endsnippet
# https://www.smarty.net/docs/en/language.function.config.load.tpl
snippet config_load "config_load"
{config_load file='${1}'${2: section='${3}'}${4: scope='${5|local,parent,global|}'}}
endsnippet
# https://www.smarty.net/docs/en/language.function.include.tpl
snippet include "{include} tags are used for including other templates in the current template. Any variables available in the current template are also available within the included template."
{include file='${1}'${2: assign='${3}'}${4: cache_lifetime=${5}}${6: compile_id='${7}'}${8: cache_id='${9}'}${10: scope='${11|parent,root,global|}'}${12: variables}}
endsnippet

View File

@ -454,6 +454,27 @@ snippet docls "Document Class" bA
\documentclass{$1}$0
endsnippet
snippet tmplt "Template"
\documentclass{article}
\usepackage{import}
\usepackage{pdfpages}
\usepackage{transparent}
\usepackage{xcolor}
$1
\newcommand{\incfig}[2][1]{%
\def\svgwidth{#1\columnwidth}
\import{./figures/}{#2.pdf_tex}
}
$2
\pdfsuppresswarningpagegroup=1
\begin{document}
$0
\end{document}
endsnippet
#########
# OTHER #

View File

@ -114,7 +114,7 @@ snippet forr
}
# If Condition
snippet if
if ($1) {
if (${1:/* condition */}) {
${0:${VISUAL}}
}
snippet el
@ -122,8 +122,8 @@ snippet el
${0:${VISUAL}}
}
# Ternary conditional
snippet t Ternary: `condition ? true : false`
$1 ? $2 : $0
snippet t
${1:/* condition */} ? ${2:a} : ${0:b}
snippet fun
function ${1:function_name}(${2})${3}
{
@ -150,3 +150,4 @@ snippet FlxSprite
}
}
}

View File

@ -1 +0,0 @@
extends _

View File

@ -19,7 +19,7 @@ snippet def
# if
snippet if
if ($1) {
if (${1:/* condition */}) {
${0:${VISUAL}}
}
# else
@ -29,12 +29,12 @@ snippet el
}
# else if
snippet elif
else if ($1) {
else if (${1:/* condition */}) {
${2}
}
# ifi
snippet ifi
if ($1) ${2};
if (${1:/* condition */}) ${2};
# switch
snippet switch
@ -63,14 +63,14 @@ snippet forr
}
# while
snippet wh
while ($1) {
while (${1:/* condition */}) {
${2}
}
# do... while
snippet do
do {
${2}
} while ($1);
} while (${1:/* condition */});
##
## Functions
# function definition

View File

@ -1,16 +1,16 @@
snippet if
If $1 Then
If ${1:condition} Then
${0:; True code}
EndIf
snippet el
Else
${0}
snippet eif
ElseIf $1 Then
ElseIf ${1:condition} Then
${0:; True code}
# If/Else block
snippet ife
If $1 Then
If ${1:condition} Then
${2:; True code}
Else
${0:; Else code}
@ -26,7 +26,7 @@ snippet ifelif
EndIf
# Switch block
snippet switch
Switch ($1)
Switch (${1:condition})
Case ${2:case1}:
${3:; Case 1 code}
Case Else:
@ -34,7 +34,7 @@ snippet switch
EndSwitch
# Select block
snippet select
Select ($1)
Select (${1:condition})
Case ${2:case1}:
${3:; Case 1 code}
Case Else:
@ -42,7 +42,7 @@ snippet select
EndSelect
# While loop
snippet wh
While ($1)
While (${1:condition})
${0:; code...}
WEnd
# For loop

View File

@ -1,25 +0,0 @@
extends sh
# Shebang
snippet #!
#!/usr/bin/env bash
snippet s#!
#!/usr/bin/env bash
set -eu
snippet if
if [[ $1 ]]; then
${0:${VISUAL}}
fi
snippet elif
elif [[ $1 ]]; then
${0:${VISUAL}}
snippet wh
while [[ $1 ]]; do
${0:${VISUAL}}
done
snippet until
until [[ $1 ]]; do
${0:${VISUAL}}
done

View File

@ -4,23 +4,23 @@ snippet main
int main(int argc, char *argv[])
{
${0}
return 0;
}
# main(void)
snippet mainn
int main(void)
{
${0}
return 0;
}
##
## Preprocessor
# #include <...>
snippet inc
#include <${1:stdio}.h>
$0
# #include "..."
snippet Inc
#include "${1:`vim_snippets#Filename("$1.h")`}"
$0
# ifndef...define...endif
snippet ndef
#ifndef $1
@ -86,8 +86,8 @@ snippet elif
snippet ifi
if (${1:true}) ${0};
# ternary
snippet t Ternary: `condition ? true : false`
$1 ? $2 : $0
snippet t
${1:/* condition */} ? ${2:a} : ${3:b}
# switch
snippet switch
switch (${1:/* variable */}) {
@ -111,8 +111,6 @@ snippet case
${3:break;}
snippet ret
return ${0};
snippet ex
exit($0);
##
## Loops
# for
@ -127,18 +125,14 @@ snippet forr
}
# while
snippet wh
while (${1:1}) {
${0:${VISUAL}}
}
snippet wht
while (true) {
while (${1:/* condition */}) {
${0:${VISUAL}}
}
# do... while
snippet do
do {
${0:${VISUAL}}
} while ($1);
} while (${1:/* condition */});
##
## Functions
# function definition
@ -283,14 +277,6 @@ snippet prf
printf("${1:} = %f\n", $1);
snippet prx
printf("${1:} = %${2}\n", $1);
snippet warn
warn("${1:%s}"$0);
snippet warnx
warnx("${1:%s}"$0);
snippet err
err(${1:1}, "${2:%s}"$0);
snippet errx
errx(${1:1}, "${2:%s}"$0);
# getopt
snippet getopt
int choice;
@ -351,7 +337,7 @@ snippet getopt
## Assertions
snippet asr
assert($1);
assert(${1:condition});
snippet anl
assert(${1:ptr} != NULL);

View File

@ -81,7 +81,7 @@ snippet print
snippet reduce
(reduce ${1:(fn [p n] ${3})} ${2})
snippet when
(when ${1:test} $0)
(when ${1:test} ${0:body})
snippet when-let
(when-let [${1:result} ${2:test}]
$0)
${0:body})

View File

@ -99,7 +99,7 @@ snippet ci_db-select
snippet ci_db-from
$this->db->from("${1:table}");${2}
snippet ci_db-join
$this->db->join("${1:table}", "$2", "${3:type}");${4}
$this->db->join("${1:table}", "${2:condition}", "${3:type}");${4}
snippet ci_db-where
$this->db->where("${1:key}", "${2:value}");${3}
snippet ci_db-or_where

View File

@ -2,37 +2,37 @@
snippet forindo
for ${1:name} in ${2:array}
do ($1) ->
$0
${0:// body}
# Array comprehension
snippet fora
for ${1:name} in ${2:array}
$0
${0:# body...}
# Object comprehension
snippet foro
for ${1:key}, ${2:value} of ${3:object}
$0
${0:# body...}
# Range comprehension (inclusive)
snippet forr
for ${1:name} in [${2:start}..${3:finish}]
$0
${0:# body...}
snippet forrb
for ${1:name} in [${2:start}..${3:finish}] by ${4:step}
$0
${0:# body...}
# Range comprehension (exclusive)
snippet forrex
for ${1:name} in [${2:start}...${3:finish}]
$0
${0:# body...}
snippet forrexb
for ${1:name} in [${2:start}...${3:finish}] by ${4:step}
$0
${0:# body...}
# Function
snippet fun
(${1:args}) ->
$0
${0:# body...}
# Function (bound)
snippet bfun
(${1:args}) =>
$0
${0:# body...}
# Class
snippet cla class ..
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
@ -54,29 +54,29 @@ snippet cla class .. extends .. constructor: ..
${0}
# If
snippet if
if $1
if ${1:condition}
${0:${VISUAL}}
# If __ Else
snippet ife
if $1
if ${1:condition}
${2:${VISUAL}}
else
${0}
${0:# body...}
# Else if
snippet eif
else if $1
else if ${1:condition}
${0:${VISUAL}}
# Ternary If
snippet ifte Ternary
if $1 then $2 else $0
snippet ifte
if ${1:condition} then ${2:value} else ${0:other}
# Unless
snippet unl Unless
$1 unless $0
snippet unl
${1:action} unless ${0:condition}
# Switch
snippet swi
switch ${1:object}
when ${2:value}
$0
${0:# body...}
# Log
snippet log

View File

@ -1,13 +1,5 @@
extends c
## Main
# main()
snippet mainn
int main()
{
${0}
return 0;
}
##
## Preprocessor
# #include <...>

View File

@ -1,12 +1,12 @@
snippet req require
require "${1}"
snippet case
case $1
when $2
case ${1:object}
when ${2:condition}
${0}
end
snippet when
when $1
when ${1:condition}
${0}
snippet def
def ${1:method_name}
@ -17,17 +17,17 @@ snippet pdef
${0}
end
snippet if
if $1
if ${1:condition}
${0:${VISUAL}}
end
snippet ife
if $1
if ${1:condition}
${2:${VISUAL}}
else
${0}
end
snippet wh
while $1
while ${1:condition}
${0:${VISUAL}}
end
snippet cla class .. end

View File

@ -61,15 +61,15 @@ snippet fore
${0}
}
snippet wh
while ($1) {
while (${1:/* condition */}) {
${0}
}
snippet dowh
do {
${0}
} while ($0);
} while (${0:/* condition */});
snippet as
assert($0);
assert(${0:/* condition */});
snippet try
try {
${0:${VISUAL}}

View File

@ -13,29 +13,29 @@ snippet if if .. do .. end
${0:${VISUAL}}
end
snippet if: if .. do: ..
if $1, do: ${0}
if ${1:condition}, do: ${0}
snippet ife if .. do .. else .. end
if $1 do
if ${1:condition} do
${2:${VISUAL}}
else
${0}
end
snippet ife: if .. do: .. else:
if $1, do: ${2}, else: ${0}
if ${1:condition}, do: ${2}, else: ${0}
snippet unless unless .. do .. end
unless ${1} do
${0:${VISUAL}}
end
snippet unless: unless .. do: ..
unless $1, do: ${0}
unless ${1:condition}, do: ${0}
snippet unlesse unless .. do .. else .. end
unless $1 do
unless ${1:condition} do
${2:${VISUAL}}
else
${0}
end
snippet unlesse: unless .. do: .. else:
unless $1, do: ${2}, else: ${0}
unless ${1:condition}, do: ${2}, else: ${0}
snippet cond
cond do
${1} ->

View File

@ -17,7 +17,7 @@ snippet dt
erlang:display({${1}, ${0}}),
# define directive
snippet def
-define(${1:macro}, $2).
-define(${1:macro}, ${2:body}).
# export directive
snippet exp
-export([${1:function}/${0:arity}]).
@ -44,17 +44,17 @@ snippet undef
snippet if
if
${1:guard} ->
$0
${0:body}
end
# case expression
snippet case
case ${1:expression} of
${2:pattern} ->
$0;
${0:body};
end
# anonymous function
snippet fun
fun (${1:Parameters}) -> $2 end
fun (${1:Parameters}) -> ${2:body} end
# try...catch
snippet try
try
@ -65,10 +65,10 @@ snippet try
snippet rcv "Receive Expression"
receive
${1: ${2:pattern}${3: when ${4:guard}} ->
$5
${5:body}}
${6:after
${7:expression} ->
$8
${8:body}}
end
# record directive
snippet rec

View File

@ -19,13 +19,13 @@ snippet class
# If
snippet if
if $1
if ${1:condition}
${0}
end
# If else
snippet ife
if $1
if ${1:condition}
${0}
else
${1}
@ -33,7 +33,7 @@ snippet ife
# If else if
snippet eif
elif $1
elif ${1:condition}
${0}
# Switch case

View File

@ -64,7 +64,7 @@ snippet intent
snippet /
(/ $1 /) ${2:,&} ${0}
snippet if
if ($1) then
if (${1:condition}) then
${0}
end if
snippet case
@ -78,7 +78,7 @@ snippet do
${0}
end do
snippet dow
do while ($1)
do while (${1:condition})
$2
end do
snippet sub

View File

@ -64,13 +64,13 @@ snippet inf "full interface "
}
snippet if "if condition"
if $1 {
if ${1:/* condition */} {
${2:${VISUAL}}
}
snippet ife "if else condition"
if $1 {
if ${1:/* condition */} {
${2:${VISUAL}}
} else {
${0}

View File

@ -26,12 +26,12 @@ snippet mt
snippet mts
= mail_to ${1:email_address}, ${2:name}, :subject => ${3}, :body => ${4}
snippet ife
- if $1
- if ${1:condition}
${2:${VISUAL}}
- else
${0}
snippet ifp
- if $1.presence?
- if ${1:condition}.presence?
${0:${VISUAL}}
snippet ntc
= number_to_currency(${1})

View File

@ -441,9 +441,10 @@ snippet html5
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
${2:link}
</head>
<body>
$0
${0:body}
</body>
</html>
snippet html5l
@ -456,7 +457,7 @@ snippet html5l
${3:link}
</head>
<body>
$0
${0:body}
</body>
</html>
snippet i

View File

@ -24,11 +24,11 @@ snippet for
snippet from
{% from ${1:x} import ${0:y} %}
snippet if
{% if $1 %}
{% if ${1:condition} %}
${0}
{% end %}
snippet eif
{% elif $0 %}
{% elif ${0:condition} %}
snippet el
{% else %}
snippet import
@ -50,6 +50,6 @@ snippet try
${0}
{% end %}
snippet wh
{% while $1 %}
{% while ${1:condition} %}
${0}
{% end %}

View File

@ -142,9 +142,9 @@ snippet ae
snippet aae
assertArrayEquals("${1:Failure message}", ${2:expecteds}, ${3:actuals});
snippet af
assertFalse("${1:Failure message}", $2);
assertFalse("${1:Failure message}", ${2:condition});
snippet at
assertTrue("${1:Failure message}", $2);
assertTrue("${1:Failure message}", ${2:condition});
snippet an
assertNull("${1:Failure message}", ${2:object});
snippet ann
@ -211,9 +211,7 @@ snippet enfor
snippet for
for (${1}; ${2}; ${3}) ${0}
snippet wh
while (${1:true}) ${0}
snippet wht
while (true) ${0}
while (${1}) ${0}
##
## Main method
snippet psvm

View File

@ -62,8 +62,8 @@ snippet ife "if (condition) { ... } else { ... }"
${2}
}
# tertiary conditional
snippet ter Ternary: `condition ? true : false`
$1 ? $2: $0
snippet ter
${1:/* condition */} ? ${2:/* if true */} : ${0:/* if false */}
# switch
snippet switch
switch (${1:expression}) {
@ -107,17 +107,13 @@ snippet forr "reversed for (...) {...}"
${0:${VISUAL}}
}
snippet wh "(condition) { ... }"
while (${1:true}) {
${0:${VISUAL}}
}
snippet wht "(true) { ... }"
while (true) {
while (${1:/* condition */}) {
${0:${VISUAL}}
}
snippet do "do { ... } while (condition)"
do {
${0:${VISUAL}}
} while ($1);
} while (${1:/* condition */});
# For in loop
snippet fori
for (let ${1:prop} in ${2:object}) {

View File

@ -2,32 +2,32 @@
# https://marketplace.visualstudio.com/items?itemName=killalau.vscode-liquid-snippets
snippet if
{% if $1 %}
{% if ${1:condition} %}
${0:${VISUAL}}
{% endif %}
snippet else
{% else %}
snippet elsif
{% elsif $1 %}
{% elsif ${1:condition} %}
snippet ifelse
{% if $1 %}
{% if ${1:condition} %}
${2}
{% else %}
${0}
{% endif %}
snippet unless
{% unless $1 %}
{% unless ${1:condition} %}
${0:${VISUAL}}
{% endunless %}
snippet case
{% case ${1:variable} %}
{% when $2 %}
{% when ${2:condition} %}
${3}
{% else %}
${0}
{% endcase %}
snippet when
{% when $1 %}
{% when ${1:condition} %}
${0:${VISUAL}}
snippet cycle
{% cycle '${1:odd}', '${2:even}' %}
@ -102,32 +102,32 @@ snippet javascript
snippet comment-
{%- comment -%}${0:${VISUAL}}{%- endcomment -%}
snippet if-
{%- if $1 -%}
{%- if ${1:condition} -%}
${0:${VISUAL}}
{%- endif -%}
snippet else-
{%- else -%}
snippet elsif-
{%- elsif $1 -%}
{%- elsif ${1:condition} -%}
snippet ifelse-
{%- if $1 -%}
{%- if ${1:condition} -%}
${2}
{%- else -%}
${0}
{%- endif -%}
snippet unless-
{%- unless $1 -%}
{%- unless ${1:condition} -%}
${0:${VISUAL}}
{%- endunless -%}
snippet case-
{%- case ${1:variable} -%}
{%- when $2 -%}
{%- when ${2:condition} -%}
${3}
{%- else -%}
${0}
{%- endcase -%}
snippet when-
{%- when $1 -%}
{%- when ${1:condition} -%}
${0:${VISUAL}}
snippet cycle-
{%- cycle '${1:odd}', '${2:even}' -%}

View File

@ -66,8 +66,8 @@ snippet elif
snippet ifi
if(${1:true}) ${0};
# ternary
snippet t Ternary: `condition ? true : false`
$1 ? $2 : $0
snippet t
${1:/* condition */} ? ${2:a} : ${3:b}
# switch
snippet switch
switch(${1:/* variable */})
@ -115,7 +115,7 @@ snippet forr
}
# while
snippet wh
while($1)
while(${1:/* condition */})
{
${0:${VISUAL}}
}
@ -123,7 +123,7 @@ snippet wh
snippet do
do{
${0:${VISUAL}}
}while ($1);
}while (${1:/* condition */});
##
## Functions
# function definition

View File

@ -54,24 +54,24 @@ snippet cla class .. extends .. constructor: ..
${5}
# If
snippet if
if $1
if ${1:condition}
${2}
# If __ Else
snippet ife
if $1
if ${1:condition}
${2}
else
${3}
# Else if
snippet elif
else if $1
else if ${1:condition}
${2}
# Ternary If
snippet ifte
if $1 then $2 else $0
if ${1:condition} then ${2:value} else ${3:other}
# Unless
snippet unl
$1 unless $0
${1:action} unless ${2:condition}
# Switch
snippet swi
switch ${1:object}

View File

@ -5,7 +5,7 @@ snippet local
local ${1:x} = ${0:1}
snippet fun
function ${1:fname}(${2:...})
$0
${0:-- body}
end
snippet for
for ${1:i}=${2:1},${3:10} do
@ -13,60 +13,34 @@ snippet for
end
snippet forp
for ${1:i},${2:v} in pairs(${3:table_name}) do
$0
${0:-- body}
end
snippet fori
for ${1:i},${2:v} in ipairs(${3:table_name}) do
$0
${0:-- body}
end
snippet if
if $1 then
$2
if ${1:condition} then
${2:-- body}
end
snippet ife
if $1 then
if ${1:condition} then
${2:-- if condition}
else
${0:-- else}
end
snippet elif
elseif $1 then
$0
elseif ${1:condition} then
${0:--body}
snippet repeat
repeat
$1
until $0
${1:--body}
until ${0:condition}
snippet while
while $1 do
$0
end
snippet wh
while ${1:true} do
${0}
end
snippet wht
while true do
${0}
while ${1:condition} do
${0:--body}
end
snippet print
print("${1:string}")
snippet pr
print($0)
snippet prs
print("$0")
snippet prf
print(string.format("${1:%s}"$0))
snippet wr
io.write($0)
snippet wrs
io.write("$0")
snippet wrf
io.write(string.format("${1:%s}"$0))
snippet fwr
io.${1:stderr}:write($0)
snippet fwrs
io.${1:stderr}:write("$0")
snippet fwrf
io.${1:stderr}:write(string.format("${2:%s}"$0))
snippet im
import "${1:import file}"

View File

@ -19,11 +19,11 @@ snippet for
${0:}
% endfor
snippet if if
% if $1:
% if ${1:condition}:
${0:}
% endif
snippet ife if/else
% if $1:
% if ${1:condition}:
${2:}
% else:
${0:}

View File

@ -67,21 +67,17 @@ snippet <*
<`@*`>
snippet <c
<`@+`>
snippet ** Bold
**$0**
snippet __ Bold
__$0__
snippet --- Front matter
---
$0
---
snippet ====
snippet **
**${1:bold}**
snippet __
__${1:bold}__
snippet ===
`repeat('=', strlen(getline(line('.') - 3)))`
${0}
snippet -
- ${0}
snippet ----
snippet ---
`repeat('-', strlen(getline(line('.') - 3)))`
${0}
@ -146,11 +142,3 @@ snippet pullquote
{% pullquote %}
${1:text} {" ${2:quote} "} ${0:text}
{% endpullquote %}
# Definition lists
snippet : Definition list
$1
: $0
snippet :: Alternate definition list
$1
- $0

View File

@ -1 +1,2 @@
extends markdown

View File

@ -40,7 +40,7 @@ snippet eif
}
# Conditional One-line
snippet xif
$1 if $0;
${1:expression} if ${2:condition};
# Unless conditional
snippet unless
unless (${1}) {
@ -48,7 +48,7 @@ snippet unless
}
# Unless conditional One-line
snippet xunless
$1 unless $0;
${1:expression} unless ${2:condition};
# Try/Except
snippet eval
local $@;
@ -65,7 +65,7 @@ snippet wh
}
# While Loop One-line
snippet xwh
$1 while $0;
${1:expression} while ${2:condition};
# C-style For Loop
snippet cfor
for (my $${2:var} = 0; $$2 < ${1:count}; $$2${3:++}) {
@ -73,7 +73,7 @@ snippet cfor
}
# For loop one-line
snippet xfor
$1 for @$0;
${1:expression} for @${2:array};
# Foreach Loop
snippet for
foreach my $${1:x} (@${2:array}) {
@ -81,7 +81,7 @@ snippet for
}
# Foreach Loop One-line
snippet fore
$1 foreach @$0;
${1:expression} foreach @${2:array};
# Package
snippet package
package ${1:`expand('%:p:s?.*lib/??:r:gs?/?::?')`};

View File

@ -33,7 +33,7 @@ snippet eif
}
# Conditional One-line
snippet xif
${1} if $2;
${1:expression} if ${2:condition};
# Unless conditional
snippet unless
unless ${1} {
@ -41,14 +41,14 @@ snippet unless
}
# Unless conditional One-line
snippet xunless
${1} unless $2;
${1:expression} unless ${2:condition};
# Ternary conditional
snippet tc
$1 ?? ${2:value-if-true} !! ${3:value-if-false};
${1:condition} ?? ${2:value-if-true} !! ${3:value-if-false};
# given - when (perl6 switch)
snippet switch
given ${1:$var} {
when $2 {
when ${2:condition} {
${3:# code block ...}
}
${4}

View File

@ -86,7 +86,7 @@ snippet =?:
snippet ?:
${1:true} ? ${2:a} : ${0}
snippet t "$retVal = (condition) ? a : b"
$${1:retVal} = ($2) ? ${3:a} : ${4:b};
$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};
# Predefined variables
snippet C
$_COOKIE['${1:variable}']
@ -283,7 +283,7 @@ snippet def "define('VARIABLE_NAME', 'definition')"
snippet def?
${1}defined('${2}')
snippet wh "while (condition) { ... }"
while ($1) {
while (${1:/* condition */}) {
${0:${VISUAL}}
}
snippet do "do { ... } while (condition)"

View File

@ -8,7 +8,7 @@ snippet ps
snippet pb
create or replace package body ${1:name}
as
$0
${0:-- body}
end; -- end of package body $1;
# package procedure spec
snippet pps
@ -18,7 +18,7 @@ snippet ppb
procedure ${1:name}(${2:args})
as
begin
$0
${0:-- body}
end $2;
# package function spec
snippet pfs
@ -31,7 +31,7 @@ snippet pfb
as
l_res $3;
begin
$0;
${0:-- body};
return l_res;
end $1;
# snow errors

View File

@ -64,7 +64,7 @@ snippet for
};
#loop while
snippet wh
while ($1) {
while (${1:/* condition */}) {
${0}
}
#break

View File

@ -43,13 +43,13 @@ snippet enum
# PowerShell if..then
snippet if
if ($1) {
$0
if (${1:condition}) {
${2:statement}
}
# PowerShell if..else
snippet ife
if ( $1 ) {
if ( ${1:condition} ) {
${2}
}
else {
@ -58,8 +58,8 @@ snippet ife
# PowerShell While Loop
snippet while
while ($1) {
$0
while (${1:condition}) {
${2:statement}
}
# PowerShell Filter..Sort
@ -69,7 +69,7 @@ snippet filtersort
# PowerShell foreach
snippet foreach
foreach ( $${1:iterator} in $${2:collection} ) {
$0
${3:statement}
}
# PowerShell export-csv

View File

@ -28,14 +28,14 @@ snippet sk "skip unittests" b
@unittest.skip(${1:skip_reason})
snippet wh
while $1:
while ${1:condition}:
${0:${VISUAL}}
# dowh - does the same as do...while in other languages
snippet dowh
while True:
${1}
if $0:
if ${0:condition}:
break
snippet with
@ -115,13 +115,13 @@ snippet property
# Ifs
snippet if
if $1:
if ${1:condition}:
${0:${VISUAL}}
snippet el
else:
${0:${VISUAL}}
snippet ei
elif $1:
elif ${1:condition}:
${0:${VISUAL}}
# Match
@ -508,16 +508,3 @@ snippet numeric "methods for emulating a numeric type" b
def __coerce__(self, other):
${25:pass}
# Printing
snippet pr
print($0)
snippet prs
print("$0")
snippet prf
print(f"$0")
snippet fpr
print($0, file=${1:sys.stderr})
snippet fprs
print("$0", file=${1:sys.stderr})
snippet fprf
print(f"$0", file=${1:sys.stderr})

View File

@ -11,7 +11,7 @@ snippet source
# conditionals
snippet if
if ($1) {
if (${1:condition}) {
${0}
}
snippet el
@ -19,18 +19,14 @@ snippet el
${0}
}
snippet ei
else if ($1) {
else if (${1:condition}) {
${0}
}
# loops
snippet wh
while(${1:true}) {
${0}
}
snippet wht
while(true) {
${0}
while(${1}) {
${2}
}
snippet for
for (${1:item} in ${2:list}) {

View File

@ -6,8 +6,6 @@
# vim's `"*` register---i.e., the contents of the
# system clipboard---to insert text.
extends markdown
# Insert Title Block
snippet %%
% ${1:`Filename('', 'title')`}
@ -22,12 +20,70 @@ snippet %%*
${4}
# Insert Definition List
snippet ::
${1:term}
~ ${2:definition}
# Underline with `=`s or `-`s
snippet ===
`repeat('=', strlen(getline(line(".") - 1)))`
${1}
snippet ---
`repeat('-', strlen(getline(line(".") - 1)))`
${1}
# Links and their kin
# -------------------
#
# (These don't play very well with delimitMate)
#
snippet [
[${1:link}](http://${2:url} "${3:title}")${4}
snippet [*
[${1:link}](${2:`@*`} "${3:title}")${4}
snippet [:
[${1:id}]: http://${2:url} "${3:title}"
snippet [:*
[${1:id}]: ${2:`@*`} "${3:title}"
snippet [@
[${1:link}](mailto:${2:email})${3}
snippet [@*
[${1:link}](mailto:${2:`@*`})${3}
snippet [:@
[${1:id}]: mailto:${2:email} "${3:title}"
snippet [:@*
[${1:id}]: mailto:${2:`@*`} "${3:title}"
snippet ![
![${1:alt}](${2:url} "${3:title}")${4}
snippet ![*
![${1:alt}](${2:`@*`} "${3:title}")${4}
snippet ![:
![${1:id}]: ${2:url} "${3:title}"
snippet ![:*
![${1:id}]: ${2:`@*`} "${3:title}"
snippet [^:
[^${1:id}]: ${2:note}
snippet [^:*
[^${1:id}]: ${2:`@*`}
#
# library()
snippet req
require(${1:}, quietly = TRUE)
# If Condition
snippet if
if ( $1 )
if ( ${1:condition} )
{
${2:}
}
@ -51,7 +107,7 @@ snippet fun
snippet re
repeat{
${2:}
if($1) break
if(${1:condition}) break
}
# matrix

View File

@ -1,7 +1,7 @@
# rst
snippet :
:${1:field name}: $0
:${1:field name}: ${0:field body}
snippet *
*${1:Emphasis}* ${0}
snippet **

View File

@ -34,11 +34,11 @@ snippet #
# =>
snippet case
case ${1:object}
when $2
when ${2:condition}
${0}
end
snippet when
when $1
when ${1:condition}
${0:${VISUAL}}
snippet def
def ${1:method_name}
@ -55,46 +55,46 @@ snippet descendants
end
end
snippet if
if $1
if ${1:condition}
${0:${VISUAL}}
end
snippet ife
if $1
if ${1:condition}
${2:${VISUAL}}
else
${0}
end
snippet eif
elsif $1
elsif ${1:condition}
${0:${VISUAL}}
snippet ifee
if $1
if ${1:condition}
$2
elsif $3
elsif ${3:condition}
$4
else
$0
end
snippet unless
unless $1
unless ${1:condition}
${0:${VISUAL}}
end
snippet unlesse
unless $1
unless ${1:condition}
$2
else
$0
end
snippet unlesee
unless $1
unless ${1:condition}
$2
elsif $3
elsif ${3:condition}
$4
else
$0
end
snippet wh
while $1
while ${1:condition}
${0:${VISUAL}}
end
snippet for
@ -102,7 +102,7 @@ snippet for
${0}
end
snippet until
until $1
until ${1:condition}
${0:${VISUAL}}
end
snippet cla class .. end

View File

@ -147,7 +147,7 @@ snippet loop "loop {}" b
${0:${VISUAL}}
}
snippet wh "while loop"
while $1 {
while ${1:condition} {
${0:${VISUAL}}
}
snippet whl "while let (...)"

View File

@ -13,15 +13,15 @@ snippet fun
@function ${1:name}(${2:args})
${0}
snippet if
@if $1
@if ${1:condition}
${0:${VISUAL}}
snippet ife
@if $1
@if ${1:condition}
${2:${VISUAL}}
@else
${0}
snippet eif
@else if $1
@else if ${1:condition}
${0:${VISUAL}}
snippet for
@for ${1:$i} from ${2:1} through ${3:3}

View File

@ -17,17 +17,17 @@ snippet fun
${0}
}
snippet if
@if $1 {
@if ${1:condition} {
${0}
}
snippet ife
@if $1 {
@if ${1:condition} {
${2}
} @else {
${0}
}
snippet eif
@else if $1 {
@else if ${1:condition} {
${0}
}
snippet for

View File

@ -1,9 +1,9 @@
# Shebang
# Shebang. Executing bash via /usr/bin/env makes scripts more portable.
snippet #!
#!/bin/sh
#!/usr/bin/env sh
snippet s#!
#!/bin/sh
#!/usr/bin/env sh
set -eu
snippet safe
@ -18,11 +18,11 @@ snippet sbash
IFS=$'\n\t'
snippet if
if [ $1 ]; then
if [[ ${1:condition} ]]; then
${0:${VISUAL}}
fi
snippet elif
elif [ $1 ]; then
elif [[ ${1:condition} ]]; then
${0:${VISUAL}}
snippet for
for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do
@ -33,15 +33,11 @@ snippet fori
${0:${VISUAL}}
done
snippet wh
while [ $1 ]; do
${0:${VISUAL}}
done
snippet wht
while true; do
while [[ ${1:condition} ]]; do
${0:${VISUAL}}
done
snippet until
until [ $1 ]; do
until [[ ${1:condition} ]]; do
${0:${VISUAL}}
done
snippet case
@ -101,10 +97,10 @@ snippet root
snippet fun-sh
${1:function_name}() {
$0
${0:#function_body}
}
snippet fun
function ${1:function_name}() {
$0
${0:#function_body}
}

View File

@ -1,139 +0,0 @@
# snippets for smarty3
extends html
extends javascript
extends css
# https://www.smarty.net/docs/en/language.function.if.tpl
snippet if "{if cond} ... {/if}"
{if ${1}}
${0:${VISUAL}}
{/if}
snippet ifn "{if !cond} ... {/if}"
{if ${1}}
${0:${VISUAL}}
{/if}
snippet ife "{if cond} ... {else} ... {/if}"
{if ${1}}
${0:${VISUAL}}
{else}
${2}
{/if}
snippet eif "{elseif cond} ... {/if}"
{elseif ${1}}
${0:${VISUAL}}
{/if}
snippet el "{else} ... {/if}"
{else}
${1}
{/if}
# https://www.smarty.net/docs/en/language.function.for.tpl
snippet for "The {for} tag is used to create simple loops."
{for $${1:var}=${2:start} to ${3:end}${4: step ${5}}${6: max=${7}}}
${0:${VISUAL}}
{/for}
snippet forelse "The {for}{forelse} tag is used to create simple loops."
{for $${1:var}=${2:start} to ${3:end}${4: step ${5}}${6: max=${7}}}
${0:${VISUAL}}
{forelse}
${8}
{/for}
# https://www.smarty.net/docs/en/language.function.foreach.tpl
snippet foreach "{foreach} is used for looping over arrays of data."
{foreach $${1:array_variable} as $${2:var_or_key}${3: => $${4:itemvar}}}
${0:${VISUAL}}
{/foreach}
snippet foreach2 "[Smarty2] {foreach} is used for looping over arrays of data."
{foreach from=$${1:collection} item='${2}'${3: key='${4}'}${5: name='${6}'}}
${0:${VISUAL}}
{/foreach}
snippet foreachelse "{foreach} is used for looping over arrays of data."
{foreach $${1:array_variable} as $${2:var_or_key}${3: => $${4:itemvar}}}
${0:${VISUAL}}
{foreachelse}
${5}
{/foreach}
snippet wh "{while} loops in Smarty have much the same flexibility as PHP while statements, with a few added features for the template engine. Every {while} must be paired with a matching {/while}. All PHP conditionals and functions are recognized, such as ||, or, &&, and, is_array(), etc."
{while ${1}}
${0:${VISUAL}}
{/while}
# https://www.smarty.net/docs/en/language.function.append.tpl
#snippet append implemented in UltiSnips format
# https://www.smarty.net/docs/en/language.function.assign.tpl
#snippet assign implemented in UltiSnips format
# https://www.smarty.net/docs/en/language.function.block.tpl
snippet block "{block} is used to define a named area of template source for template inheritance."
{block name='${1}'}
${0:${VISUAL}}
{/block}
# https://www.smarty.net/docs/en/language.function.call.tpl
snippet call "{call} is used to call a template function defined by the {function} tag just like a plugin function."
{call name=${1}${2: assign=${3}}${4: variables}}
# https://www.smarty.net/docs/en/language.function.capture.tpl
snippet capture "{capture} is used to collect the output of the template between the tags into a variable instead of displaying it. Any content between {capture name='foo'} and {/capture} is collected into the variable specified in the name attribute. "
{capture name='${1}'${2: assign='${3}' }${4: append='${5:array_variable}'}}
${0:${VISUAL}}
{/capture}
# https://www.smarty.net/docs/en/language.function.config.load.tpl
#snippet config_load implemented in UltiSnips format
# https://www.smarty.net/docs/en/language.function.extends.tpl
snippet extends "{extends} tags are used in child templates in template inheritance for extending parent templates."
{extends file='${1}'}
# https://www.smarty.net/docs/en/language.function.function.tpl
snippet function "{function} is used to create functions within a template and call them just like a plugin function. Instead of writing a plugin that generates presentational content, keeping it in the template is often a more manageable choice. It also simplifies data traversal, such as deeply nested menus."
{function name='${1}' ${2:variables}}
${0:${VISUAL}}
{/function}
# https://www.smarty.net/docs/en/language.function.include.tpl
#snippet include implemented in UltiSnips format
# https://www.smarty.net/docs/en/language.function.literal.tpl
snippet literal "{literal} tags allow a block of data to be taken literally. This is typically used around Javascript or stylesheet blocks where {curly braces} would interfere with the template delimiter syntax"
{literal}
${0:${VISUAL}}
{/literal}
# https://www.smarty.net/docs/en/language.function.nocache.tpl
snippet nocache "{nocache} is used to disable caching of a template section. Every {nocache} must be paired with a matching {/nocache}."
{nocache}
${0:${VISUAL}}
{/nocache}
# https://www.smarty.net/docs/en/language.function.section.tpl
snippet section "A {section} is for looping over sequentially indexed arrays of data, unlike {foreach} which is used to loop over a single associative array. Every {section} tag must be paired with a closing {/section} tag."
{section name='${1}'${2: loop='${3}'}${4: start=${5}}${6: step=${7}}${8: max=${9}}${10: show=${11}}}
${0:${VISUAL}}
{/section}
# https://www.smarty.net/docs/en/language.function.setfilter.tpl
snippet setfilter "The {setfilter}...{/setfilter} block tag allows the definition of template instance's variable filters."
{setfilter ${1:filters}}
${0:${VISUAL}}
{/setfilter}
# https://www.smarty.net/docs/en/language.function.strip.tpl
snippet strip "Anything within {strip}{/strip} tags are stripped of the extra spaces or carriage returns at the beginnings and ends of the lines before they are displayed. This way you can keep your templates readable, and not worry about extra white space causing problems."
{strip}
${0:${VISUAL}}
{/strip}

View File

@ -6,27 +6,6 @@ snippet dcl \documentclass{}
#documentclass with options
snippet dclo \documentclass[]{}
\\documentclass[${1:options}]{${2:class}} ${0}
snippet tmplt "Template"
\\documentclass{${1:article}}
\\usepackage{import}
\\usepackage{pdfpages}
\\usepackage{transparent}
\\usepackage{xcolor}
$2
\\newcommand{\incfig}[2][1]{%
\def\svgwidth{#1\columnwidth}
\import{./figures/}{#2.pdf_tex}
}
$3
\\pdfsuppresswarningpagegroup=1
\\begin{document}
$0
\\end{document}
#newcommand
snippet nc \newcommand
\\newcommand{\\${1:cmd}}[${2:opt}]{${3:realcmd}} ${0}

View File

@ -144,7 +144,7 @@ snippet yrp
#----------------Yii Model-----------------------------
#Yii Model count
snippet ycountm
${1:ModelName}::model()->count($2, array('${3:key}'=>${0:value}));
${1:ModelName}::model()->count(${2:condition}, array('${3:key}'=>${0:value}));
#Yii Model countBySql
snippet ycountbs
@ -152,35 +152,35 @@ snippet ycountbs
#Yii Model updateAll
snippet yupdatea
${1:ModelName}::model()->updateAll(${2:array('attributes')}, $3,array('${4:key}'=>${0:value}));
${1:ModelName}::model()->updateAll(${2:array('attributes')}, ${3:condition},array('${4:key}'=>${0:value}));
#Yii Model updateByPk
snippet yupdatebp
${1:ModelName}::model()->updateByPk(${2:pk}, ${3:array('attributes')}, $4,array('${5:key}'=>${0:value}));
${1:ModelName}::model()->updateByPk(${2:pk}, ${3:array('attributes')}, ${4:condition},array('${5:key}'=>${0:value}));
#Yii Model deleteAll
snippet ydela
${1:ModelName}::model()->deleteAll($2,array('${3:key}'=>${0:value}));
${1:ModelName}::model()->deleteAll(${2:condition},array('${3:key}'=>${0:value}));
#Yii Model deleteByPk
snippet ydelbp
${1:ModelName}::model()->deleteByPk(${2:pk}, $3, array('${4:key}'=>${0:value}));
${1:ModelName}::model()->deleteByPk(${2:pk}, ${3:condition}, array('${4:key}'=>${0:value}));
#Yii Model find
snippet yfind
${1:ModelName}::model()->find($2,array('${3:key}'=>${0:value}));
${1:ModelName}::model()->find(${2:condition},array('${3:key}'=>${0:value}));
#Yii Model findAll
snippet yfinda
${1:ModelName}::model()->findAll($2,array('${3:key}'=>${0:value}));
${1:ModelName}::model()->findAll(${2:condition},array('${3:key}'=>${0:value}));
#Yii Model findByPk
snippet yfindbp
${1:ModelName}::model()->findByPk(${2:pk}, $3, array('${4:key}'=>${0:value}));
${1:ModelName}::model()->findByPk(${2:pk}, ${3:condition}, array('${4:key}'=>${0:value}));
#Yii Model findAllByPk
snippet yfindabp
${1:ModelName}::model()->findAllByPk(${2:pk}, $3,array('${4:key}'=>${0:value}));
${1:ModelName}::model()->findAllByPk(${2:pk}, ${3:condition},array('${4:key}'=>${0:value}));
#Yii Model findBySql
snippet yfindbs
@ -188,11 +188,11 @@ snippet yfindbs
#Yii Model findAllByAttributes
snippet yfindaba
${1:ModelName}::model()->findAllByAttributes(array('${2:attributeName}'=>${3:attributeValue}), $4, array('${5:key}'=>${0:value}));
${1:ModelName}::model()->findAllByAttributes(array('${2:attributeName}'=>${3:attributeValue}), ${4:condition}, array('${5:key}'=>${0:value}));
#Yii Model exists
snippet yexists
${1:ModelName}::model()->exists($2, array('${3:key}'=>${0:value}));
${1:ModelName}::model()->exists(${2:condition}, array('${3:key}'=>${0:value}));
#Yii Create model class
snippet ymodel

View File

@ -1,21 +1,19 @@
# #!/bin/zsh
extends bash
snippet #!
#!/usr/bin/env zsh
#!/bin/zsh
snippet if
if $1; then
if ${1:condition}; then
${0:${VISUAL}}
fi
snippet ife
if $1; then
if ${1:condition}; then
${2:${VISUAL}}
else
${0:# statements}
fi
snippet eif
elif $1; then
elif ${1:condition}; then
${0:${VISUAL}}
snippet for
for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do
@ -30,11 +28,11 @@ snippet fore
${0:${VISUAL}}
done
snippet wh
while $1; do
while ${1:condition}; do
${0:${VISUAL}}
done
snippet until
until $1; do
until ${1:condition}; do
${0:${VISUAL}}
done
snippet repeat