Remove UltiSnips directory and gitignore
This commit is contained in:
parent
867a84ed50
commit
771b8e5820
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,2 +0,0 @@
|
||||||
UltiSnips/*
|
|
||||||
UltiSnips/
|
|
|
@ -1,17 +0,0 @@
|
||||||
This directory contains the snippets for UltiSnips.
|
|
||||||
https://github.com/sirver/ultisnips
|
|
||||||
|
|
||||||
Standing On The Shoulders of Giants
|
|
||||||
===================================
|
|
||||||
|
|
||||||
The snippets have been collected from various other project which I want to
|
|
||||||
express my gratitude for. My main source for inspiration where the following
|
|
||||||
two projects:
|
|
||||||
|
|
||||||
TextMate: http://svn.textmate.org/trunk/Bundles/
|
|
||||||
SnipMate: http://code.google.com/p/snipmate/
|
|
||||||
|
|
||||||
UltiSnips has seen contributions by many individuals. Those contributions have
|
|
||||||
been merged into this collection seamlessly and without further comments.
|
|
||||||
|
|
||||||
-- vim:ft=rst:nospell:
|
|
|
@ -1,282 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
global !p
|
|
||||||
|
|
||||||
def ada_case(word):
|
|
||||||
out = word[0].upper()
|
|
||||||
for i in range(1, len(word)):
|
|
||||||
if word[i] == '-':
|
|
||||||
out = out + '.'
|
|
||||||
elif word[i - 1] == '_' or word[i - 1] == '-':
|
|
||||||
out = out + word[i].upper()
|
|
||||||
else:
|
|
||||||
out = out + word[i]
|
|
||||||
return out
|
|
||||||
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
snippet wi "with"
|
|
||||||
with $1;$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pac "package"
|
|
||||||
package ${1:`!p snip.rv = ada_case(snip.basename)`} is
|
|
||||||
$0
|
|
||||||
end $1;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pacb "package body"
|
|
||||||
package body ${1:`!p snip.rv = ada_case(snip.basename)`} is
|
|
||||||
$0
|
|
||||||
end $1;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ent "entry ... when"
|
|
||||||
entry $1($2) when $3 is
|
|
||||||
begin
|
|
||||||
$0
|
|
||||||
end $1;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet task "task"
|
|
||||||
task $1 is
|
|
||||||
entry $0
|
|
||||||
end $1;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet taskb "task body"
|
|
||||||
task body $1 is
|
|
||||||
$2
|
|
||||||
begin
|
|
||||||
$0
|
|
||||||
end $1;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet acc "accept"
|
|
||||||
accept $1($2) do
|
|
||||||
$0
|
|
||||||
end $1;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet prot "protected type"
|
|
||||||
protected type $1($2) is
|
|
||||||
$0
|
|
||||||
end $1;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet prob "protected body"
|
|
||||||
protected body $1 is
|
|
||||||
$2
|
|
||||||
begin
|
|
||||||
$0
|
|
||||||
end $1;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet gen "generic type"
|
|
||||||
generic
|
|
||||||
type $1 is $2;$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ty "type"
|
|
||||||
type $1 is $2;$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tyd "type with default value"
|
|
||||||
type $1 is $2
|
|
||||||
with Default_Value => $3;$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet subty "subtype"
|
|
||||||
subtype $1 is $2;$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet dec "declare block"
|
|
||||||
declare
|
|
||||||
$1
|
|
||||||
begin
|
|
||||||
$0
|
|
||||||
end;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet decn "declare named block"
|
|
||||||
$1:
|
|
||||||
declare
|
|
||||||
$2
|
|
||||||
begin
|
|
||||||
$0
|
|
||||||
end $1;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ifex "if expression"
|
|
||||||
if $1 then $2 else $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet casex "case expression"
|
|
||||||
case $1 is
|
|
||||||
when $2 => $3,$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fora "for all"
|
|
||||||
for all $1 ${2:in} $3 => $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fors "for some"
|
|
||||||
for some $1 ${2:in} $3 => $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet if "if"
|
|
||||||
if $1 then
|
|
||||||
$0
|
|
||||||
end if;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ife "if ... else"
|
|
||||||
if $1 then
|
|
||||||
$2
|
|
||||||
else
|
|
||||||
$0
|
|
||||||
end if;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet el "else"
|
|
||||||
else
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet eif "elsif"
|
|
||||||
elsif $1 then
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet wh "while"
|
|
||||||
while $1 loop
|
|
||||||
$0
|
|
||||||
end loop;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet nwh "named while"
|
|
||||||
$1:
|
|
||||||
while $2 loop
|
|
||||||
$0
|
|
||||||
end loop $1;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet for "for"
|
|
||||||
for ${1:I} in $2 loop
|
|
||||||
$0
|
|
||||||
end loop;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fore "for each"
|
|
||||||
for $1 of $2 loop
|
|
||||||
$0
|
|
||||||
end loop;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet nfor "named for"
|
|
||||||
$1:
|
|
||||||
for ${2:I} in $3 loop
|
|
||||||
$0
|
|
||||||
end loop $1;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet nfore "named for each"
|
|
||||||
$1:
|
|
||||||
for $2 of $3 loop
|
|
||||||
$0
|
|
||||||
end loop $1;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet proc "procedure"
|
|
||||||
procedure $1($2) is
|
|
||||||
$3
|
|
||||||
begin
|
|
||||||
$0
|
|
||||||
end $1;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet procd "procedure declaration"
|
|
||||||
procedure $1;$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fun "function"
|
|
||||||
function $1($2) return $3 is
|
|
||||||
$4
|
|
||||||
begin
|
|
||||||
$0
|
|
||||||
end $1;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fune "expression function"
|
|
||||||
function $1 return $2 is
|
|
||||||
($3);$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fund "function declaration"
|
|
||||||
function $1 return $2;$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ret "extended return"
|
|
||||||
return $1 do
|
|
||||||
$0
|
|
||||||
end return;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rec "record"
|
|
||||||
record
|
|
||||||
$0
|
|
||||||
end record;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet case "case"
|
|
||||||
case $1 is
|
|
||||||
when $2 => $3;$0
|
|
||||||
end case;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet whe "when"
|
|
||||||
when $1 => $2;$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet wheo "when others"
|
|
||||||
when others => $1;$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet lo "loop"
|
|
||||||
loop
|
|
||||||
$0
|
|
||||||
end loop;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet nlo "named loop"
|
|
||||||
$1:
|
|
||||||
loop
|
|
||||||
$0
|
|
||||||
end loop $1;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ex "exit when"
|
|
||||||
exit when $1;$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet put "Ada.Text_IO.Put"
|
|
||||||
Ada.Text_IO.Put($1);$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet putl "Ada.Text_IO.Put_Line"
|
|
||||||
Ada.Text_IO.Put_Line($1);$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet get "Ada.Text_IO.Get"
|
|
||||||
Ada.Text_IO.Get($1);$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet getl "Ada.Text_IO.Get_Line"
|
|
||||||
Ada.Text_IO.Get_Line($1);$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet newline "Ada.Text_IO.New_Line"
|
|
||||||
Ada.Text_IO.New_Line(${1:1});$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -1,113 +0,0 @@
|
||||||
# This file contains snippets that are always defined. I personally
|
|
||||||
# have snippets for signatures and often needed texts
|
|
||||||
|
|
||||||
# sligthly lower priority than everything else since specialized versions
|
|
||||||
# should overwrite. The user needs to adjust her priority in her snippets to
|
|
||||||
# ~-55 so that other filetypes will still overwrite.
|
|
||||||
priority -60
|
|
||||||
|
|
||||||
##############
|
|
||||||
# NICE BOXES #
|
|
||||||
##############
|
|
||||||
global !p
|
|
||||||
from vimsnippets import foldmarker, make_box, get_comment_format
|
|
||||||
LOREM = """
|
|
||||||
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod \
|
|
||||||
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At \
|
|
||||||
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, \
|
|
||||||
no sea takimata sanctus est Lorem ipsum dolor sit amet.
|
|
||||||
"""
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
snippet box "A nice box with the current comment symbol" b
|
|
||||||
`!p
|
|
||||||
box = make_box(len(t[1]))
|
|
||||||
snip.rv = box[0]
|
|
||||||
snip += box[1]
|
|
||||||
`${1:${VISUAL:content}}`!p
|
|
||||||
box = make_box(len(t[1]))
|
|
||||||
snip.rv = box[2]
|
|
||||||
snip += box[3]`
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet bbox "A nice box over the full width" b
|
|
||||||
`!p
|
|
||||||
if not snip.c:
|
|
||||||
width = int(vim.eval("&textwidth - (virtcol('.') == 1 ? 0 : virtcol('.'))")) or 71
|
|
||||||
box = make_box(len(t[1]), width)
|
|
||||||
snip.rv = box[0]
|
|
||||||
snip += box[1]
|
|
||||||
`${1:${VISUAL:content}}`!p
|
|
||||||
box = make_box(len(t[1]), width)
|
|
||||||
snip.rv = box[2]
|
|
||||||
snip += box[3]`
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
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]`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
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]`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
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]`
|
|
||||||
${2:${VISUAL:Content}}
|
|
||||||
`!p snip.rv = get_comment_format()[0]` `!p snip.rv = foldmarker()[1]` $1 `!p snip.rv = get_comment_format()[2]`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
##########################
|
|
||||||
# LOREM IPSUM GENERATORS #
|
|
||||||
##########################
|
|
||||||
snippet "lorem(([1-4])?[0-9])?" "Lorem Ipsum" r
|
|
||||||
`!p snip.rv = " ".join(LOREM.split()[:int(match.group(1))]) if match.group(1) else LOREM`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
##########################
|
|
||||||
# VIM MODELINE GENERATOR #
|
|
||||||
##########################
|
|
||||||
# See advice on `:help 'tabstop'` for why these values are set. Uses second
|
|
||||||
# modeline form ('set') to work in languages with comment terminators
|
|
||||||
# (/* like C */).
|
|
||||||
snippet modeline "Vim modeline"
|
|
||||||
vim`!v ':set '. (&expandtab ? printf('et sw=%i ts=%i', &sw, &ts) : printf('noet sts=%i sw=%i ts=%i', &sts, &sw, &ts)) . (&tw ? ' tw='. &tw : '') . ':'`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
#########
|
|
||||||
# DATES #
|
|
||||||
#########
|
|
||||||
snippet date "YYYY-MM-DD" w
|
|
||||||
`!v strftime("%Y-%m-%d")`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ddate "Month DD, YYYY" w
|
|
||||||
`!v strftime("%b %d, %Y")`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet diso "ISO format datetime" w
|
|
||||||
`!v strftime("%Y-%m-%d %H:%M:%S%z")`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet time "hh:mm" w
|
|
||||||
`!v strftime("%H:%M")`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet datetime "YYYY-MM-DD hh:mm" w
|
|
||||||
`!v strftime("%Y-%m-%d %H:%M")`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet todo "TODO comment" bw
|
|
||||||
`!p snip.rv=get_comment_format()[0]` ${2:TODO}: $0${3: <${4:`!v strftime('%d-%m-%y')`}${5:, `!v g:snips_author`}>} `!p snip.rv=get_comment_format()[2]`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
##########
|
|
||||||
# Misc #
|
|
||||||
##########
|
|
||||||
snippet uuid "Random UUID" w
|
|
||||||
`!p if not snip.c: import uuid; snip.rv = str(uuid.uuid4())`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -1,52 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
snippet online "Online resource" b
|
|
||||||
@online{${1:name},
|
|
||||||
author={${2:author}},
|
|
||||||
title={${3:title}},
|
|
||||||
date={${4:date}},
|
|
||||||
url={${5:url}}
|
|
||||||
}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet article "Article reference" b
|
|
||||||
@article{${1:name},
|
|
||||||
author={${2:author}},
|
|
||||||
title={${3:title}},
|
|
||||||
journaltitle={${4:journal}},
|
|
||||||
volume={${5:NN}},
|
|
||||||
number={${6:NN}},
|
|
||||||
year={${7:YYYY}},
|
|
||||||
pages={${8:NN}--${9:NN}}
|
|
||||||
}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet book "Book reference" b
|
|
||||||
@book{${1:name},
|
|
||||||
author={${2:author}},
|
|
||||||
title={${3:title}},
|
|
||||||
subtitle={${4:subtitle}},
|
|
||||||
year={${5:YYYY}},
|
|
||||||
location={${6:somewhere}},
|
|
||||||
publisher={${7:publisher}},
|
|
||||||
pages={${8:NN}--${9:NN}}
|
|
||||||
}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet inb "In Book reference" b
|
|
||||||
@inbook{${1:name},
|
|
||||||
author={${2:author}},
|
|
||||||
title={${3:title}},
|
|
||||||
subtitle={${4:subtitle}},
|
|
||||||
booktitle={${5:book}},
|
|
||||||
editor={${6:editor}},
|
|
||||||
year={${7:YYYY}},
|
|
||||||
location={${8:somewhere}},
|
|
||||||
publisher={${9:publisher}},
|
|
||||||
pages={${10:NN}--${11:NN}}
|
|
||||||
}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
|
@ -1,29 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
global !p
|
|
||||||
def newsoa():
|
|
||||||
import datetime
|
|
||||||
now = datetime.datetime.now()
|
|
||||||
# return standard SOA formatted serial for today
|
|
||||||
return now.strftime("%Y%m%d00")
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
snippet zone "Bootstrap a new Bind zonefile" b
|
|
||||||
$TTL 86400
|
|
||||||
@ IN SOA ${1:example.net}. ${2:hostmaster.$1}.(
|
|
||||||
`!p snip.rv = newsoa()`; serial
|
|
||||||
21600; refresh every 6 hours
|
|
||||||
3600; retry after one hour
|
|
||||||
604800; expire after a week
|
|
||||||
86400 ); minimum TTL of 1 day
|
|
||||||
|
|
||||||
IN NS ns01.$1.
|
|
||||||
IN MX 10 mail.$1.
|
|
||||||
|
|
||||||
ns01.$1 IN A
|
|
||||||
mail.$1 IN A
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet A "Insert A Record" b
|
|
||||||
${1:hostname} IN A ${2:ip}
|
|
||||||
endsnippet
|
|
|
@ -1,139 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
extends html
|
|
||||||
|
|
||||||
# We want to overwrite everything in parent ft.
|
|
||||||
priority -49
|
|
||||||
|
|
||||||
snippet break "@break"
|
|
||||||
@break
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet component "@component directive"
|
|
||||||
@component('$1')
|
|
||||||
${2:${VISUAL}}
|
|
||||||
@endcomponent
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet each "@each directive"
|
|
||||||
@each('$1', $$2, '$3')
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet else "@else directive"
|
|
||||||
@else
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet eif "@else if directive"
|
|
||||||
@else if ($1)
|
|
||||||
${2:${VISUAL}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet for "@for directive"
|
|
||||||
@for ($1)
|
|
||||||
${2:${VISUAL}}
|
|
||||||
@endfor
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet foreach "@foreach directive"
|
|
||||||
@foreach ($$1 as $$2)
|
|
||||||
${3:${VISUAL}}
|
|
||||||
@endforeach
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet extends "@extends directive"
|
|
||||||
@extends('$1')
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet if "@if directive"
|
|
||||||
@if ($1)
|
|
||||||
${2:${VISUAL}}
|
|
||||||
@endif
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ife "@if @else structure"
|
|
||||||
@if ($1)
|
|
||||||
${2:${VISUAL}}
|
|
||||||
@else
|
|
||||||
${3:${VISUAL}}
|
|
||||||
@endif
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet include "@include directive"
|
|
||||||
@include('$1')
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet includeIf "@includeIf directive"
|
|
||||||
@includeIf('$1')
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet isset "@isset directive"
|
|
||||||
@isset
|
|
||||||
${1:${VISUAL}}
|
|
||||||
@endisset
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet inject "@inject directive"
|
|
||||||
@inject('$1', '$2')
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet lang "@lang directive" i
|
|
||||||
@lang('$1')
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet php "@php directive"
|
|
||||||
@php
|
|
||||||
${1:${VISUAL}}
|
|
||||||
@endphp
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet push "@push directive"
|
|
||||||
@push('$1')
|
|
||||||
${2:${VISUAL}}
|
|
||||||
@endpush
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet section "@section directive"
|
|
||||||
@section('$1')
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet show "@show directive"
|
|
||||||
@show
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet slot "@slot directive"
|
|
||||||
@slot('$1')
|
|
||||||
${2:${VISUAL}}
|
|
||||||
@endslot
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet unless "@unless directive"
|
|
||||||
@unless
|
|
||||||
${1:${VISUAL}}
|
|
||||||
@endunless
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet verbatim "@verbatim directive"
|
|
||||||
@verbatim
|
|
||||||
${0:$VISUAL}
|
|
||||||
@endverbatim
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet wh "@while directive"
|
|
||||||
@while ($1)
|
|
||||||
${2:${VISUAL}}
|
|
||||||
@endwhile
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet yield "@yield directive"
|
|
||||||
@yield('$1')
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet { "{{ }} statement." i
|
|
||||||
{{ $1 }}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet {! "{!! !!} statement" i
|
|
||||||
{!! $1 !!}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -1,186 +0,0 @@
|
||||||
###########################################################################
|
|
||||||
# TextMate Snippets #
|
|
||||||
###########################################################################
|
|
||||||
# --------------
|
|
||||||
# Functions
|
|
||||||
# --------------
|
|
||||||
global !p
|
|
||||||
def printf_expand_args(snip):
|
|
||||||
"""
|
|
||||||
This will look how many placeholders printf has and adds the separated commas
|
|
||||||
at the end.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# now add so many "," as much as the amount of placeholders
|
|
||||||
amount_placeholders = snip.tabstops[1].current_text.count("%")
|
|
||||||
|
|
||||||
output = ""
|
|
||||||
|
|
||||||
# Add the amount of tabstops
|
|
||||||
for placeholder_index in range(3, amount_placeholders + 3):
|
|
||||||
output += f", ${placeholder_index}"
|
|
||||||
|
|
||||||
# convert them into tabstops
|
|
||||||
snip.expand_anon(output)
|
|
||||||
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
# ==============
|
|
||||||
# Snippets
|
|
||||||
# ==============
|
|
||||||
priority -50
|
|
||||||
|
|
||||||
snippet def "#define ..."
|
|
||||||
#define $1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet #ifndef "#ifndef ... #define ... #endif"
|
|
||||||
#ifndef ${1/([A-Za-z0-9_]+).*/$1/}
|
|
||||||
#define ${1:SYMBOL} ${2:value}
|
|
||||||
#endif /* ifndef $1 */
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet #if "#if #endif" b
|
|
||||||
#if ${1:0}
|
|
||||||
${VISUAL}$0
|
|
||||||
#endif
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mark "#pragma mark (mark)"
|
|
||||||
#if 0
|
|
||||||
${1:#pragma mark -
|
|
||||||
}#pragma mark $2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet main "main() (main)"
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
${VISUAL}$0
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet for "for loop (for)"
|
|
||||||
for (${2:i} = 0; $2 < ${1:count}; ${3:++$2}) {
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fori "for int loop (fori)"
|
|
||||||
for (${4:int} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) {
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fora "for-loop" b
|
|
||||||
for (${1:var}; ${2:condition}; `!p
|
|
||||||
if len(t[1]) > 0:
|
|
||||||
snip.rv = t[1].split('=')[0].split()[-1]
|
|
||||||
`++) {
|
|
||||||
|
|
||||||
$0
|
|
||||||
} /* for ($1; $2; `!p if len(t[1]) > 0: snip.rv = t[1].split('=')[0].split()[-1]`++) */
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet once "Include header once only guard"
|
|
||||||
#ifndef ${1:`!p
|
|
||||||
if not snip.c:
|
|
||||||
import random, string
|
|
||||||
name = re.sub(r'[^A-Za-z0-9]+','_', snip.fn).upper()
|
|
||||||
rand = ''.join(random.sample(string.ascii_letters+string.digits, 8))
|
|
||||||
snip.rv = ('%s_%s' % (name,rand)).upper()
|
|
||||||
else:
|
|
||||||
snip.rv = snip.c`}
|
|
||||||
#define $1
|
|
||||||
|
|
||||||
${VISUAL}$0
|
|
||||||
|
|
||||||
#endif /* end of include guard: $1 */
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fprintf "fprintf ..."
|
|
||||||
fprintf(${1:stderr}, "${2:%s}\n"${2/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$3${2/([^%]|%%)*(%.)?.*/(?2:\);)/}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet eli "else if .. (eli)"
|
|
||||||
else if (${1:/* condition */}) {
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
post_jump "printf_expand_args(snip)"
|
|
||||||
snippet "printf" "printf with auto-expand args" wr
|
|
||||||
printf("$1\n"$2);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet st "struct"
|
|
||||||
struct ${1:`!p snip.rv = (snip.basename or "name") + "_t"`} {
|
|
||||||
${0:/* data */}
|
|
||||||
};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fun "function" b
|
|
||||||
${1:void} ${2:function_name}($3)
|
|
||||||
{
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fund "function declaration" b
|
|
||||||
${1:void} ${2:function_name}($3);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
global !p
|
|
||||||
def split_line(text):
|
|
||||||
import textwrap
|
|
||||||
lines = textwrap.wrap(text, 78 - 19)
|
|
||||||
output = list()
|
|
||||||
for line in lines:
|
|
||||||
output.append('*' + ' '*19 + line)
|
|
||||||
snip_line = snip.tabstops[4].end[0]
|
|
||||||
snip.buffer.append(output, snip_line + 1)
|
|
||||||
del snip.buffer[snip_line]
|
|
||||||
|
|
||||||
def get_args(arglist):
|
|
||||||
args = [arg.strip() for arg in arglist.split(',') if arg]
|
|
||||||
return args
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
post_jump "if snip.tabstop == 0 : split_line(snip.tabstops[4].current_text)"
|
|
||||||
snippet head "File Header" b
|
|
||||||
/******************************************************************************
|
|
||||||
* File: `!p snip.rv = fn`
|
|
||||||
*
|
|
||||||
* Author: ${2}
|
|
||||||
* Created: `date +%m/%d/%y`
|
|
||||||
* Description: ${4:${VISUAL}}
|
|
||||||
*****************************************************************************/
|
|
||||||
${0}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
post_jump "if snip.tabstop == 0 : split_line(snip.tabstops[4].current_text)"
|
|
||||||
snippet func "Function Header"
|
|
||||||
/******************************************************************************
|
|
||||||
* Function: $1
|
|
||||||
* Description: ${4:${VISUAL}}
|
|
||||||
* Where:`!p
|
|
||||||
snip.rv = ""
|
|
||||||
snip >> 2
|
|
||||||
|
|
||||||
args = get_args(t[2])
|
|
||||||
if args:
|
|
||||||
for arg in args:
|
|
||||||
snip.rv += '\n' + '*' + ' '*19 + arg + ' - TODO'
|
|
||||||
snip << 2
|
|
||||||
`
|
|
||||||
* Return: $5
|
|
||||||
* Error: $6
|
|
||||||
*****************************************************************************/
|
|
||||||
${1}($2){
|
|
||||||
${0}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -1,166 +0,0 @@
|
||||||
#
|
|
||||||
# CoffeeScript versions -- adapted from the JS TextMate bundle + additions
|
|
||||||
# for some jasmine-jquery matchers
|
|
||||||
#
|
|
||||||
priority -50
|
|
||||||
|
|
||||||
extends coffee
|
|
||||||
|
|
||||||
priority -49
|
|
||||||
|
|
||||||
snippet des "Describe (coffee)" b
|
|
||||||
describe '${1:description}', ->
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet it "it (coffee)" b
|
|
||||||
it '${1:description}', ->
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet bef "before each (coffee)" b
|
|
||||||
beforeEach ->
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet aft "after each (coffee)" b
|
|
||||||
afterEach ->
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet any "any (coffee)" b
|
|
||||||
jasmine.any($1)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ru "runs (coffee)" b
|
|
||||||
runs ->
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet wa "waits (coffee)" b
|
|
||||||
waits($1)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ex "expect (coffee)" b
|
|
||||||
expect(${1:target})$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ee "expect to equal (coffee)" b
|
|
||||||
expect(${1:target}).toEqual(${2:value})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet em "expect to match (coffee)" b
|
|
||||||
expect(${1:target}).toMatch(${2:pattern})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet eha "expect to have attribute (coffee)" b
|
|
||||||
expect(${1:target}).toHaveAttr('${2:attr}'${3:, '${4:value}'})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet et "expect to be truthy (coffee)" b
|
|
||||||
expect(${1:target}).toBeTruthy()
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ef "expect to be falsy (coffee)" b
|
|
||||||
expect(${1:target}).toBeFalsy()
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ed "expect to be defined (coffee)" b
|
|
||||||
expect(${1:target}).toBeDefined()
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet en "expect to be null (coffee)" b
|
|
||||||
expect(${1:target}).toBeNull()
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ec "expect to contain (coffee)" b
|
|
||||||
expect(${1:target}).toContain(${2:value})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ev "expect to be visible (coffee)" b
|
|
||||||
expect(${1:target}).toBeVisible()
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet eh "expect to be hidden (coffee)" b
|
|
||||||
expect(${1:target}).toBeHidden()
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet notx "expect not (coffee)" b
|
|
||||||
expect(${1:target}).not$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet note "expect not to equal (coffee)" b
|
|
||||||
expect(${1:target}).not.toEqual(${2:value})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet notm "expect not to match (coffee)" b
|
|
||||||
expect(${1:target}).not.toMatch(${2:pattern})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet notha "expect to not have attribute (coffee)" b
|
|
||||||
expect(${1:target}).not.toHaveAttr('${2:attr}'${3:, '${4:value}'})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet nott "expect not to be truthy (coffee)" b
|
|
||||||
expect(${1:target}).not.toBeTruthy()
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet notf "expect not to be falsy (coffee)" b
|
|
||||||
expect(${1:target}).not.toBeFalsy()
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet notd "expect not to be defined (coffee)" b
|
|
||||||
expect(${1:target}).not.toBeDefined()
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet notn "expect not to be null (coffee)" b
|
|
||||||
expect(${1:target}).not.toBeNull()
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet notc "expect not to contain (coffee)" b
|
|
||||||
expect(${1:target}).not.toContain(${2:value})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet notv "expect not to be visible (coffee)" b
|
|
||||||
expect(${1:target}).not.toBeVisible()
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet noth "expect not to be hidden (coffee)" b
|
|
||||||
expect(${1:target}).not.toBeHidden()
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet s "spy on (coffee)" b
|
|
||||||
spyOn(${1:object}, "${2:method}")$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sr "spy on and return (coffee)" b
|
|
||||||
spyOn(${1:object}, "${2:method}").andReturn(${3:arguments})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet st "spy on and throw (coffee)" b
|
|
||||||
spyOn(${1:object}, "${2:method}").andThrow(${3:exception})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sct "spy on and call through (coffee)" b
|
|
||||||
spyOn(${1:object}, "${2:method}").andCallThrough()
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet scf "spy on and call fake (coffee)" b
|
|
||||||
spyOn(${1:object}, "${2:method}").andCallFake(${3:function})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet esc "expect was called (coffee)" b
|
|
||||||
expect(${1:target}).wasCalled()
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet escw "expect was called with (coffee)" b
|
|
||||||
expect(${1:target}).wasCalledWith(${2:arguments})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet notsc "expect was not called (coffee)" b
|
|
||||||
expect(${1:target}).wasNotCalled()
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet noscw "expect was not called with (coffee)" b
|
|
||||||
expect(${1:target}).wasNotCalledWith(${2:arguments})
|
|
||||||
endsnippet
|
|
|
@ -1,80 +0,0 @@
|
||||||
#
|
|
||||||
# CoffeeScript versions -- adapted from coffee-jasmine
|
|
||||||
# for some ReactJS matchers.
|
|
||||||
#
|
|
||||||
priority -50
|
|
||||||
|
|
||||||
extends coffee
|
|
||||||
|
|
||||||
priority -49
|
|
||||||
|
|
||||||
snippet createClass "React define Class" b
|
|
||||||
${1:classname}Class = React.createClass
|
|
||||||
displayName: "$1"
|
|
||||||
render: ->
|
|
||||||
$2
|
|
||||||
$1 = React.createFactory($1)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet PropTypes "React define propTypes" b
|
|
||||||
propTypes: ->
|
|
||||||
${1:myVar}: React.PropTypes.${2:type}${3:.isRequired}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet propType "React propType (key/value)" b
|
|
||||||
${1:myVar}: React.PropTypes.${2:type}${3:.isRequired}
|
|
||||||
$4
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet setState "React setState" b
|
|
||||||
@setState
|
|
||||||
${1:myvar}: ${2:myvalue}
|
|
||||||
$3
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet getInitialState "React define getInitialState" b
|
|
||||||
getInitialState: ->
|
|
||||||
${1:myvar}: ${2:myvalue}
|
|
||||||
$3
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet getDefaultProps "React define getDefaultProps" b
|
|
||||||
getDefaultProps: ->
|
|
||||||
${1:myvar}: ${2:myvalue}
|
|
||||||
$3
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet componentWillMount "React define componentWillMount" b
|
|
||||||
componentWillMount: ->
|
|
||||||
$1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet componentDidMount "React define componentDidMount" b
|
|
||||||
componentDidMount: ->
|
|
||||||
$1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet componentWillReceiveProps "React define componentWillReceiveProps" b
|
|
||||||
componentWillReceiveProps: (nextProps) ->
|
|
||||||
$1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet shouldComponentUpdate "React define shouldComponentUpdate" b
|
|
||||||
shouldComponentUpdate: (nextProps, nextState) ->
|
|
||||||
$1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet componentWillUpdate "React define componentWillUpdate" b
|
|
||||||
componentWillUpdate: (nextProps, nextState) ->
|
|
||||||
$1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet componentDidUpdate "React define componentDidUpdate" b
|
|
||||||
componentDidUpdate: (prevProps, prevState) ->
|
|
||||||
$1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet componentWillUnmount "React define componentWillUnmount" b
|
|
||||||
componentWillUnmount: ->
|
|
||||||
$1
|
|
||||||
endsnippet
|
|
|
@ -1,100 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
snippet fun "Function" b
|
|
||||||
${1:name} = `!p snip.rv = "(" if t[2] else ""`${2:args}`!p snip.rv = ") " if t[2] else ""`->
|
|
||||||
${0:# body...}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet bfun "Function (bound)" i
|
|
||||||
`!p snip.rv = "(" if t[1] else ""`${1:args}`!p snip.rv = ") " if t[1] else ""`=>`!p snip.rv = " " if t[2] and not t[2].startswith("\n") else ""`${2:expr}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet if "If" b
|
|
||||||
if ${1:condition}
|
|
||||||
${0:# body...}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ife "If .. Else" b
|
|
||||||
if ${1:condition}
|
|
||||||
${2:# body...}
|
|
||||||
else
|
|
||||||
${3:# body...}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet elif "Else if" b
|
|
||||||
else if ${1:condition}
|
|
||||||
${0:# body...}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ifte "Ternary if" b
|
|
||||||
if ${1:condition} then ${2:value} else ${3:other}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet unl "Unless" b
|
|
||||||
${1:action} unless ${2:condition}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fora "Array Comprehension" b
|
|
||||||
for ${1:name} in ${2:array}
|
|
||||||
${0:# body...}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet foro "Object Comprehension" b
|
|
||||||
for ${1:key}, ${2:value} of ${3:Object}
|
|
||||||
${0:# body...}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet forr "Range Comprehension (inclusive)" b
|
|
||||||
for ${1:name} in [${2:start}..${3:finish}]`!p snip.rv = " by " if t[4] else ""`${4:step}
|
|
||||||
${0:# body...}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet forrex "Range Comprehension (exclusive)" b
|
|
||||||
for ${1:name} in [${2:start}...${3:finish}]`!p snip.rv = " by " if t[4] else ""`${4:step}
|
|
||||||
${0:# body...}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet swi "Switch" b
|
|
||||||
switch ${1:object}
|
|
||||||
when ${2:value}
|
|
||||||
${3:# body...}
|
|
||||||
else
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet swit "Switch when .. then" b
|
|
||||||
switch ${1:object}
|
|
||||||
when ${2:condition}`!p snip.rv = " then " if t[3] else ""`${3:value}
|
|
||||||
else`!p snip.rv = " " if t[4] and not t[4].startswith("\n") else ""`${4:value}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cla "Class" b
|
|
||||||
class ${1:ClassName}`!p snip.rv = " extends " if t[2] else ""`${2:Ancestor}
|
|
||||||
|
|
||||||
${3:constructor:`!p snip.rv = " (" if t[4] else ""`${4:args}`!p snip.rv = ")" if t[4] else ""` ->
|
|
||||||
${5:# body...}}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet try "Try .. Catch" b
|
|
||||||
try
|
|
||||||
$1
|
|
||||||
catch ${2:error}
|
|
||||||
$3
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet req "Require" b
|
|
||||||
${1/^'?(\w+)'?$/\L$1\E/} = require(${1:'${2:sys}'})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet # "Interpolated Code" i
|
|
||||||
#{$1}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet log "Log" b
|
|
||||||
console.log ${1:"${2:msg}"}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet kv "Key:value for object" b
|
|
||||||
${1:key}:${2:value}
|
|
||||||
endsnippet
|
|
|
@ -1,200 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
extends c
|
|
||||||
|
|
||||||
# We want to overwrite everything in parent ft.
|
|
||||||
priority -49
|
|
||||||
###########################################################################
|
|
||||||
# Global functions #
|
|
||||||
###########################################################################
|
|
||||||
|
|
||||||
global !p
|
|
||||||
|
|
||||||
def write_docstring_args(arglist, snip):
|
|
||||||
args = str(arglist).split(',')
|
|
||||||
|
|
||||||
if len(args) > 1:
|
|
||||||
c = 0
|
|
||||||
for arg in args:
|
|
||||||
if c == 0:
|
|
||||||
snip.rv += arg
|
|
||||||
c = 1
|
|
||||||
else:
|
|
||||||
snip += '* : %s' % arg.strip()
|
|
||||||
else:
|
|
||||||
snip.rv = args[0]
|
|
||||||
|
|
||||||
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
###########################################################################
|
|
||||||
# TextMate Snippets #
|
|
||||||
###########################################################################
|
|
||||||
snippet ponce "#pragma once include guard"
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet main
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
${0}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet forc "general for loop (for)"
|
|
||||||
for (${6:auto} ${1:i} = ${2:v.begin()}; `!p import re; snip.rv = re.split("[^\w]",t[1])[-1]` ${4:!=} ${3:`!p m = re.search(r'^(?:(.*)(\.|->)begin\(\)|((?:std|boost)::)?begin\((.*)\))$', t[2]); snip.rv = (((m.group(3) if m.group(3) else "") + "end(" + m.group(4) + ")") if m.group(4) else (m.group(1) + m.group(2) + "end()")) if m else ""`}; ${5:++`!p snip.rv = t[1].split(" ")[-1]`}) {
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet beginend "$1.begin(), $1.end() (beginend)"
|
|
||||||
${1:v}${1/^.*?(-)?(>)?$/(?2::(?1:>:.))/}begin(), $1${1/^.*?(-)?(>)?$/(?2::(?1:>:.))/}end()
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cl "class .. (class)"
|
|
||||||
class ${1:`!p snip.rv = snip.basename or "name"`}
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
${1/(\w+).*/$1/} (${2:arguments});
|
|
||||||
virtual ~${1/(\w+).*/$1/} ();
|
|
||||||
|
|
||||||
private:
|
|
||||||
${0:/* data */}
|
|
||||||
};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ns "namespace .. (namespace)"
|
|
||||||
namespace${1/.+/ /m}${1:`!p snip.rv = snip.basename or "name"`}
|
|
||||||
{
|
|
||||||
${VISUAL}$0
|
|
||||||
}${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"))
|
|
||||||
{
|
|
||||||
char buf[1024];
|
|
||||||
while(size_t len = fread(buf, 1, sizeof(buf), fp))
|
|
||||||
v.insert(v.end(), buf, buf + len);
|
|
||||||
fclose(fp);
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet map "std::map (map)"
|
|
||||||
std::map<${1:key}, ${2:value}> map$0;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet vector "std::vector (v)"
|
|
||||||
std::vector<${1:char}> v$0;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tp "template <typename ..> (template)"
|
|
||||||
template <typename ${1:_InputIter}>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cla "An entire .h generator" b
|
|
||||||
#ifndef ${2:`!v substitute(vim_snippets#Filename('$1_H','ClassName'),'.*','\U&\E','')`}
|
|
||||||
#define $2
|
|
||||||
|
|
||||||
class ${1:`!v substitute(substitute(vim_snippets#Filename('$1','ClassName'),'^.','\u&',''), '_\(\w\)', '\u\1', 'g')`}
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
$3
|
|
||||||
|
|
||||||
public:
|
|
||||||
$1();
|
|
||||||
virtual ~$1();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* $2 */
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet fnc "Basic c++ doxygen function template" b
|
|
||||||
/**
|
|
||||||
* @brief: ${4:brief}
|
|
||||||
*
|
|
||||||
* @param: `!p write_docstring_args(t[3],snip)`
|
|
||||||
*
|
|
||||||
* @return: `!p snip.rv = t[1]`
|
|
||||||
*/
|
|
||||||
${1:ReturnType} ${2:FunctionName}(${3:param})
|
|
||||||
{
|
|
||||||
${0:FunctionBody}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet boost_test "Boost test module" b
|
|
||||||
#define BOOST_TEST_MODULE ${1:TestModuleName}
|
|
||||||
#include <boost/test/included/unit_test.hpp>
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(${2:TestCaseName})
|
|
||||||
{
|
|
||||||
${0:TestDefinition}
|
|
||||||
}
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet boost_suite "Boost test suite module" b
|
|
||||||
#define BOOST_TEST_MODULE ${1:TestModuleName}
|
|
||||||
#include <boost/test/included/unit_test.hpp>
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE(${2:SuiteName})
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(${3:TestCaseName})
|
|
||||||
{
|
|
||||||
${0:TestDefinition}
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
snippet boost_test_fixture "Boost test module with fixture" b
|
|
||||||
#define BOOST_TEST_MODULE ${1:TestModuleName}
|
|
||||||
#include <boost/test/included/unit_test.hpp>
|
|
||||||
|
|
||||||
struct ${2:FixtureName} {
|
|
||||||
$2() {}
|
|
||||||
virtual ~$2() {}
|
|
||||||
/* define members here */
|
|
||||||
};
|
|
||||||
|
|
||||||
BOOST_FIXTURE_TEST_CASE(${3:SuiteName}, $2)
|
|
||||||
{
|
|
||||||
${0:TestDefinition}
|
|
||||||
}
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet boost_suite_fixture "Boost test suite with fixture" b
|
|
||||||
#define BOOST_TEST_MODULE ${1:TestModuleName}
|
|
||||||
#include <boost/test/included/unit_test.hpp>
|
|
||||||
|
|
||||||
struct ${2:FixtureName} {
|
|
||||||
$2() {}
|
|
||||||
virtual ~$2() {}
|
|
||||||
/* define members here */
|
|
||||||
};
|
|
||||||
|
|
||||||
BOOST_FIXTURE_TEST_SUITE(${3:SuiteName}, $2)
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(${4:TestCaseName})
|
|
||||||
{
|
|
||||||
${0:TestDefinition}
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -1,13 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
snippet "\b(de)?f" "def <name>..." r
|
|
||||||
def ${1:method_name}${2:(${3:*args})}
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "\b(pde)?f" "private def <name>..." r
|
|
||||||
private def ${1:method_name}${2:(${3:*args})}
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
|
@ -1,385 +0,0 @@
|
||||||
#######################################################################
|
|
||||||
# C# Snippets for UltiSnips #
|
|
||||||
#######################################################################
|
|
||||||
|
|
||||||
priority -50
|
|
||||||
|
|
||||||
#########################
|
|
||||||
# classes and structs #
|
|
||||||
#########################
|
|
||||||
|
|
||||||
snippet namespace "namespace" b
|
|
||||||
namespace ${1:MyNamespace}
|
|
||||||
{
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet class "class" w
|
|
||||||
${1:public} class ${2:`!p snip.rv = snip.basename`}
|
|
||||||
{
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet struct "struct" w
|
|
||||||
struct ${1:`!p snip.rv = snip.basename`}
|
|
||||||
{
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet interface "interface" w
|
|
||||||
interface I${1:`!p snip.rv = snip.basename`}
|
|
||||||
{
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet enum "enumeration" b
|
|
||||||
enum ${1:MyEnum} { ${2:Item} };
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
############
|
|
||||||
# Main() #
|
|
||||||
############
|
|
||||||
|
|
||||||
snippet sim "static int main" b
|
|
||||||
static int Main(string[] args)
|
|
||||||
{
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet svm "static void main" b
|
|
||||||
static void Main(string[] args)
|
|
||||||
{
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
################
|
|
||||||
# properties #
|
|
||||||
################
|
|
||||||
|
|
||||||
snippet prop "Simple property declaration" b
|
|
||||||
public ${1:int} ${2:MyProperty} { get; set; }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet propfull "Full property declaration" b
|
|
||||||
private ${1:int} ${2:_myProperty};
|
|
||||||
|
|
||||||
public $1 ${3:MyProperty}
|
|
||||||
{
|
|
||||||
get { return $2; }
|
|
||||||
set { $2 = value; }
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet propg "Property with a private setter" b
|
|
||||||
public ${1:int} ${2:MyProperty} { get; private set; }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
############
|
|
||||||
# blocks #
|
|
||||||
############
|
|
||||||
|
|
||||||
snippet #if "#if #endif" b
|
|
||||||
#if ${1:DEBUG}
|
|
||||||
${VISUAL}$0
|
|
||||||
#endif
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet #region "#region #endregion" b
|
|
||||||
#region ${1:Region}
|
|
||||||
${VISUAL}$0
|
|
||||||
#endregion
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
###########
|
|
||||||
# loops #
|
|
||||||
###########
|
|
||||||
|
|
||||||
snippet for "for loop" b
|
|
||||||
for (int ${1:i} = 0; $1 < ${2:10}; $1++)
|
|
||||||
{
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet forr "for loop (reverse)" b
|
|
||||||
for (int ${1:i} = ${2:10}; $1 >= 0; $1--)
|
|
||||||
{
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet foreach "foreach loop" b
|
|
||||||
foreach (${3:var} ${2:item} in ${1:items})
|
|
||||||
{
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet while "while loop" b
|
|
||||||
while (${1:true})
|
|
||||||
{
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet do "do loop" b
|
|
||||||
do
|
|
||||||
{
|
|
||||||
${VISUAL}$0
|
|
||||||
} while (${1:true});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
###############
|
|
||||||
# branching #
|
|
||||||
###############
|
|
||||||
|
|
||||||
snippet if "if statement" b
|
|
||||||
if ($1)
|
|
||||||
{
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ife "if else statement" b
|
|
||||||
if ($1)
|
|
||||||
{
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet elif "else if" b
|
|
||||||
else if ($1)
|
|
||||||
{
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet elseif "else if" b
|
|
||||||
else if ($1)
|
|
||||||
{
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ifnn "if not null" b
|
|
||||||
if ($1 != null)
|
|
||||||
{
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet switch "switch statement" b
|
|
||||||
switch (${1:statement})
|
|
||||||
{
|
|
||||||
case ${2:value}:
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
$0break;
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet case "case" b
|
|
||||||
case ${1:value}:
|
|
||||||
$2
|
|
||||||
break;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
##############
|
|
||||||
# wrappers #
|
|
||||||
##############
|
|
||||||
|
|
||||||
snippet using "using statement" b
|
|
||||||
using (${1:resource})
|
|
||||||
{
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet unchecked "unchecked block" b
|
|
||||||
unchecked
|
|
||||||
{
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet checked "checked block" b
|
|
||||||
checked
|
|
||||||
{
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet unsafe "unsafe" b
|
|
||||||
unsafe
|
|
||||||
{
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
########################
|
|
||||||
# exception handling #
|
|
||||||
########################
|
|
||||||
|
|
||||||
snippet try "try catch block" b
|
|
||||||
try
|
|
||||||
{
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
catch (${1:Exception} ${2:e})
|
|
||||||
{
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tryf "try finally block" b
|
|
||||||
try
|
|
||||||
{
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet throw "throw"
|
|
||||||
throw new $1Exception("$2");
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
##########
|
|
||||||
# LINQ #
|
|
||||||
##########
|
|
||||||
|
|
||||||
snippet from "LINQ syntax" b
|
|
||||||
var ${1:seq} =
|
|
||||||
from ${2:item1} in ${3:items1}
|
|
||||||
join ${4:item2} in ${5:items2} on $2.${6:prop1} equals $4.${7:prop2}
|
|
||||||
select ${8:$2.prop3}
|
|
||||||
where ${9:clause}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
############################
|
|
||||||
# feedback and debugging #
|
|
||||||
############################
|
|
||||||
|
|
||||||
snippet da "Debug.Assert" b
|
|
||||||
Debug.Assert(${1:true});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cw "Console.WriteLine" b
|
|
||||||
Console.WriteLine("$1");
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cr "Console.ReadLine" b
|
|
||||||
Console.ReadLine();
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# as you first type comma-separated parameters on the right, {n} values appear in the format string
|
|
||||||
snippet cwp "Console.WriteLine with parameters" b
|
|
||||||
Console.WriteLine("${2:`!p
|
|
||||||
snip.rv = ' '.join(['{' + str(i) + '}' for i in range(t[1].count(','))])
|
|
||||||
`}"${1:, something});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mbox "Message box" b
|
|
||||||
MessageBox.Show("${1:message}");
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
#############
|
|
||||||
# methods #
|
|
||||||
#############
|
|
||||||
|
|
||||||
snippet equals "Equality for a type" b
|
|
||||||
public override bool Equals(object obj) => Equals(obj as ${1:TYPE});
|
|
||||||
|
|
||||||
public bool Equals($1 other) // IEquatable<$1>
|
|
||||||
{
|
|
||||||
if (object.ReferenceEquals(other, null))
|
|
||||||
return false;
|
|
||||||
if (object.ReferenceEquals(this, other))
|
|
||||||
return true;
|
|
||||||
if (this.GetType() != other.GetType())
|
|
||||||
return false;
|
|
||||||
$0
|
|
||||||
return base.Equals(other);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int GetHashCode() => base.GetHashCode();
|
|
||||||
|
|
||||||
public static bool operator ==($1 x, $1 y) =>
|
|
||||||
(object.ReferenceEquals(x, null) && object.ReferenceEquals(y, null))
|
|
||||||
|| (!object.ReferenceEquals(x, null) && x.Equals(y));
|
|
||||||
|
|
||||||
public static bool operator !=($1 x, $1 y) => !(x == y);
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mth "Method" b
|
|
||||||
${1:public} ${2:void} ${3:MyMethod}(${4})
|
|
||||||
{
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mths "Static method" b
|
|
||||||
${1:public} static ${2:void} ${3:MyMethod}(${4})
|
|
||||||
{
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
###############
|
|
||||||
# constructor #
|
|
||||||
###############
|
|
||||||
|
|
||||||
snippet ctor "Constructor" b
|
|
||||||
${1:public} ${2:`!p snip.rv = snip.basename or "untitled"`}(${3})
|
|
||||||
{
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
##############
|
|
||||||
# comments #
|
|
||||||
##############
|
|
||||||
|
|
||||||
snippet /// "XML summary comment" b
|
|
||||||
/// <summary>
|
|
||||||
/// $0
|
|
||||||
/// </summary>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet <p "XML pramameter comment" w
|
|
||||||
<param name="${1}">${2}</param>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet <ex "XML exception comment" w
|
|
||||||
<exception cref="${1:System.Exception}">${2}</exception>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet <r "XML returns comment" w
|
|
||||||
<returns>$0</returns>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet <c "XML code comment" w
|
|
||||||
<code>$0</code>
|
|
||||||
endsnippet
|
|
|
@ -1,493 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
snippet p "padding"
|
|
||||||
padding: ${1:0};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet m "margin"
|
|
||||||
margin: ${1:0};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet bd "border"
|
|
||||||
border: ${1:0};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet d "display"
|
|
||||||
display: ${1:none};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet bg "background"
|
|
||||||
background: ${1:none};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ff "font-family"
|
|
||||||
font-family: ${1:"Helvetica Neue", Helvetica, Arial, sans-serif};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet h "height"
|
|
||||||
height: ${1:auto};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet w "width"
|
|
||||||
width: ${1:auto};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pos "position"
|
|
||||||
position: ${1:relative};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tt "text-transform"
|
|
||||||
text-transform: ${1:none};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ! "!important CSS (!)"
|
|
||||||
!important
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tsh "text-shadow: color-hex x y blur (text)"
|
|
||||||
text-shadow: ${1:${2:offset-x} ${3:offset-y} ${4:blur} ${5:color}};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet bxsh "box-shadow: color-hex x y blur (text)"
|
|
||||||
box-shadow: ${1:${2:offset-x} ${3:offset-y} ${4:blur} ${5:spread} ${6:color} ${7:inset}};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
#
|
|
||||||
# Colors
|
|
||||||
#
|
|
||||||
|
|
||||||
snippet rgb "color rgb"
|
|
||||||
rgb(${1:255}, ${2:255}, ${3:255})$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rgba "color rgba"
|
|
||||||
rgba(${1:255}, ${2:255}, ${3:255}, ${4:0.5})$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet hsl "color hsl"
|
|
||||||
hsl(${1:360}, ${2:100}%, ${3:100}%)$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet hsla "color hsla"
|
|
||||||
hsla(${1:360}, ${2:100}%, ${3:100}%, ${4:0.5})$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
#
|
|
||||||
# Selectors
|
|
||||||
#
|
|
||||||
|
|
||||||
snippet :fc
|
|
||||||
:first-child
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet :lc
|
|
||||||
:last-child
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet :nc
|
|
||||||
:nth-child($0)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet :nlc
|
|
||||||
:nth-last-child($0)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet :oc
|
|
||||||
:only-child
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
#
|
|
||||||
# Pseudo-elements
|
|
||||||
#
|
|
||||||
|
|
||||||
snippet :a
|
|
||||||
:after
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet :b
|
|
||||||
:before
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ::a
|
|
||||||
::after
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ::b
|
|
||||||
::before
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
###########################################################################
|
|
||||||
# Most of these came from TextMate #
|
|
||||||
###########################################################################
|
|
||||||
|
|
||||||
snippet background "background-attachment: scroll:fixed (background)"
|
|
||||||
background-attachment: ${1:scroll/fixed};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet background "background-color: color-hex (background)"
|
|
||||||
background-color: #${1:DDD};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet background "background-color: color-name (background)"
|
|
||||||
background-color: ${1:red};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet background "background-color: color-rgb (background)"
|
|
||||||
background-color: rgb(${1:255},${2:255},${3:255});$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet background "background-color: transparent (background)"
|
|
||||||
background-color: transparent;$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet background "background-image: none (background)"
|
|
||||||
background-image: none;$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet background "background-image: url (background)"
|
|
||||||
background-image: url($1);$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet background "background-position: position (background)"
|
|
||||||
background-position: ${1:top left/top center/top right/center left/center center/center right/bottom left/bottom center/bottom right/x-% y-%/x-pos y-pos};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet background "background-repeat: r:r-x:r-y:n-r (background)"
|
|
||||||
background-repeat: ${1:repeat/repeat-x/repeat-y/no-repeat};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet background "background: color image repeat attachment position (background)"
|
|
||||||
background:${6: #${1:DDD}} url($2) ${3:repeat/repeat-x/repeat-y/no-repeat} ${4:scroll/fixed} ${5:top left/top center/top right/center left/center center/center right/bottom left/bottom center/bottom right/x-% y-%/x-pos y-pos};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet border "border-bottom-color: size style color (border)"
|
|
||||||
border-bottom-color: #${1:999};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet border "border-bottom-style: size style color (border)"
|
|
||||||
border-bottom-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet border "border-bottom-width: size style color (border)"
|
|
||||||
border-bottom-width: ${1:1}px ${2:solid} #${3:999};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet border "border-bottom: size style color (border)"
|
|
||||||
border-bottom: ${1:1}px ${2:solid} #${3:999};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet border "border-color: color (border)"
|
|
||||||
border-color: ${1:999};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet border "border-left-color: color (border)"
|
|
||||||
border-right-color: #${1:999};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet border "border-left-style: style (border)"
|
|
||||||
border-left-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet border "border-left-width: size (border)"
|
|
||||||
border-left-width: ${1:1}px
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet border "border-left: size style color (border)"
|
|
||||||
border-left: ${1:1}px ${2:solid} #${3:999};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet border "border-right-color: color (border)"
|
|
||||||
border-right-color: #${1:999};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet border "border-right-style: style (border)"
|
|
||||||
border-right-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet border "border-right-width: size (border)"
|
|
||||||
border-right-width: ${1:1}px
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet border "border-right: size style color (border)"
|
|
||||||
border-right: ${1:1}px ${2:solid} #${3:999};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet border "border-style: style (border)"
|
|
||||||
border-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet border "border-top-color: color (border)"
|
|
||||||
border-top-color: #${1:999};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet border "border-top-style: style (border)"
|
|
||||||
border-top-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet border "border-top-width: size (border)"
|
|
||||||
border-top-width: ${1:1}px
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet border "border-top: size style color (border)"
|
|
||||||
border-top: ${1:1}px ${2:solid} #${3:999};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet border "border-width: width (border)"
|
|
||||||
border-width: ${1:1px};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet border "border: size style color (border)"
|
|
||||||
border: ${1:1px} ${2:solid} #${3:999};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet clear "clear: value (clear)"
|
|
||||||
clear: ${1:left/right/both/none};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet color "color: color-hex (color)"
|
|
||||||
color: #${1:DDD};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet color "color: color-name (color)"
|
|
||||||
color: ${1:red};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet color "color: color-rgb (color)"
|
|
||||||
color: rgb(${1:255},${2:255},${3:255});$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cursor "cursor: type (cursor)"
|
|
||||||
cursor: ${1:default/auto/crosshair/pointer/move/*-resize/text/wait/help};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cursor "cursor: url (cursor)"
|
|
||||||
cursor: url($1);$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet direction "direction: ltr|rtl (direction)"
|
|
||||||
direction: ${1:ltr|rtl};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet display "display: block (display)"
|
|
||||||
display: block;$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet display "display: common-types (display)"
|
|
||||||
display: ${1:none/inline/block/list-item/run-in/compact/marker};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet display "display: inline (display)"
|
|
||||||
display: inline;$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet display "display: table-types (display)"
|
|
||||||
display: ${1:table/inline-table/table-row-group/table-header-group/table-footer-group/table-row/table-column-group/table-column/table-cell/table-caption};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet float "float: left:right:none (float)"
|
|
||||||
float: ${1:left/right/none};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet font "font-family: family (font)"
|
|
||||||
font-family: ${1:Arial, "MS Trebuchet"}, ${2:sans-}serif;$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet font "font-size: size (font)"
|
|
||||||
font-size: ${1:100%};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet font "font-style: normal:italic:oblique (font)"
|
|
||||||
font-style: ${1:normal/italic/oblique};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet font "font-variant: normal:small-caps (font)"
|
|
||||||
font-variant: ${1:normal/small-caps};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet font "font-weight: weight (font)"
|
|
||||||
font-weight: ${1:normal/bold};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet font "font: style variant weight size:line-height font -family (font)"
|
|
||||||
font: ${1:normal/italic/oblique} ${2:normal/small-caps} ${3:normal/bold} ${4:1em/1.5em} ${5:Arial}, ${6:sans-}serif;$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet font "font: size font (font)"
|
|
||||||
font: ${1:75%} ${2:"Lucida Grande", "Trebuchet MS", Verdana,} ${3:sans-}serif;$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet letter "letter-spacing: length-em (letter)"
|
|
||||||
letter-spacing: $1em;$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet letter "letter-spacing: length-px (letter)"
|
|
||||||
letter-spacing: $1px;$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet list "list-style-image: url (list)"
|
|
||||||
list-style-image: url($1);$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet list "list-style-position: pos (list)"
|
|
||||||
list-style-position: ${1:inside/outside};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet list "list-style-type: asian (list)"
|
|
||||||
list-style-type: ${1:cjk-ideographic/hiragana/katakana/hiragana-iroha/katakana-iroha};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet list "list-style-type: marker(list)"
|
|
||||||
list-style-type: ${1:none/disc/circle/square};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet list "list-style-type: numeric (list)"
|
|
||||||
list-style-type: ${1:decimal/decimal-leading-zero/zero};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet list "list-style-type: other (list)"
|
|
||||||
list-style-type: ${1:hebrew/armenian/georgian};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet list "list-style-type: roman-alpha-greek (list)"
|
|
||||||
list-style-type: ${1:lower-roman/upper-roman/lower-alpha/upper-alpha/lower-greek/lower-latin/upper-latin};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet list "list-style: type position image (list)"
|
|
||||||
list-style: ${1:none/disc/circle/square/decimal/zero} ${2:inside/outside} url($3);$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet margin "margin-bottom: length (margin)"
|
|
||||||
margin-bottom: ${1:20px};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet margin "margin-left: length (margin)"
|
|
||||||
margin-left: ${1:20px};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet margin "margin-right: length (margin)"
|
|
||||||
margin-right: ${1:20px};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet margin "margin-top: length (margin)"
|
|
||||||
margin-top: ${1:20px};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet margin "margin: all (margin)"
|
|
||||||
margin: ${1:20px};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet margin "margin: T R B L (margin)"
|
|
||||||
margin: ${1:20px} ${2:0px} ${3:40px} ${4:0px};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet margin "margin: V H (margin)"
|
|
||||||
margin: ${1:20px} ${2:0px};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet marker "marker-offset: auto (marker)"
|
|
||||||
marker-offset: auto;$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet marker "marker-offset: length (marker)"
|
|
||||||
marker-offset: ${1:10px};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet overflow "overflow: type (overflow)"
|
|
||||||
overflow: ${1:visible/hidden/scroll/auto};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet padding "padding-bottom: length (margin)"
|
|
||||||
padding-bottom: ${1:20px};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet padding "padding-left: length (margin)"
|
|
||||||
padding-left: ${1:20px};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet padding "padding-right: length (margin)"
|
|
||||||
padding-right: ${1:20px};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet padding "padding-top: length (margin)"
|
|
||||||
padding-top: ${1:20px};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet padding "padding: T R B L (padding)"
|
|
||||||
padding: ${1:20px} ${2:0px} ${3:40px} ${4:0px};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet padding "padding: V H (padding)"
|
|
||||||
padding: ${1:20px} ${2:0px};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet padding "padding: all (padding)"
|
|
||||||
padding: ${1:20px};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet position "position: type (position)"
|
|
||||||
position: ${1:static/relative/absolute/fixed};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet { "properties { } ( } )"
|
|
||||||
{
|
|
||||||
/* $1 */
|
|
||||||
$0
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet scrollbar "scrollbar"
|
|
||||||
scrollbar-base-color: ${1:#CCCCCC};${2:
|
|
||||||
scrollbar-arrow-color: ${3:#000000};
|
|
||||||
scrollbar-track-color: ${4:#999999};
|
|
||||||
scrollbar-3dlight-color: ${5:#EEEEEE};
|
|
||||||
scrollbar-highlight-color: ${6:#FFFFFF};
|
|
||||||
scrollbar-face-color: ${7:#CCCCCC};
|
|
||||||
scrollbar-shadow-color: ${9:#999999};
|
|
||||||
scrollbar-darkshadow-color: ${8:#666666};}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet selection "selection"
|
|
||||||
$1::-moz-selection,
|
|
||||||
$1::selection {
|
|
||||||
color: ${2:inherit};
|
|
||||||
background: ${3:inherit};
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet text "text-align: left:center:right (txt)"
|
|
||||||
text-align: ${1:left/right/center/justify};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet text "text-decoration: none:underline:overline:line-through:blink (text)"
|
|
||||||
text-decoration: ${1:none/underline/overline/line-through/blink};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet text "text-indent: length (text)"
|
|
||||||
text-indent: ${1:10}px;$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet text "text-transform: capitalize:upper:lower (text)"
|
|
||||||
text-transform: ${1:capitalize/uppercase/lowercase};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet vertical "vertical-align: type (vertical)"
|
|
||||||
vertical-align: ${1:baseline/sub/super/top/text-top/middle/bottom/text-bottom/length/%};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet visibility "visibility: type (visibility)"
|
|
||||||
visibility: ${1:visible/hidden/collapse};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet white "white-space: normal:pre:nowrap (white)"
|
|
||||||
white-space: ${1:normal/pre/nowrap};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet word "word-spacing: length (word)"
|
|
||||||
word-spacing: ${1:10px};$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet z "z-index: index (z)"
|
|
||||||
z-index: $1;$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -1,5 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
extends cpp
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -1,584 +0,0 @@
|
||||||
# Simple shortcuts
|
|
||||||
|
|
||||||
priority -50
|
|
||||||
|
|
||||||
snippet imp "import (imp)" b
|
|
||||||
import ${1:std.stdio};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pimp "public import (pimp)" b
|
|
||||||
public import ${1:/*module*/};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet over "override (over)" b
|
|
||||||
override ${1:/*function*/}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet al "alias (al)"
|
|
||||||
alias ${1:/*orig*/} ${2:/*alias*/};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mixin "mixin (mixin)" b
|
|
||||||
mixin ${1:/*mixed_in*/} ${2:/*name*/};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet new "new (new)"
|
|
||||||
new $1($2);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet scpn "@safe const pure nothrow (scpn)"
|
|
||||||
@safe const pure nothrow
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet spn "@safe pure nothrow (spn)"
|
|
||||||
@safe pure nothrow
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cont "continue (cont)"
|
|
||||||
continue;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet dis "@disable (dis)" b
|
|
||||||
@disable ${1:/*method*/};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pub "public (pub)" b
|
|
||||||
public:
|
|
||||||
${1:/*members*/}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet priv "private (priv)" b
|
|
||||||
private:
|
|
||||||
${1:/*members*/}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet prot "protected (prot)" b
|
|
||||||
protected:
|
|
||||||
${1:/*members*/}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pack "package (pack)" b
|
|
||||||
package:
|
|
||||||
${1:/*members*/}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ret "return (ret)"
|
|
||||||
return ${1:/*value to return*/};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet auto "auto (auto)" b
|
|
||||||
auto ${1:/*variable*/} = ${2:/*value*/};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet con "const (con)" b
|
|
||||||
const ${1:/*variable*/} = ${2:/*value*/};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet siz "size_t (siz)" b
|
|
||||||
size_t ${1:/*variable*/} = ${2:/*value*/};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sup "super (sup)" b
|
|
||||||
super(${1:/*args*/});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Phobos
|
|
||||||
|
|
||||||
snippet tup "tuple (tup)"
|
|
||||||
tuple(${1:/*args*/})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet wr "writeln (wr)"
|
|
||||||
writeln(${1:/*args*/});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet to "to (to)"
|
|
||||||
to!(${1:/*type*/})(${2:/*arg*/})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet enf "enforce (enf)" b
|
|
||||||
enforce(${1:/*condition*/},
|
|
||||||
new $2Exception(${3:/*args*/}));
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Branches
|
|
||||||
|
|
||||||
snippet if "if .. (if)"
|
|
||||||
if(${1:/*condition*/})
|
|
||||||
{
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ife "if .. else (ife)" b
|
|
||||||
if(${1:/*condition*/})
|
|
||||||
{
|
|
||||||
$2
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
${3:/*else*/}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet el "else (el)" b
|
|
||||||
else
|
|
||||||
{
|
|
||||||
${VISUAL}$1
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet elif "else if (elif)" b
|
|
||||||
else if(${1:/*condition*/})
|
|
||||||
{
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sw "switch (sw)"
|
|
||||||
switch(${1:/*var*/})
|
|
||||||
{
|
|
||||||
case ${2:/*value*/}:
|
|
||||||
$3
|
|
||||||
break;
|
|
||||||
case ${4:/*value*/}:
|
|
||||||
$5
|
|
||||||
break;
|
|
||||||
${7:/*more cases*/}
|
|
||||||
default:
|
|
||||||
${6:assert(false);}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fsw "final switch (fsw)"
|
|
||||||
final switch(${1:/*var*/})
|
|
||||||
{
|
|
||||||
case ${2:/*value*/}:
|
|
||||||
$3
|
|
||||||
break;
|
|
||||||
case ${4:/*value*/}:
|
|
||||||
$5
|
|
||||||
break;
|
|
||||||
${7:/*more cases*/}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet case "case (case)" b
|
|
||||||
case ${1:/*value*/}:
|
|
||||||
$2
|
|
||||||
break;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ?: "ternary operator (?:)"
|
|
||||||
${1:/*condition*/} ? ${2:/*then*/} : ${3:/*else*/}$4
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Loops
|
|
||||||
|
|
||||||
snippet do "do while (do)" b
|
|
||||||
do
|
|
||||||
{
|
|
||||||
${VISUAL}$2
|
|
||||||
} while(${1:/*condition*/});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet wh "while (wh)" b
|
|
||||||
while(${1:/*condition*/})
|
|
||||||
{
|
|
||||||
${VISUAL}$2
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet for "for (for)" b
|
|
||||||
for (${4:size_t} ${2:i} = 0; $2 < ${1:count}; ${3:++$2})
|
|
||||||
{
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet forever "forever (forever)" b
|
|
||||||
for(;;)
|
|
||||||
{
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fore "foreach (fore)"
|
|
||||||
foreach(${1:/*elem*/}; ${2:/*range*/})
|
|
||||||
{
|
|
||||||
${VISUAL}$3
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet forif "foreach if (forif)" b
|
|
||||||
foreach(${1:/*elem*/}; ${2:/*range*/}) if(${3:/*condition*/})
|
|
||||||
{
|
|
||||||
${VISUAL}$4
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Contracts
|
|
||||||
snippet in "in contract (in)" b
|
|
||||||
in
|
|
||||||
{
|
|
||||||
assert(${1:/*condition*/}, "${2:error message}");
|
|
||||||
$3
|
|
||||||
}
|
|
||||||
body
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet out "out contract (out)" b
|
|
||||||
out${1:(result)}
|
|
||||||
{
|
|
||||||
assert(${2:/*condition*/}, "${3:error message}");
|
|
||||||
$4
|
|
||||||
}
|
|
||||||
body
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet inv "invariant (inv)" b
|
|
||||||
invariant()
|
|
||||||
{
|
|
||||||
assert(${1:/*condition*/}, "${2:error message}");
|
|
||||||
$3
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Functions (generic)
|
|
||||||
|
|
||||||
snippet fun "function definition (fun)"
|
|
||||||
${1:void} ${2:/*function name*/}(${3:/*args*/}) ${4:@safe pure nothrow}
|
|
||||||
{
|
|
||||||
${VISUAL}$5
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet void "void function definition (void)"
|
|
||||||
void ${1:/*function name*/}(${2:/*args*/}) ${3:@safe pure nothrow}
|
|
||||||
{
|
|
||||||
${VISUAL}$4
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet this "ctor (this)" w
|
|
||||||
this(${1:/*args*/})
|
|
||||||
{
|
|
||||||
${VISUAL}$2
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet get "getter property (get)"
|
|
||||||
@property ${1:/*type*/} ${2:/*member_name*/}() const pure nothrow {return ${3:$2_};}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet set "setter property (set)"
|
|
||||||
@property void ${1:/*member_name*/}(${2:/*type*/} rhs) pure nothrow {${3:$1_} = rhs;}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Functions (concrete)
|
|
||||||
|
|
||||||
snippet main "Main" b
|
|
||||||
void main(string[] args)
|
|
||||||
{
|
|
||||||
${VISUAL}${0: /*code*/}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Mixins
|
|
||||||
|
|
||||||
snippet signal "signal (signal)" b
|
|
||||||
mixin Signal!(${1:/*args*/}) ${2:/*name*/};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Scope
|
|
||||||
|
|
||||||
snippet scope "scope (scope)" b
|
|
||||||
scope(${1:exit})
|
|
||||||
{
|
|
||||||
${VISUAL}$2
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# With
|
|
||||||
|
|
||||||
snippet with "with (with)"
|
|
||||||
with($1)
|
|
||||||
{
|
|
||||||
${VISUAL}$2
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Exception handling
|
|
||||||
|
|
||||||
snippet try "try/catch (try)" b
|
|
||||||
try
|
|
||||||
{
|
|
||||||
${VISUAL}${1:/*code to try*/}
|
|
||||||
}
|
|
||||||
catch($2Exception e)
|
|
||||||
{
|
|
||||||
${3:/*handle exception*/}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tryf "try/catch/finally (tryf)" b
|
|
||||||
try
|
|
||||||
{
|
|
||||||
${VISUAL}${1:/*code to try*/}
|
|
||||||
}
|
|
||||||
catch($2Exception e)
|
|
||||||
{
|
|
||||||
${3:/*handle exception*/}
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
${4:/*cleanup*/}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet catch "catch (catch)" b
|
|
||||||
catch($1Exception e)
|
|
||||||
{
|
|
||||||
${2:/*handle exception*/}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet thr "throw (thr)"
|
|
||||||
throw new $1Exception("$2");
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
# Type declarations
|
|
||||||
|
|
||||||
snippet struct "struct (struct)"
|
|
||||||
struct ${1:`!p snip.rv = (snip.basename or "name")`}
|
|
||||||
{
|
|
||||||
$2
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet union "union (union)"
|
|
||||||
union ${1:`!p snip.rv = (snip.basename or "name")`}
|
|
||||||
{
|
|
||||||
$2
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet class "class (class)"
|
|
||||||
class ${1:`!p snip.rv = (snip.basename or "name")`}
|
|
||||||
{
|
|
||||||
$2
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet inter "interface (inter)"
|
|
||||||
interface ${1:`!p snip.rv = (snip.basename or "name")`}
|
|
||||||
{
|
|
||||||
$2
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet enum "enum (enum)"
|
|
||||||
enum ${1:`!p snip.rv = (snip.basename or "name")`}
|
|
||||||
{
|
|
||||||
$2
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
# Exception declarations
|
|
||||||
|
|
||||||
snippet exc "exception declaration (exc)" b
|
|
||||||
/// ${3:/*documentation*/}
|
|
||||||
class $1Exception : $2Exception
|
|
||||||
{
|
|
||||||
public this(string msg, string file = __FILE__, int line = __LINE__)
|
|
||||||
{
|
|
||||||
super(msg, file, line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
# Conditional compilation
|
|
||||||
|
|
||||||
snippet version "version (version)" b
|
|
||||||
version(${1:/*version name*/})
|
|
||||||
{
|
|
||||||
${VISUAL}$2
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet debug "debug" b
|
|
||||||
debug
|
|
||||||
{
|
|
||||||
${VISUAL}$1
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
# Templates
|
|
||||||
|
|
||||||
snippet temp "template (temp)" b
|
|
||||||
template ${2:/*name*/}(${1:/*args*/})
|
|
||||||
{
|
|
||||||
$3
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
# Asserts
|
|
||||||
|
|
||||||
snippet ass "assert (ass)" b
|
|
||||||
assert(${1:false}, "${2:TODO}");
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
# Unittests
|
|
||||||
|
|
||||||
snippet unittest "unittest (unittest)" b
|
|
||||||
unittest
|
|
||||||
{
|
|
||||||
$1
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
# Common member functions
|
|
||||||
|
|
||||||
snippet opDis "opDispatch (opDis)" b
|
|
||||||
${1:/*return type*/} opDispatch(string s)()
|
|
||||||
{
|
|
||||||
$2;
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet op= "opAssign (op=)" b
|
|
||||||
void opAssign($1 rhs) ${2:@safe pure nothrow}
|
|
||||||
{
|
|
||||||
$2
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet opCmp "opCmp (opCmp)" b
|
|
||||||
int opCmp($1 rhs) @safe const pure nothrow
|
|
||||||
{
|
|
||||||
$2
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet opApply "opApply (opApply)" b
|
|
||||||
int opApply(int delegate(ref ${1:/*iterated type/s*/}) dg)
|
|
||||||
{
|
|
||||||
int result = 0;
|
|
||||||
${2:/*loop*/}
|
|
||||||
{
|
|
||||||
result = dg(${3:/*arg/s*/});
|
|
||||||
if(result){break;}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet toString "toString (toString)" b
|
|
||||||
string toString() @safe const pure nothrow
|
|
||||||
{
|
|
||||||
$1
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
# Comments
|
|
||||||
|
|
||||||
|
|
||||||
snippet todo "TODO (todo)"
|
|
||||||
// TODO: $1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
# DDoc
|
|
||||||
|
|
||||||
snippet doc "generic ddoc block (doc)" b
|
|
||||||
/// ${1:description}
|
|
||||||
///
|
|
||||||
/// ${2:details}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fdoc "function ddoc block (fdoc)" b
|
|
||||||
/// ${1:description}
|
|
||||||
///
|
|
||||||
/// ${2:Params: ${3:param} = ${4:param description}
|
|
||||||
/// $5}
|
|
||||||
///
|
|
||||||
/// ${6:Returns: ${7:return value}}
|
|
||||||
///
|
|
||||||
/// ${8:Throws: $9Exception $10}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet Par "Params (Par)"
|
|
||||||
Params: ${1:param} = ${2:param description}
|
|
||||||
/// $3
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet Ret "Returns (Ret)"
|
|
||||||
Returns: ${1:return value/s}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet Thr "Throws (Thr)"
|
|
||||||
Throws: $1Exception $2
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet Example "Examples (Example)"
|
|
||||||
Examples:
|
|
||||||
/// --------------------
|
|
||||||
/// ${1:example code}
|
|
||||||
/// --------------------
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
# License blocks
|
|
||||||
|
|
||||||
snippet gpl "GPL (gpl)" b
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation; either version 2 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
//
|
|
||||||
// Copyright (C) ${1:Author}, `!v strftime("%Y")`
|
|
||||||
|
|
||||||
$2
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet boost "Boost (boost)" b
|
|
||||||
// Copyright ${1:Author} `!v strftime("%Y")`.
|
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
|
|
||||||
$2
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
# New module
|
|
||||||
|
|
||||||
snippet module "New module (module)" b
|
|
||||||
// Copyright ${1:Author} `!v strftime("%Y")`.
|
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
|
|
||||||
module $2.`!v vim_snippets#Filename('$1', 'name')`;
|
|
||||||
|
|
||||||
|
|
||||||
$3
|
|
||||||
endsnippet
|
|
|
@ -1,360 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
# This files will define django snippets from sublime text djaneiro
|
|
||||||
# FORMS SNIPPETS
|
|
||||||
|
|
||||||
snippet form "Form" b
|
|
||||||
class ${1:FORMNAME}(forms.Form):
|
|
||||||
|
|
||||||
${2:# TODO: Define form fields here}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet modelform "ModelForm" b
|
|
||||||
class ${1:MODELNAME}Form(forms.ModelForm):
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
model = $1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fbool "BooleanField" b
|
|
||||||
${1:FIELDNAME} = forms.BooleanField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fchar "CharField" b
|
|
||||||
${1:FIELDNAME} = forms.CharField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fchoice "ChoiceField" b
|
|
||||||
${1:FIELDNAME} = forms.ChoiceField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fcombo "ComboField" b
|
|
||||||
${1:FIELDNAME} = forms.ComboField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fdate "DateField" b
|
|
||||||
${1:FIELDNAME} = forms.DateField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fdatetime "DateTimeField" b
|
|
||||||
${1:FIELDNAME} = forms.DateTimeField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fdecimal "DecimalField" b
|
|
||||||
${1:FIELDNAME} = forms.DecimalField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fmail "EmailField" b
|
|
||||||
${1:FIELDNAME} = forms.EmailField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ffile "FileField" b
|
|
||||||
${1:FIELDNAME} = forms.FileField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ffilepath "FilePathField" b
|
|
||||||
${1:FIELDNAME} = forms.FilePathField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ffloat "FloatField" b
|
|
||||||
${1:FIELDNAME} = forms.FloatField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fip "IPAddressField" b
|
|
||||||
${1:FIELDNAME} = forms.IPAddressField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fimg "ImageField" b
|
|
||||||
${1:FIELDNAME} = forms.ImageField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fint "IntegerField" b
|
|
||||||
${1:FIELDNAME} = forms.IntegerField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fmochoice "ModelChoiceField" b
|
|
||||||
${1:FIELDNAME} = forms.ModelChoiceField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fmomuchoice "ModelMultipleChoiceField" b
|
|
||||||
${1:FIELDNAME} = forms.ModelMultipleChoiceField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fmuval "MultiValueField" b
|
|
||||||
${1:FIELDNAME} = forms.MultiValueField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fmuchoice "MultipleChoiceField" b
|
|
||||||
${1:FIELDNAME} = forms.MultipleChoiceField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fnullbool "NullBooleanField" b
|
|
||||||
${1:FIELDNAME} = forms.NullBooleanField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet freg "RegexField" b
|
|
||||||
${1:FIELDNAME} = forms.RegexField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fslug "SlugField" b
|
|
||||||
${1:FIELDNAME} = forms.SlugField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fsdatetime "SplitDateTimeField" b
|
|
||||||
${1:FIELDNAME} = forms.SplitDateTimeField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ftime "TimeField" b
|
|
||||||
${1:FIELDNAME} = forms.TimeField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ftchoice "TypedChoiceField" b
|
|
||||||
${1:FIELDNAME} = forms.TypedChoiceField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ftmuchoice "TypedMultipleChoiceField" b
|
|
||||||
${1:FIELDNAME} = forms.TypedMultipleChoiceField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet furl "URLField" b
|
|
||||||
${1:FIELDNAME} = forms.URLField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# MODELS SNIPPETS
|
|
||||||
|
|
||||||
snippet model "Model" b
|
|
||||||
class ${1:MODELNAME}(models.Model):
|
|
||||||
$0
|
|
||||||
class Meta:
|
|
||||||
verbose_name = "$1"
|
|
||||||
verbose_name_plural = "$1s"
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return super($1, self).__str__()
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet modelfull "Model" b
|
|
||||||
class ${1:MODELNAME}(models.Model):
|
|
||||||
${2:# TODO: Define fields here}
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
verbose_name = "$1"
|
|
||||||
verbose_name_plural = "$1s"
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return super($1, self).__str__()
|
|
||||||
|
|
||||||
def save(self):
|
|
||||||
return super($1, self).save()
|
|
||||||
|
|
||||||
def get_absolute_url(self):
|
|
||||||
return ('')
|
|
||||||
|
|
||||||
${3:# TODO: Define custom methods here}
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mauto "AutoField" b
|
|
||||||
${1:FIELDNAME} = models.AutoField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mbigint "BigIntegerField" b
|
|
||||||
${1:FIELDNAME} = models.BigIntegerField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mbool "BooleanField" b
|
|
||||||
${1:FIELDNAME} = models.BooleanField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mchar "CharField" b
|
|
||||||
${1:FIELDNAME} = models.CharField($2, max_length=${3:50})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mcoseint "CommaSeparatedIntegerField" b
|
|
||||||
${1:FIELDNAME} = models.CommaSeparatedIntegerField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mdate "DateField" b
|
|
||||||
${1:FIELDNAME} = models.DateField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mdatetime "DateTimeField" b
|
|
||||||
${1:FIELDNAME} = models.DateTimeField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mdecimal "DecimalField" b
|
|
||||||
${1:FIELDNAME} = models.DecimalField(max_digits=${2:10}, decimal_places=${3:2})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet memail "EmailField" b
|
|
||||||
${1:FIELDNAME} = models.EmailField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mfile "FileField" b
|
|
||||||
${1:FIELDNAME} = models.FileField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mfilepath "FilePathField" b
|
|
||||||
${1:FIELDNAME} = models.FilePathField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mfloat "FloatField" b
|
|
||||||
${1:FIELDNAME} = models.FloatField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fk "ForeignKey" b
|
|
||||||
${1:FIELDNAME} = models.ForeignKey($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mip "IPAddressField" b
|
|
||||||
${1:FIELDNAME} = models.IPAddressField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mimg "ImageField" b
|
|
||||||
${1:FIELDNAME} = models.ImageField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mint "IntegerField" b
|
|
||||||
${1:FIELDNAME} = models.IntegerField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet m2m "ManyToManyField" b
|
|
||||||
${1:FIELDNAME} = models.ManyToManyField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mnullbool "NullBooleanField" b
|
|
||||||
${1:FIELDNAME} = models.NullBooleanField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet o2o "OneToOneField" b
|
|
||||||
${1:FIELDNAME} = models.OneToOneField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mphone "PhoneNumberField" b
|
|
||||||
${1:FIELDNAME} = models.PhoneNumberField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mposint "PositiveIntegerField" b
|
|
||||||
${1:FIELDNAME} = models.PositiveIntegerField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mpossmallint "PositiveSmallIntegerField" b
|
|
||||||
${1:FIELDNAME} = models.PositiveSmallIntegerField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mslug "SlugField" b
|
|
||||||
${1:FIELDNAME} = models.SlugField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet msmallint "SmallIntegerField" b
|
|
||||||
${1:FIELDNAME} = models.SmallIntegerField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mtext "TextField" b
|
|
||||||
${1:FIELDNAME} = models.TextField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mtime "TimeField" b
|
|
||||||
${1:FIELDNAME} = models.TimeField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet murl "URLField" b
|
|
||||||
${1:FIELDNAME} = models.URLField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet musstate "USStateField" b
|
|
||||||
${1:FIELDNAME} = models.USStateField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mxml "XMLField" b
|
|
||||||
${1:FIELDNAME} = models.XMLField($2)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# VIEWS SNIPPETS
|
|
||||||
|
|
||||||
snippet adminview "Model Admin View" b
|
|
||||||
class $1Admin(admin.ModelAdmin):
|
|
||||||
'''
|
|
||||||
Admin View for $1
|
|
||||||
'''
|
|
||||||
list_display = ('$2',)
|
|
||||||
list_filter = ('$3',)
|
|
||||||
inlines = [
|
|
||||||
$4Inline,
|
|
||||||
]
|
|
||||||
raw_id_fields = ('$5',)
|
|
||||||
readonly_fields = ('$6',)
|
|
||||||
search_fields = ['$7']
|
|
||||||
admin.site.register($1, $1Admin)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet createview "Generic Create View" b
|
|
||||||
class ${1:MODEL_NAME}CreateView(CreateView):
|
|
||||||
model = $1
|
|
||||||
template_name = "${2:TEMPLATE_NAME}"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet deleteview "Generic Delete View" b
|
|
||||||
class ${1:MODEL_NAME}DeleteView(DeleteView):
|
|
||||||
model = $1
|
|
||||||
template_name = "${2:TEMPLATE_NAME}"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet detailview "Generic Detail View" b
|
|
||||||
class ${1:MODEL_NAME}DetailView(DetailView):
|
|
||||||
model = $1
|
|
||||||
template_name = "${2:TEMPLATE_NAME}"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet listview "Generic List View" b
|
|
||||||
class ${1:MODEL_NAME}ListView(ListView):
|
|
||||||
model = $1
|
|
||||||
template_name = "${2:TEMPLATE_NAME}"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet stackedinline "Stacked Inline" b
|
|
||||||
class $1Inline(admin.StackedInline):
|
|
||||||
'''
|
|
||||||
Stacked Inline View for $1
|
|
||||||
'''
|
|
||||||
model = ${2:$1}
|
|
||||||
min_num = ${3:3}
|
|
||||||
max_num = ${4:20}
|
|
||||||
extra = ${5:1}
|
|
||||||
raw_id_fields = ($6,)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tabularinline "Tabular Inline" b
|
|
||||||
class $1Inline(admin.TabularInline):
|
|
||||||
'''
|
|
||||||
Tabular Inline View for $1
|
|
||||||
'''
|
|
||||||
model = ${2:$1}
|
|
||||||
min_num = ${3:3}
|
|
||||||
max_num = ${4:20}
|
|
||||||
extra = ${5:1}
|
|
||||||
raw_id_fields = ($6,)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet templateview "Generic Template View" b
|
|
||||||
class ${1:CLASS_NAME}(TemplateView):
|
|
||||||
template_name = "${2:TEMPLATE_NAME}"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet updateview "Generic Update View" b
|
|
||||||
class ${1:MODEL_NAME}UpdateView(UpdateView):
|
|
||||||
model = $1
|
|
||||||
template_name = "${2:TEMPLATE_NAME}"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet dispatch "Dispatch View method" b
|
|
||||||
def dispatch(self, request, *args, **kwargs):
|
|
||||||
return super(${1:CLASS_NAME}, self).dispatch(request, *args, **kwargs)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet context "get_context_data view method" b
|
|
||||||
def get_context_data(self, **kwargs):
|
|
||||||
kwargs['extra_context'] = ${1:'New Value'}
|
|
||||||
return super(${2:CLASS_NAME}, self).get_context_data(**kwargs)
|
|
||||||
endsnippet
|
|
|
@ -1,43 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
extends html
|
|
||||||
|
|
||||||
snippet % "<% %>" w
|
|
||||||
<% $0 %>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet = "<%= %>" w
|
|
||||||
<%= $0 %>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet end "<% end %>" w
|
|
||||||
<% end %>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet for
|
|
||||||
<%= for ${1:item} <- ${2:$1s} ${3:@conn} do %>
|
|
||||||
$0
|
|
||||||
<% end %>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ft "form_tag" w
|
|
||||||
<%= form_tag(${1:"${2:/users}"}, method: ${3::post}) %>
|
|
||||||
$0
|
|
||||||
</form>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet lin "link" w
|
|
||||||
<%= link ${1:"${2:Submit}"}, to: ${3:"${4:/users}"}, method: ${5::delete} %>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ff "form_for" w
|
|
||||||
<%= form_for @changeset, ${1:"${2:/users}"}, fn f -> %>
|
|
||||||
$0
|
|
||||||
|
|
||||||
<%= submit "Submit" %>
|
|
||||||
<% end %>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet gt "gettext" w
|
|
||||||
<%= gettext("${0:${VISUAL}}") %>
|
|
||||||
endsnippet
|
|
|
@ -1,10 +0,0 @@
|
||||||
snippet for "ejs for loop" b
|
|
||||||
<% for (let ${1:i = 0}; ${2:i<arr.length}; ${3:i++}) { %>
|
|
||||||
${0:body}
|
|
||||||
<% } %>
|
|
||||||
endsnippet
|
|
||||||
snippet forE "ejs for Each loop" b
|
|
||||||
<% ${1:array}.forEach((${2:single var}) => { %>
|
|
||||||
${0:body}
|
|
||||||
<% }) %>
|
|
||||||
endsnippet
|
|
|
@ -1,9 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
snippet impa "Qualified import"
|
|
||||||
import ${1:Json.Encode} as ${0:`!p snip.rv = t[1].split(".")[-1]`}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet impae "Qualified import with exposing"
|
|
||||||
import ${1:Json.Encode} as ${2:`!p snip.rv = t[1].split(".")[-1]`} exposing (${0:Value})
|
|
||||||
endsnippet
|
|
|
@ -1,24 +0,0 @@
|
||||||
###########################################################################
|
|
||||||
# TEXTMATE SNIPPETS #
|
|
||||||
###########################################################################
|
|
||||||
|
|
||||||
priority -50
|
|
||||||
|
|
||||||
snippet pat "Case:Receive:Try Clause"
|
|
||||||
${1:pattern}${2: when ${3:guard}} ->
|
|
||||||
${4:body}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mod "Module Directive" b
|
|
||||||
-module(${1:`!p snip.rv = snip.basename or "module"`}).
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet || "List Comprehension"
|
|
||||||
[${1:X} || ${2:X} <- ${3:List}${4:, gen}]
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet gen "Generator Expression"
|
|
||||||
${1:X} <- ${2:List}${3:, gen}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -1,237 +0,0 @@
|
||||||
extends html
|
|
||||||
|
|
||||||
priority -50
|
|
||||||
|
|
||||||
# TextMate added these variables to cope with changes in ERB handling
|
|
||||||
# in different versions of Rails -- for instance, Rails 3 automatically
|
|
||||||
# strips whitespace so that it's no longer necessary to use a form like
|
|
||||||
# <% end -%>, but if you're still maintaining Rails 2 projects, you
|
|
||||||
# can't omit the minus sign and get the same behavior.
|
|
||||||
#
|
|
||||||
# The following regex replace substitutes the function below for the
|
|
||||||
# TextMate variable references after the snippets are converted:
|
|
||||||
#
|
|
||||||
# /\v\$\{(TM_RAILS_TEMPLATE_([^_]+)_RUBY_([^_\s]+))\}/`!p textmate_var('\1', snip)`/g
|
|
||||||
#
|
|
||||||
global !p
|
|
||||||
def textmate_var(var, snip):
|
|
||||||
lookup = dict(
|
|
||||||
TM_RAILS_TEMPLATE_START_RUBY_EXPR = snip.opt('g:tm_rails_template_start_ruby_expr', '<%= '),
|
|
||||||
TM_RAILS_TEMPLATE_END_RUBY_EXPR = snip.opt('g:tm_rails_template_end_ruby_expr', ' %>'),
|
|
||||||
TM_RAILS_TEMPLATE_START_RUBY_INLINE = snip.opt('g:tm_rails_template_start_ruby_inline', '<% '),
|
|
||||||
TM_RAILS_TEMPLATE_END_RUBY_INLINE = snip.opt('g:tm_rails_template_end_ruby_inline', ' %>'),
|
|
||||||
TM_RAILS_TEMPLATE_END_RUBY_BLOCK = '<% end %>'
|
|
||||||
)
|
|
||||||
snip.rv = lookup[var]
|
|
||||||
return
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
|
|
||||||
snippet % "<% $0 %>" i
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`$0`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet = "<%= $0 %>" i
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`$0`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
###########################################################################
|
|
||||||
# GENERATED FROM get_tm_snippets.py + REGEX REPLACE #
|
|
||||||
###########################################################################
|
|
||||||
|
|
||||||
snippet fi "<%= Fixtures.identify(:symbol) %>"
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`Fixtures.identify(:${1:name})`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ft "form_tag" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`form_tag(${1:action: '${2:update}'}${3:, ${4:${5:class}: '${6:form}'\}}}) do`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
$0
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ffs "form_for submit 2" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`${1:f}.submit '${2:Submit}'${3:, disable_with: '${4:$2ing...}'}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet f. "f_fields_for (nff)" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`f.fields_for :${1:attribute} do |${2:f}|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)`
|
|
||||||
$0
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet f. "f.checkbox" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.check_box :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet f. "f.file_field" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.file_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet f. "f.hidden_field" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.hidden_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet f. "f.label" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.label :${1:attribute}${2:, "${3:${1/[[:alpha:]]+|(_)/(?1: :\u$0)/g}}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet f. "f.password_field" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.password_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet f. "f.radio_button" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.radio_button :${1:attribute}, :${2:tag_value}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet f. "f.submit" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.submit "${1:Submit}"${2:, disable_with: '${3:$1ing...}'}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet f. "f.text_area" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.text_area :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet f. "f.text_field" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.text_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ffe "form_for with errors" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`error_messages_for :${1:model}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`form_for @${2:$1} do |f|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
$0
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ff "form_for" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`form_for @${1:model} do |f|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
$0
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ist "image_submit_tag" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`image_submit_tag("${1:agree.png}"${2:${3:, id: "${4:${1/^(\w+)(\.\w*)?$/$1/}}"}${5:, name: "${6:${1/^(\w+)(\.\w*)?$/$1/}}"}${7:, class: "${8:${1/^(\w+)(\.\w*)?$/$1/}-button}"}${9:, disabled: ${10:false}}})`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet it "image_tag" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`image_tag "$1${2:.png}"${3:${4:, title: "${5:title}"}${6:, class: "${7:class}"}}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet layout "layout"
|
|
||||||
layout "${1:template_name}"${2:${3:, only: ${4:[:${5:action}, :${6:action}]}}${7:, except: ${8:[:${9:action}, :${10:action}]}}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet jit "javascript_include_tag" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`javascript_include_tag ${1::all}${2:, cache: ${3:true}}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet lt "link_to (name, dest)" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", ${2:dest}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet lia "link_to (action)" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", action: "${2:index}"`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet liai "link_to (action, id)" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", action: "${2:edit}", id: ${3:@item}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet lic "link_to (controller)" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", controller: "${2:items}"`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet lica "link_to (controller, action)" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", controller: "${2:items}", action: "${3:index}"`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet licai "link_to (controller, action, id)" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", controller: "${2:items}", action: "${3:edit}", id: ${4:@item}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet linpp "link_to (nested path plural)" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:"${2:link text...}"}, ${3:${10:parent}_${11:child}_path(${12:@}${13:$10})}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet linp "link_to (nested path)" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:"${2:link text...}"}, ${3:${12:parent}_${13:child}_path(${14:@}${15:$12}, ${16:@}${17:$13})}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet lipp "link_to (path plural)" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:"${2:link text...}"}, ${3:${4:model}s_path}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet lip "link_to (path)" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:"${2:link text...}"}, ${3:${12:model}_path(${13:@}${14:$12})}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet lim "link_to model" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:model}.${2:name}, ${3:${4:$1}_path(${14:$1})}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet hide "page.hide (*ids)"
|
|
||||||
page.hide ${1:"${2:id(s)}"}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ins "page.insert_html (position, id, partial)"
|
|
||||||
page.insert_html :${1:top}, ${2:"${3:id}"}, ${4:partial: "${5:template}"}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rep "page.replace (id, partial)"
|
|
||||||
page.replace ${1:"${2:id}"}, ${3:partial: "${4:template}"}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet reph "page.replace_html (id, partial)"
|
|
||||||
page.replace_html ${1:"${2:id}"}, ${3:partial: "${4:template}"}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet show "page.show (*ids)"
|
|
||||||
page.show ${1:"${2:id(s)}"}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tog "page.toggle (*ids)"
|
|
||||||
page.toggle ${1:"${2:id(s)}"}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet vis "page.visual_effect (effect, id)"
|
|
||||||
page.visual_effect :${1:toggle_slide}, ${2:"${3:DOM ID}"}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rp "render (partial) (rp)"
|
|
||||||
render partial: "${1:item}"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rpc "render (partial,collection) (rpc)"
|
|
||||||
render partial: "${1:item}", collection: ${2:@$1s}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rpl "render (partial,locals) (rpl)"
|
|
||||||
render partial: "${1:item}", locals: { ${2:$1}: ${3:@$1}$0 }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rpo "render (partial,object) (rpo)"
|
|
||||||
render partial: "${1:item}", object: ${2:@$1}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rps "render (partial,status) (rps)"
|
|
||||||
render partial: "${1:item}", status: ${2:500}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet slt "stylesheet_link_tag" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`stylesheet_link_tag ${1::all}${2:, cache: ${3:true}}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet st "submit_tag" w
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`submit_tag "${1:Save changes}"${2:, id: "${3:submit}"}${4:, name: "${5:$3}"}${6:, class: "${7:form_$3}"}${8:, disabled: ${9:false}}${10:, disable_with: "${11:Please wait...}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet else "else (ERB)"
|
|
||||||
<% else %>
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet lf "link_to_function"
|
|
||||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to_function ${1:"${2:Greeting}"}, "${3:alert('Hello world!')}"$4`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -1,130 +0,0 @@
|
||||||
global !p
|
|
||||||
def complete(t, opts):
|
|
||||||
if t:
|
|
||||||
opts = [ m[len(t):] for m in opts if m.startswith(t) ]
|
|
||||||
if len(opts) == 1:
|
|
||||||
return opts[0]
|
|
||||||
return '(' + '|'.join(opts) + ')'
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
snippet status "Status" bA
|
|
||||||
status $1`!p snip.rv = complete(t[1], ['build', 'ci', 'test', 'refactor', 'perf', 'improvement', 'docs', 'chore', 'feat', 'fix'])`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fix "fix conventional commit"
|
|
||||||
fix(${1:scope}): ${2:title}
|
|
||||||
|
|
||||||
${0:${VISUAL}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet feat "feat conventional commit"
|
|
||||||
feat(${1:scope}): ${2:title}
|
|
||||||
|
|
||||||
${0:${VISUAL}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet chore "chore conventional commit"
|
|
||||||
chore(${1:scope}): ${2:title}
|
|
||||||
|
|
||||||
${0:${VISUAL}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet docs "docs conventional commit"
|
|
||||||
docs(${1:scope}): ${2:title}
|
|
||||||
|
|
||||||
${0:${VISUAL}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet improvement "improvement conventional commit"
|
|
||||||
improvement(${1:scope}): ${2:title}
|
|
||||||
|
|
||||||
${0:${VISUAL}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet perf "perf conventional commit"
|
|
||||||
perf(${1:scope}): ${2:title}
|
|
||||||
|
|
||||||
${0:${VISUAL}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet refactor "refactor conventional commit"
|
|
||||||
refactor(${1:scope}): ${2:title}
|
|
||||||
|
|
||||||
${0:${VISUAL}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet test "test conventional commit"
|
|
||||||
test(${1:scope}): ${2:title}
|
|
||||||
|
|
||||||
${0:${VISUAL}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ci "ci conventional commit"
|
|
||||||
ci(${1:scope}): ${2:title}
|
|
||||||
|
|
||||||
${0:${VISUAL}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet build "build conventional commit"
|
|
||||||
build(${1:scope}): ${2:title}
|
|
||||||
|
|
||||||
${0:${VISUAL}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sign "Signature"
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
${1:Company Name}
|
|
||||||
|
|
||||||
${2:Author Name}
|
|
||||||
|
|
||||||
${3:Streetname 21}
|
|
||||||
${4:City and Area}
|
|
||||||
|
|
||||||
${5:Tel: +44 (0)987 / 888 8888}
|
|
||||||
${6:Fax: +44 (0)987 / 888 8882}
|
|
||||||
${7:Mail: Email}
|
|
||||||
${8:Web: https://}
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet t "Todo"
|
|
||||||
TODO: ${1:What is it} (`date "+%b %d %Y %a (%H:%M:%S)"`, `echo $USER`)
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cmt "Commit Structure" bA
|
|
||||||
${1:Summarize changes in around 50 characters or less}
|
|
||||||
|
|
||||||
${2:More detailed explanatory text, if necessary. Wrap it to about 72
|
|
||||||
characters or so. In some contexts, the first line is treated as the
|
|
||||||
subject of the commit and the rest of the text as the body. The
|
|
||||||
blank line separating the summary from the body is critical (unless
|
|
||||||
you omit the body entirely); various tools like `log`, `shortlog`
|
|
||||||
and `rebase` can get confused if you run the two together.}
|
|
||||||
|
|
||||||
${3:Explain the problem that this commit is solving. Focus on why you
|
|
||||||
are making this change as opposed to how (the code explains that).
|
|
||||||
Are there side effects or other unintuitive consequences of this
|
|
||||||
change? Here's the place to explain them.}
|
|
||||||
|
|
||||||
${4:Further paragraphs come after blank lines.
|
|
||||||
|
|
||||||
- Bullet points are okay, too
|
|
||||||
|
|
||||||
- Typically a hyphen or asterisk is used for the bullet, preceded
|
|
||||||
by a single space, with blank lines in between, but conventions
|
|
||||||
vary here}
|
|
||||||
|
|
||||||
${5:Status}
|
|
||||||
|
|
||||||
${6:If you use an issue tracker, put references to them at the bottom,
|
|
||||||
like this.}
|
|
||||||
|
|
||||||
${7:Any todos}
|
|
||||||
|
|
||||||
${8:Resolves: #123
|
|
||||||
See also: #456, #789}
|
|
||||||
|
|
||||||
${9:Signature}
|
|
||||||
endsnippet
|
|
|
@ -1,115 +0,0 @@
|
||||||
# Snippets for Go
|
|
||||||
|
|
||||||
priority -50
|
|
||||||
|
|
||||||
# when to abbriviate and when not?
|
|
||||||
# b doesn't work here, because it ignores whitespace
|
|
||||||
# optional local name?
|
|
||||||
snippet /^import/ "Import declaration" r
|
|
||||||
import (
|
|
||||||
"${1:package}"
|
|
||||||
)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet /^package/ "Package declaration" r
|
|
||||||
// Package $1 provides ...
|
|
||||||
package ${1:main}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Mostly converted from: https://github.com/AlanQuatermain/go-tmbundle
|
|
||||||
snippet /^cons/ "Constants declaration" r
|
|
||||||
const (
|
|
||||||
${1:constant}${2/(.+)/ /}${2:type} = ${0:value}
|
|
||||||
)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet /^con/ "Constant declaration" r
|
|
||||||
const ${1:name}${2/(.+)/ /}${2:type} = ${0:value}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet iota "Iota constant generator" b
|
|
||||||
const (
|
|
||||||
${1:constant}${2/(.+)/ /}${2:type} = iota
|
|
||||||
)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet struct "Struct declaration" b
|
|
||||||
type ${1:Struct} struct {
|
|
||||||
${0:${VISUAL}}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet interface "Interface declaration" b
|
|
||||||
type ${1:Interface} interface {
|
|
||||||
${0:${VISUAL}}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet if "If statement" b
|
|
||||||
if ${1:condition}${1/(.+)/ /}{
|
|
||||||
${0:${VISUAL}}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet switch "Switch statement" b
|
|
||||||
switch ${1:expression}${1/(.+)/ /}{
|
|
||||||
case$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# functions
|
|
||||||
snippet /^main/ "Main function" r
|
|
||||||
func main() {
|
|
||||||
${0:${VISUAL}}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet /^meth/ "Method" r
|
|
||||||
func (${1:receiver} ${2:type}) ${3:name}(${4:params})${5/(.+)/ /}${5:type} {
|
|
||||||
${0:${VISUAL}}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet func "Function" b
|
|
||||||
func ${1:name}(${2:params})${3/(.+)/ /}${3:type} {
|
|
||||||
${0:${VISUAL}}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet funch "HTTP handler" b
|
|
||||||
func ${1:handler}(${2:w} http.ResponseWriter, ${3:r} *http.Request) {
|
|
||||||
${0:${VISUAL}}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# types and variables
|
|
||||||
snippet map "Map type" b
|
|
||||||
map[${1:keytype}]${2:valtype}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet : "Variable declaration :=" b
|
|
||||||
${1:name} := ${0:value}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet var "Variable declaration" b
|
|
||||||
var ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet vars "Variables declaration" b
|
|
||||||
var (
|
|
||||||
${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value} }
|
|
||||||
)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet json "JSON field"
|
|
||||||
\`json:"${1:displayName}"\`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
|
||||||
|
|
||||||
# error handling
|
|
||||||
snippet err "Basic error handling" b
|
|
||||||
if err != nil {
|
|
||||||
log.${1:Fatal}(err)
|
|
||||||
}
|
|
||||||
endsnippet
|
|
|
@ -1,13 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
snippet imp "Simple import"
|
|
||||||
import ${1:${2:Data}.${0:Text}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet imp2 "Selective import" b
|
|
||||||
import ${1:${2:Data}.${3:Text}} (${4})${0}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet impq "Qualified import"
|
|
||||||
import qualified ${1:${2:Data}.${3:Text}} as ${0:`!p snip.rv = t[1].split(".")[-1]`}
|
|
||||||
endsnippet
|
|
|
@ -1,37 +0,0 @@
|
||||||
# Snippets for VIM Help Files
|
|
||||||
|
|
||||||
priority -50
|
|
||||||
|
|
||||||
global !p
|
|
||||||
def sec_title(snip, t):
|
|
||||||
file_start = snip.fn.split('.')[0]
|
|
||||||
sec_name = t[1].strip("1234567890. ").lower().replace(' ', '-')
|
|
||||||
return ("*%s-%s*" % (file_start, sec_name)).rjust(78-len(t[1]))
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
snippet sec "Section marker" b
|
|
||||||
==============================================================================
|
|
||||||
${1:SECTION}`!p snip.rv = sec_title(snip, t)`
|
|
||||||
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ssec "Sub section marker" b
|
|
||||||
${1:Subsection}`!p snip.rv = sec_title(snip, t)
|
|
||||||
snip += "-"*len(t[1])`
|
|
||||||
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sssec "Subsub Section marker" b
|
|
||||||
${1:SubSubsection}:`!p snip.rv = sec_title(snip, t)`
|
|
||||||
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# For vim help, follow the same settings as the official docs.
|
|
||||||
snippet modeline "Vim help modeline"
|
|
||||||
`!v 'vim'`:tw=78:ts=8:ft=help:norl:
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -1,534 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
###########################################################################
|
|
||||||
# TextMate Snippets #
|
|
||||||
###########################################################################
|
|
||||||
|
|
||||||
global !p
|
|
||||||
def x(snip):
|
|
||||||
if snip.ft.startswith("x"):
|
|
||||||
snip.rv = '/'
|
|
||||||
else:
|
|
||||||
snip.rv = ""
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
snippet doctype "HTML - 5.0 (doctype)" b
|
|
||||||
<!DOCTYPE html>
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
#############
|
|
||||||
# Shortcuts #
|
|
||||||
#############
|
|
||||||
snippet down "Down (down)"
|
|
||||||
↓
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet enter "Enter (enter)"
|
|
||||||
⌅
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet escape "Escape (escape)"
|
|
||||||
⎋
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet left "Left (left)"
|
|
||||||
←
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet return "Return (return)"
|
|
||||||
↩
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet right "Right (right)"
|
|
||||||
→
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet shift "Shift (shift)"
|
|
||||||
⇧
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tab "Tab (tab)"
|
|
||||||
⇥
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet up "Up (up)"
|
|
||||||
↑
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
#############
|
|
||||||
# HTML TAGS #
|
|
||||||
#############
|
|
||||||
snippet a "Link" w
|
|
||||||
<a href="${1:http://www.${2:url.com}}"${3: target="_blank"}>${4:Anchor Text}</a>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet abbr "<abbr>" w
|
|
||||||
<abbr title="$2">$1</abbr>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet access "accesskey global attribute"
|
|
||||||
accesskey="$1"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet address "<address>" w
|
|
||||||
<address>$1</address>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet article "<article>"
|
|
||||||
<article>
|
|
||||||
${1:article content}
|
|
||||||
</article>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet aside "<aside>"
|
|
||||||
<aside>
|
|
||||||
${1:aside content}
|
|
||||||
</aside>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet b "<b>" w
|
|
||||||
<b>$1</b>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet base "HTML <base>" w
|
|
||||||
<base href="$1"${2: target="$3"}`!p x(snip)`>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet blockquote "<blockquote>"
|
|
||||||
<blockquote>$1</blockquote>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet body "<body>"
|
|
||||||
<body>
|
|
||||||
${0:${VISUAL}}
|
|
||||||
</body>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet br "<br>" w
|
|
||||||
<br>$1</br>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet button "<button>"
|
|
||||||
<button>$1</button>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet caption "<caption>"
|
|
||||||
<caption>$1</caption>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cite "<cite>" w
|
|
||||||
<cite>$1</cite>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet class "class global attribute"
|
|
||||||
class="$1"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet code "<code>" w
|
|
||||||
<code>$1</code>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet data "<data>"
|
|
||||||
<data value="$2">$1</data>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet datalist "<datalist>"
|
|
||||||
<datalist id="$1" name="$2">
|
|
||||||
opt$3
|
|
||||||
</datalist>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet dd "<dd>"
|
|
||||||
<dd>$1</dd>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet del "<del>" w
|
|
||||||
<del cite="$2" datetime="${3:`date '+%Y-%m-%dT%H:%M:%S%:z'`}">$1</del>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet dfn "<dfn>" w
|
|
||||||
<dfn>$1</dfn>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet div "<div>" w
|
|
||||||
<div>
|
|
||||||
${0:${VISUAL}}
|
|
||||||
</div>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet div# "<div> with ID & class" w
|
|
||||||
<div`!p snip.rv=' id="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""``!p snip.rv=' class="' if t[2] else ""`${2:name}`!p snip.rv = '"' if t[2] else ""`>
|
|
||||||
${0:${VISUAL}}
|
|
||||||
</div>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet div. "<div> with class" w
|
|
||||||
<div`!p snip.rv=' class="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""`>
|
|
||||||
${0:${VISUAL}}
|
|
||||||
</div>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet dl "<dl>"
|
|
||||||
<dl>
|
|
||||||
${1:Definition list}
|
|
||||||
</dl>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet dt "<dt>"
|
|
||||||
<dt>$1</dt>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet em "<em>" w
|
|
||||||
<em>$1</em>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fieldset "Fieldset" w
|
|
||||||
<fieldset id="${1/[\w\d]+|( )/(?1:_:\L$0\E)/g}" ${2:class="${3:}"}>
|
|
||||||
<legend>$1</legend>
|
|
||||||
${0:${VISUAL}}
|
|
||||||
</fieldset>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fig "<figure>"
|
|
||||||
<figure>
|
|
||||||
$1
|
|
||||||
<figcaption>$2</figcaption>
|
|
||||||
</figure>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet figcaption "<figcaption>"
|
|
||||||
<figcaption>$1</figcaption>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet footer "<footer>"
|
|
||||||
<footer>
|
|
||||||
${1:footer content}
|
|
||||||
</footer>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet form "HTML <form>" w
|
|
||||||
<form action="${1:`!p
|
|
||||||
snip.rv = (snip.basename or 'unnamed') + '_submit'
|
|
||||||
`}" method="${2:get}" accept-charset="utf-8">
|
|
||||||
${0:${VISUAL}}
|
|
||||||
</form>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet h1 "HTML <h1>" w
|
|
||||||
<h1>${0:${VISUAL}}</h1>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet h2 "HTML <h2>" w
|
|
||||||
<h2>${0:${VISUAL}}</h2>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet h3 "HTML <h3>" w
|
|
||||||
<h3>${0:${VISUAL}}</h3>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet h4 "HTML <h4>" w
|
|
||||||
<h4>${0:${VISUAL}}</h4>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet h5 "HTML <h5>" w
|
|
||||||
<h5>${0:${VISUAL}}</h5>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet h6 "HTML <h6>" w
|
|
||||||
<h6>${0:${VISUAL}}</h6>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet head "HTML <head>"
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>${1:`!p snip.rv = snip.basename or "Page Title"`}</title>
|
|
||||||
${0:${VISUAL}}
|
|
||||||
</head>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet header "<header>"
|
|
||||||
<header>
|
|
||||||
${1:header content}
|
|
||||||
</header>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet hr "<hr>"
|
|
||||||
<hr>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet html "HTML basic structure" b
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta name="viewport" content="width=device-width" />
|
|
||||||
<title>${1:`!p snip.rv = snip.basename.replace('-', ' ').capitalize()`}</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
${0:body}
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet htmll "HTML basic structure with the lang attribute" b
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="${1:es}">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<title>${2:`!p snip.rv = snip.basename.replace('-', ' ').capitalize()`}</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
${0:body}
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet i "<i>" w
|
|
||||||
<i>$1</i>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet id "id global attribute"
|
|
||||||
id="$1"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet img "<img>"
|
|
||||||
<img src="$1" alt="$2">
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet input "Input with Label" w
|
|
||||||
<label for="${2:${1/[[:alpha:]]+|( )/(?1:_:\L$0)/g}}">$1</label><input type="${3:text/submit/hidden/button}" name="${4:$2}" value="$5"${6: id="${7:$2}"}`!p x(snip)`>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet input "HTML <input>" w
|
|
||||||
<input type="${1:text/submit/hidden/button}" name="${2:some_name}" value="$3"${4: id="${5:$2}"}`!p x(snip)`>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ins "<ins>" w
|
|
||||||
<ins cite="$2" datetime="${3:`date '+%Y-%m-%dT%H:%M:%S%:z'`}">$1</ins>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet kbd "<kbd>" w
|
|
||||||
<kbd>$1</kbd>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet label "<label>"
|
|
||||||
<label>$1</label>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet legend "<legend>"
|
|
||||||
<legend>$1</legend>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet li "list item" w
|
|
||||||
<li>${0:${VISUAL}}</li>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet link "HTML <link>" w
|
|
||||||
<link rel="${1:stylesheet}" href="${2:/css/master.css}" type="text/css" media="${3:screen}" title="${4:no title}" charset="${5:utf-8}"`!p x(snip)`>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mailto "HTML <a mailto: >" w
|
|
||||||
<a href="mailto:${1:joe@example.com}?subject=${2:feedback}">${3:email me}</a>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tel "HTML <a tel: >" w
|
|
||||||
<a href="tel:+${1:XX1234567890}">${2:call me}</a>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet main "<main>"
|
|
||||||
<main>
|
|
||||||
${1:main content}
|
|
||||||
</main>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mark "<mark>"
|
|
||||||
<mark>$1</mark>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet meta "HTML <meta>" w
|
|
||||||
<meta name="${1:name}" content="${2:content}"`!p x(snip)`>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet meter "<meter>"
|
|
||||||
<meter>$1</meter>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet nav "<nav>"
|
|
||||||
<nav>
|
|
||||||
${1:navigation links}
|
|
||||||
</nav>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet noscript "<noscript>"
|
|
||||||
<noscript>$1</noscript>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ol "<ol>"
|
|
||||||
<ol>
|
|
||||||
<li>$1</li>
|
|
||||||
</ol>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet optgroup "<optgroup>"
|
|
||||||
<optgroup label="$1">
|
|
||||||
opt$2
|
|
||||||
</optgroup>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet output "<output>"
|
|
||||||
<output for="$1" name="$2">$3</output>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet option "Option" w
|
|
||||||
<option${1: value="${2:option}"}>${3:$2}</option>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet p "paragraph" w
|
|
||||||
<p>${0:${VISUAL}}</p>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet picture "<picture>"
|
|
||||||
<picture>
|
|
||||||
${1:image sources}
|
|
||||||
</picture>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pre "<pre>"
|
|
||||||
<pre>$1</pre>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet progress "<progress>"
|
|
||||||
<progress>$1</progress>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet q "<q>" w
|
|
||||||
<q>$1</q>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet s "<s>" w
|
|
||||||
<s>$1</s>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet samp "<samp>" w
|
|
||||||
<samp>$1</samp>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet script "HTML <script>" w
|
|
||||||
<script charset="utf-8">
|
|
||||||
${0:${VISUAL}}
|
|
||||||
</script>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet scriptsrc "HTML <script src...>" w
|
|
||||||
<script src="$1" charset="${3:utf-8}"></script>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet select "Select Box" w
|
|
||||||
<select name="${1:some_name}" id="${2:$1}"${3:${4: multiple}${5: size="${6:1}"}}>
|
|
||||||
${0:${VISUAL}}
|
|
||||||
</select>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet small "<small>" w
|
|
||||||
<small>$1</small>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet span "<span>" w
|
|
||||||
<span>${0:${VISUAL}}</span>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet span# "<span> with ID & class" w
|
|
||||||
<span`!p snip.rv=' id="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""``!p snip.rv=' class="' if t[2] else ""`${2:name}`!p snip.rv = '"' if t[2] else ""`>${0:${VISUAL}}</span>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet span. "<span> with class" w
|
|
||||||
<span`!p snip.rv=' class="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""`>${0:${VISUAL}}</span>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet strong "<strong>" w
|
|
||||||
<strong>$1</strong>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet style "HTML <style>" w
|
|
||||||
<style type="text/css" media="screen">
|
|
||||||
${0:${VISUAL}}
|
|
||||||
</style>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sub "<sub>" w
|
|
||||||
<sub>$1</sub>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sup "<sup>" w
|
|
||||||
<sup>$1</sup>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet table "HTML <table>" w
|
|
||||||
<table>
|
|
||||||
${0:${VISUAL}}
|
|
||||||
</table>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tbody "<tbody>"
|
|
||||||
<tbody>$1</tbody>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet td "table cell" w
|
|
||||||
<td>${0:${VISUAL}}</td>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet template "<template>"
|
|
||||||
<template id="$1">
|
|
||||||
$2
|
|
||||||
</template>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet textarea "HTML <textarea>" w
|
|
||||||
<textarea name="${1:Name}" rows="${2:8}" cols="${3:40}">$0</textarea>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tfoot "<tfoot>"
|
|
||||||
<tfoot>$1</tfoot>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet th "table header" w
|
|
||||||
<th>${0:${VISUAL}}</th>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet thead "<thead>"
|
|
||||||
<thead>$1</thead>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet time "<time>" w
|
|
||||||
<time datetime="$2">$1</time>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet title "HTML <title>" w
|
|
||||||
<title>${1:`!p snip.rv = snip.basename or "Page Title"`}</title>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tr "table row" w
|
|
||||||
<tr>${0:${VISUAL}}</tr>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ul "unordered list" w
|
|
||||||
<ul>
|
|
||||||
${0:${VISUAL}}
|
|
||||||
</ul>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet var "<var>" w
|
|
||||||
<var>$1</var>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet viewport "Responsive viewport meta" w
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet wbr "<wbr>" w
|
|
||||||
<wbr>$1</wbr>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -1,33 +0,0 @@
|
||||||
# more can be found in snippets/html_minimal.snippets
|
|
||||||
# these UltiSnips override snippets because nested placeholders are being used
|
|
||||||
|
|
||||||
priority -49
|
|
||||||
|
|
||||||
snippet id
|
|
||||||
id="$1"$2
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet idn
|
|
||||||
id="$1" name="${2:$1}"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet label_and_input
|
|
||||||
<label for="${2:$1}">$1</label>
|
|
||||||
<input type="${3:text}" name="${4:$2}"${5: id="${6:$2}"} value="$7" />$8
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet input
|
|
||||||
<input type="${1:text}" value="$2" name="$3"${4: id="${5:$3}"}/>$7
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet submit
|
|
||||||
<input type="submit" value="$2" $3/>$7
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet textarea
|
|
||||||
<textarea name="$2"${3: id="$4"}>$5</textarea>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet img
|
|
||||||
<img src="$1"${2: alt="$3"}/>
|
|
||||||
endsnippet
|
|
|
@ -1,299 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
extends html
|
|
||||||
|
|
||||||
# Generic Tags
|
|
||||||
snippet % "" bi
|
|
||||||
{% $1 %}$2
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet %% "" bi
|
|
||||||
{% ${1:tag_name} %}
|
|
||||||
$2
|
|
||||||
{% end$1 %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet { "" bi
|
|
||||||
{{ $1 }}$2
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Template Tags
|
|
||||||
|
|
||||||
snippet autoescape "" bi
|
|
||||||
{% autoescape ${1:off} %}
|
|
||||||
$2
|
|
||||||
{% endautoescape %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet block "" bi
|
|
||||||
{% block $1 %}
|
|
||||||
$2
|
|
||||||
{% endblock $1 %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet # "" bi
|
|
||||||
{# ${1:comment} #}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet comment "" bi
|
|
||||||
{% comment %}
|
|
||||||
$1
|
|
||||||
{% endcomment %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cycle "" bi
|
|
||||||
{% cycle ${1:val1} ${2:val2} ${3:as $4} %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet debug "" bi
|
|
||||||
{% debug %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet extends "" bi
|
|
||||||
{% extends "${1:base.html}" %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet filter "" bi
|
|
||||||
{% filter $1 %}
|
|
||||||
$2
|
|
||||||
{% endfilter %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet firstof "" bi
|
|
||||||
{% firstof $1 %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet for "" bi
|
|
||||||
{% for $1 in $2 %}
|
|
||||||
$3
|
|
||||||
{% endfor %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet empty "" bi
|
|
||||||
{% empty %}
|
|
||||||
$1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet if "" bi
|
|
||||||
{% if $1 %}
|
|
||||||
$2
|
|
||||||
{% endif %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet iif "" bi
|
|
||||||
{% if $1 %}$2{% endif %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ielse "" bi
|
|
||||||
{% else %}$1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet else "" bi
|
|
||||||
{% else %}
|
|
||||||
$1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ielif "" bi
|
|
||||||
{% elif %}$1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet elif "" bi
|
|
||||||
{% elif %}
|
|
||||||
$1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ifchanged "" bi
|
|
||||||
{% ifchanged %}$1{% endifchanged %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ifequal "" bi
|
|
||||||
{% ifequal $1 $2 %}
|
|
||||||
$3
|
|
||||||
{% endifequal %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ifnotequal "" bi
|
|
||||||
{% ifnotequal $1 $2 %}
|
|
||||||
$3
|
|
||||||
{% endifnotequal %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet include "" bi
|
|
||||||
{% include "$1" %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet load "" bi
|
|
||||||
{% load $1 %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet now "" bi
|
|
||||||
{% now "${1:jS F Y H:i}" %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet regroup "" bi
|
|
||||||
{% regroup $1 by $2 as $3 %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet spaceless "" bi
|
|
||||||
{% spaceless %}$1{% endspaceless %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ssi "" bi
|
|
||||||
{% ssi $1 %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet trans "" bi
|
|
||||||
{% trans "${1:string}" %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet url "" bi
|
|
||||||
{% url $1 as $2 %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet widthratio "" bi
|
|
||||||
{% widthratio ${1:this_value} ${2:max_value} ${3:100} %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet with "" bi
|
|
||||||
{% with $1 as $2 %}
|
|
||||||
${VISUAL}
|
|
||||||
{% endwith %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet verbatim "" bi
|
|
||||||
{% verbatim %}
|
|
||||||
${VISUAL}
|
|
||||||
{% endverbatim %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet super "" bi
|
|
||||||
{{ block.super }}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet staticu "" bi
|
|
||||||
{{ STATIC_URL }}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet static "" bi
|
|
||||||
{% static "${VISUAL}" %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mediau "" bi
|
|
||||||
{{ MEDIA_URL }}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet iblock "" bi
|
|
||||||
{% block ${1:blockname} %}${VISUAL}{% endblock $1 %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet csrf "" bi
|
|
||||||
{% csrf_token %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet blocktrans "" bi
|
|
||||||
{% blocktrans %}
|
|
||||||
${VISUAL}
|
|
||||||
{% endblocktrans %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet lorem "" bi
|
|
||||||
{% lorem $1 %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Template Filters
|
|
||||||
|
|
||||||
# Note: Since SnipMate can't determine which template filter you are
|
|
||||||
# expanding without the "|" character, these do not add the "|"
|
|
||||||
# character. These save a few keystrokes still.
|
|
||||||
|
|
||||||
# Note: Template tags that take no arguments are not implemented.
|
|
||||||
|
|
||||||
snippet add "" bi
|
|
||||||
add:"$1"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet center "" bi
|
|
||||||
center:"$1"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cut "" bi
|
|
||||||
cut:"$1"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet date "" bi
|
|
||||||
date:"$1"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet default "" bi
|
|
||||||
default:"$1"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet defaultifnone "" bi
|
|
||||||
default_if_none:"$1"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet dictsort "" bi
|
|
||||||
dictsort:"$1"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet dictsortrev "" bi
|
|
||||||
dictsortreversed:"$1"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet divisibleby "" bi
|
|
||||||
divisibleby:"$1"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet floatformat "" bi
|
|
||||||
floatformat:"$1"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet getdigit "" bi
|
|
||||||
get_digit:"$1"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet join "" bi
|
|
||||||
join:"$1"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet lengthis "" bi
|
|
||||||
length_is:"$1"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pluralize "" bi
|
|
||||||
pluralize:"$1"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet removetags "" bi
|
|
||||||
removetags:"$1"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet slice "" bi
|
|
||||||
slice:"$1"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet stringformat "" bi
|
|
||||||
stringformat:"$1"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet time "" bi
|
|
||||||
time:"$1"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet truncatewords "" bi
|
|
||||||
truncatewords:$1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet truncatewordshtml "" bi
|
|
||||||
truncatewords_html:$1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet urlizetrunc "" bi
|
|
||||||
urlizetrunc:$1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet wordwrap "" bi
|
|
||||||
wordwrap:$1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -1,3 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
extends html, jinja2
|
|
|
@ -1,435 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
# Many of the snippets here use a global option called
|
|
||||||
# "g:ultisnips_java_brace_style" which, if set to "nl" will put a newline
|
|
||||||
# before '{' braces.
|
|
||||||
# Setting "g:ultisnips_java_junit" will change how the test method snippet
|
|
||||||
# looks, it is defaulted to junit4, setting this option to 3 will remove the
|
|
||||||
# @Test annotation from the method
|
|
||||||
|
|
||||||
global !p
|
|
||||||
def junit(snip):
|
|
||||||
if snip.opt("g:ultisnips_java_junit", "") == "3":
|
|
||||||
snip += ""
|
|
||||||
else:
|
|
||||||
snip.rv += "@Test\n\t"
|
|
||||||
|
|
||||||
def nl(snip):
|
|
||||||
if snip.opt("g:ultisnips_java_brace_style", "") == "nl":
|
|
||||||
snip += ""
|
|
||||||
else:
|
|
||||||
snip.rv += " "
|
|
||||||
def getArgs(group):
|
|
||||||
import re
|
|
||||||
word = re.compile('[a-zA-Z0-9><.]+ \w+')
|
|
||||||
return [i.split(" ") for i in word.findall(group) ]
|
|
||||||
|
|
||||||
def camel(word):
|
|
||||||
if not word: return ''
|
|
||||||
return word[0].upper() + word[1:]
|
|
||||||
|
|
||||||
def mixedCase(word):
|
|
||||||
if not word: return ''
|
|
||||||
return word[0].lower() + word[1:]
|
|
||||||
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
snippet sleep "try sleep catch" b
|
|
||||||
try {
|
|
||||||
Thread.sleep(${1:1000});
|
|
||||||
} catch (InterruptedException e){
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet /i|n/ "new primitive or int" br
|
|
||||||
${1:int} ${2:i} = ${3:1};
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet /o|v/ "new Object or variable" br
|
|
||||||
${1:Object} ${2:var} = new $1($3);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet f "field" b
|
|
||||||
${1:private} ${2:String} ${3:`!p snip.rv = t[2].lower()`};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ab "abstract" b
|
|
||||||
abstract $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet as "assert" b
|
|
||||||
assert ${1:test}${2/(.+)/(?1: \: ")/}${2:Failure message}${2/(.+)/(?1:")/};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet at "assert true" b
|
|
||||||
assertTrue(${1:actual});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet af "assert false" b
|
|
||||||
assertFalse(${1:actual});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ae "assert equals" b
|
|
||||||
assertEquals(${1:expected}, ${2:actual});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet br "break"
|
|
||||||
break;
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cs "case" b
|
|
||||||
case $1:
|
|
||||||
$2
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ca "catch" b
|
|
||||||
catch (${1:Exception} ${2:e})`!p nl(snip)`{
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cle "class extends" b
|
|
||||||
public class ${1:`!p
|
|
||||||
snip.rv = snip.basename or "untitled"`} ${2:extends ${3:Parent} }${4:implements ${5:Interface} }{
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet clc "class with constructor, fields, setter and getters" b
|
|
||||||
public class `!p
|
|
||||||
snip.rv = snip.basename or "untitled"` {
|
|
||||||
`!p
|
|
||||||
args = getArgs(t[1])
|
|
||||||
if len(args) == 0: snip.rv = ""
|
|
||||||
for i in args:
|
|
||||||
snip.rv += "\n\tprivate " + i[0] + " " + i[1]+ ";"
|
|
||||||
if len(args) > 0:
|
|
||||||
snip.rv += "\n"`
|
|
||||||
public `!p snip.rv = snip.basename or "unknown"`($1) {`!p
|
|
||||||
args = getArgs(t[1])
|
|
||||||
for i in args:
|
|
||||||
snip.rv += "\n\t\tthis." + i[1] + " = " + i[1] + ";"
|
|
||||||
if len(args) == 0:
|
|
||||||
snip.rv += "\n"`
|
|
||||||
}$0
|
|
||||||
`!p
|
|
||||||
args = getArgs(t[1])
|
|
||||||
if len(args) == 0: snip.rv = ""
|
|
||||||
for i in args:
|
|
||||||
snip.rv += "\n\tpublic void set" + camel(i[1]) + "(" + i[0] + " " + i[1] + ") {\n" + "\
|
|
||||||
\tthis." + i[1] + " = " + i[1] + ";\n\t}\n"
|
|
||||||
|
|
||||||
snip.rv += "\n\tpublic " + i[0] + " get" + camel(i[1]) + "() {\n\
|
|
||||||
\treturn " + i[1] + ";\n\t}\n"
|
|
||||||
`
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet clc "class with constructor, with field names" b
|
|
||||||
public class `!p
|
|
||||||
snip.rv = snip.basename or "untitled"` {
|
|
||||||
`!p
|
|
||||||
args = getArgs(t[1])
|
|
||||||
for i in args:
|
|
||||||
snip.rv += "\n\tprivate " + i[0] + " " + i[1]+ ";"
|
|
||||||
if len(args) > 0:
|
|
||||||
snip.rv += "\n"`
|
|
||||||
public `!p snip.rv = snip.basename or "unknown"`($1) {`!p
|
|
||||||
args = getArgs(t[1])
|
|
||||||
for i in args:
|
|
||||||
snip.rv += "\n\t\tthis.%s = %s;" % (i[1], i[1])
|
|
||||||
if len(args) == 0:
|
|
||||||
snip.rv += "\n"`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet clc "class and constructor" b
|
|
||||||
public class `!p
|
|
||||||
snip.rv = snip.basename or "untitled"` {
|
|
||||||
|
|
||||||
public `!p snip.rv = snip.basename or "untitled"`($2) {
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cl "class" b
|
|
||||||
public class ${1:`!p
|
|
||||||
snip.rv = snip.basename or "untitled"`} {
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cos "constant string" b
|
|
||||||
public static final String ${1:var} = "$2";$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet co "constant" b
|
|
||||||
public static final ${1:String} ${2:var} = $3;$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet de "default" b
|
|
||||||
default:
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet elif "else if"
|
|
||||||
else if ($1)`!p nl(snip)`{
|
|
||||||
$0${VISUAL}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet el "else" w
|
|
||||||
else`!p nl(snip)`{
|
|
||||||
$0${VISUAL}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fi "final" b
|
|
||||||
final $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fore "for (each)" b
|
|
||||||
for ($1 : $2)`!p nl(snip)`{
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fori "for" b
|
|
||||||
for (int ${1:i} = 0; $1 < ${2:10}; $1++)`!p nl(snip)`{
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet for "for" b
|
|
||||||
for ($1; $2; $3)`!p nl(snip)`{
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet if "if" b
|
|
||||||
if ($1)`!p nl(snip)`{
|
|
||||||
$0${VISUAL}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet imt "import junit_framework_TestCase;" b
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet im "import" b
|
|
||||||
import ${1:java}.${2:util}.$0;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet in "interface" b
|
|
||||||
interface ${1:`!p snip.rv = snip.basename or "untitled"`} ${2:extends ${3:Parent} }{
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cc "constructor call or setter body"
|
|
||||||
this.${1:var} = $1;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet list "Collections List" b
|
|
||||||
List<${1:String}> ${2:list} = new ${3:Array}List<$1>();
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet map "Collections Map" b
|
|
||||||
Map<${1:String}, ${2:String}> ${3:map} = new ${4:Hash}Map<$1, $2>();
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet set "Collections Set" b
|
|
||||||
Set<${1:String}> ${2:set} = new ${3:Hash}Set<$1>();
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet /Str?|str/ "String" br
|
|
||||||
String $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cn "Constructor" b
|
|
||||||
public `!p snip.rv = snip.basename or "untitled"`(${1:}) {
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cn "constructor, \w fields + assigments" b
|
|
||||||
`!p
|
|
||||||
args = getArgs(t[1])
|
|
||||||
for i in args:
|
|
||||||
snip.rv += "\n\tprivate " + i[0] + " " + i[1]+ ";"
|
|
||||||
if len(args) > 0:
|
|
||||||
snip.rv += "\n"`
|
|
||||||
public `!p snip.rv = snip.basename or "unknown"`($1) {`!p
|
|
||||||
args = getArgs(t[1])
|
|
||||||
for i in args:
|
|
||||||
snip.rv += "\n\t\tthis.%s = %s;" % (i[1], i[1])
|
|
||||||
if len(args) == 0:
|
|
||||||
snip.rv += "\n"`
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet j.b "java_beans_" i
|
|
||||||
java.beans.
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet j.i "java_io" i
|
|
||||||
java.io.
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet j.m "java_math" i
|
|
||||||
java.math.
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet j.n "java_net_" i
|
|
||||||
java.net.
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet j.u "java_util_" i
|
|
||||||
java.util.
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet main "method (main)" b
|
|
||||||
public static void main(String[] args)`!p nl(snip)`{
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet try "try/catch" b
|
|
||||||
try {
|
|
||||||
$1${VISUAL}
|
|
||||||
} catch(${2:Exception} ${3:e}){
|
|
||||||
${4:e.printStackTrace();}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mt "method throws" b
|
|
||||||
${1:private} ${2:void} ${3:method}($4) ${5:throws $6 }{
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet m "method" b
|
|
||||||
${1:private} ${2:void} ${3:method}($4) {
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet md "Method With javadoc" b
|
|
||||||
/**
|
|
||||||
* ${7:Short Description}`!p
|
|
||||||
for i in getArgs(t[4]):
|
|
||||||
snip.rv += "\n\t * @param " + i[1] + " usage..."`
|
|
||||||
*`!p
|
|
||||||
if "throws" in t[5]:
|
|
||||||
snip.rv = "\n\t * @throws " + t[6]
|
|
||||||
else:
|
|
||||||
snip.rv = ""``!p
|
|
||||||
if not "void" in t[2]:
|
|
||||||
snip.rv = "\n\t * @return object"
|
|
||||||
else:
|
|
||||||
snip.rv = ""`
|
|
||||||
**/
|
|
||||||
${1:public} ${2:void} ${3:method}($4) ${5:throws $6 }{
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet /get(ter)?/ "getter" br
|
|
||||||
public ${1:String} get${2:Name}() {
|
|
||||||
return `!p snip.rv = mixedCase(t[2])`;
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet /set(ter)?/ "setter" br
|
|
||||||
public void set${1:Name}(${2:String} `!p snip.rv = mixedCase(t[1])`) {
|
|
||||||
this.`!p snip.rv = mixedCase(t[1])` = `!p snip.rv = mixedCase(t[1])`;
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet /se?tge?t|ge?tse?t|gs/ "setter and getter" br
|
|
||||||
public void set${1:Name}(${2:String} `!p snip.rv = mixedCase(t[1])`) {
|
|
||||||
this.`!p snip.rv = mixedCase(t[1])` = `!p snip.rv = mixedCase(t[1])`;
|
|
||||||
}`!p snip.rv += "\n"`
|
|
||||||
public $2 get$1() {
|
|
||||||
return `!p snip.rv = mixedCase(t[1])`;
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pa "package" b
|
|
||||||
package $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet p "print" b
|
|
||||||
System.out.print($1);$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pl "println" b
|
|
||||||
System.out.println($1);$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pr "private" b
|
|
||||||
private $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet po "protected" b
|
|
||||||
protected $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pu "public" b
|
|
||||||
public $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet re "return" b
|
|
||||||
return $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet st "static"
|
|
||||||
static $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sw "switch" b
|
|
||||||
switch ($1)`!p nl(snip)`{
|
|
||||||
case $2: $0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sy "synchronized"
|
|
||||||
synchronized $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tc "test case"
|
|
||||||
public class ${1:`!p snip.rv = snip.basename or "untitled"`} extends ${2:TestCase}`!p nl(snip)`{
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet t "test" b
|
|
||||||
`!p junit(snip)`public void test${1:Name}() {
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tt "test throws" b
|
|
||||||
`!p junit(snip)`public void test${1:Name}() ${2:throws Exception }{
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet th "throw" b
|
|
||||||
throw new $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet wh "while" b
|
|
||||||
while ($1)`!p nl(snip)`{
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -1,77 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
snippet iti "it (js, inject)" b
|
|
||||||
it('${1:description}', inject(function($2) {
|
|
||||||
$0
|
|
||||||
}));
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet befi "before each (js, inject)" b
|
|
||||||
beforeEach(inject(function($1) {
|
|
||||||
$0
|
|
||||||
}));
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet aconf "angular config" i
|
|
||||||
config(function($1) {
|
|
||||||
$0
|
|
||||||
});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet acont "angular controller" i
|
|
||||||
controller('${1:name}', [$2function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
|
||||||
$0
|
|
||||||
}]);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet aconts "angular controller with scope" i
|
|
||||||
controller('${1:name}', [${2:'$scope', }function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
|
||||||
$0
|
|
||||||
}]);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet adir "angular directive" i
|
|
||||||
directive('$1', [$2function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
|
||||||
return {
|
|
||||||
restrict: '${3:EA}',
|
|
||||||
link: function(scope, element, attrs) {
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}]);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet adirs "angular directive with scope" i
|
|
||||||
directive('$1', [${2:'$scope', }function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
|
||||||
return {
|
|
||||||
restrict: '${3:EA}',
|
|
||||||
link: function(scope, element, attrs) {
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}]);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet afact "angular factory" i
|
|
||||||
factory('${1:name}', [$2function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
|
||||||
$0
|
|
||||||
}]);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet afacts "angular factory with scope" i
|
|
||||||
factory('${1:name}', [${2:'$scope', }function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
|
||||||
$0
|
|
||||||
}]);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet aserv "angular service" i
|
|
||||||
service('${1:name}', [$2function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
|
||||||
$0
|
|
||||||
}]);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet aservs "angular service" i
|
|
||||||
service('${1:name}', [${2:'$scope', }function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
|
||||||
$0
|
|
||||||
}]);
|
|
||||||
endsnippet
|
|
|
@ -1,101 +0,0 @@
|
||||||
###################################################################
|
|
||||||
# Ember snippets #
|
|
||||||
###################################################################
|
|
||||||
|
|
||||||
priority -50
|
|
||||||
|
|
||||||
# Application
|
|
||||||
snippet eapp "App.Name = Ember.Application.create({});"
|
|
||||||
import Application from '@ember/application';
|
|
||||||
|
|
||||||
export default Application.extend({
|
|
||||||
${0://Properties here...}
|
|
||||||
});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Models
|
|
||||||
snippet emod "import DS from 'ember-data';"
|
|
||||||
import DS from 'ember-data';
|
|
||||||
|
|
||||||
export default DS.Model.extend({
|
|
||||||
${0://Properties here...}
|
|
||||||
});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Controller
|
|
||||||
snippet econtroller "import Controller from '@ember/controller';"
|
|
||||||
import Controller from '@ember/controller';
|
|
||||||
|
|
||||||
export default Controller.extend({
|
|
||||||
${0://Properties here...}
|
|
||||||
});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Route
|
|
||||||
snippet eroute "import Route from '@ember/routing/route';"
|
|
||||||
import Route from '@ember/routing/route';
|
|
||||||
|
|
||||||
export default Route.extend({
|
|
||||||
${0://Properties here...}
|
|
||||||
});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Component
|
|
||||||
snippet ecomponent "import Component from '@ember/component';"
|
|
||||||
import Component from '@ember/component';
|
|
||||||
|
|
||||||
export default Component.extend({
|
|
||||||
${0://Properties here...}
|
|
||||||
});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Object
|
|
||||||
snippet eobj "import EmberObject from '@ember/object';"
|
|
||||||
import EmberObject from '@ember/object';
|
|
||||||
|
|
||||||
export default EmberObject.extend({
|
|
||||||
${0://Properties here...}
|
|
||||||
});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Mixin
|
|
||||||
snippet emix "App.MixinName = Ember.Model.extend({...});"
|
|
||||||
import Mixin from '@ember/object/mixin';
|
|
||||||
|
|
||||||
export default Mixin.create({
|
|
||||||
${0://Properties here...}
|
|
||||||
});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Ember getter and setter
|
|
||||||
snippet eget "this.get('property');"
|
|
||||||
${1:this}.get('${2:property}');
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet eset "this.set('property', value);"
|
|
||||||
${1:this}.set('${2:property}', ${3:value});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Computed properties
|
|
||||||
snippet cproimport "import { computed } from '@ember/object';"
|
|
||||||
import { computed } from '@ember/object';
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cpro "property_name: computed('...', function() {...}),"
|
|
||||||
${1:property_name}: computed('${3:argument}', function() {
|
|
||||||
${0://body...}
|
|
||||||
}),
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Observers
|
|
||||||
snippet prooimport "import { observer } from '@ember/object';"
|
|
||||||
import { observer } from '@ember/object';
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet proo "property_name: observer('...', function() {...}),"
|
|
||||||
${1:property_name}: observer('${3:argument}', function() {
|
|
||||||
${0://body...}
|
|
||||||
}),
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -1,48 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
# JavaScript versions -- from the TextMate bundle + some additions
|
|
||||||
# for jasmine-jquery matchers
|
|
||||||
#
|
|
||||||
|
|
||||||
snippet des "Describe (js)" b
|
|
||||||
describe('${1:description}', () => {
|
|
||||||
$0
|
|
||||||
});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet it "it (js)" b
|
|
||||||
it('${1:description}', () => {
|
|
||||||
$0
|
|
||||||
});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet bef "before each (js)" b
|
|
||||||
beforeEach(() => {
|
|
||||||
$0
|
|
||||||
});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet aft "after each (js)" b
|
|
||||||
afterEach(() => {
|
|
||||||
$0
|
|
||||||
});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet befa "before all (js)" b
|
|
||||||
beforeAll(() => {
|
|
||||||
$0
|
|
||||||
});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet afta "after all (js)" b
|
|
||||||
afterAll(() => {
|
|
||||||
$0
|
|
||||||
});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ru "runs (js)" b
|
|
||||||
runs(() => {
|
|
||||||
$0
|
|
||||||
});
|
|
||||||
endsnippet
|
|
||||||
|
|
|
@ -1,51 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
# JSDoc snippets
|
|
||||||
|
|
||||||
snippet /* "A JSDoc comment" b
|
|
||||||
/**
|
|
||||||
* ${1:${VISUAL}}$0
|
|
||||||
*/
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet @au "@author email (First Last)"
|
|
||||||
@author ${1:`!v g:snips_author`} [${2:`!v g:snips_author_email`}]
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet @li "@license Description"
|
|
||||||
@license ${1:MIT}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet @ver "@version Semantic version"
|
|
||||||
@version ${1:0.1.0}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet @fileo "@fileoverview Description" b
|
|
||||||
/**
|
|
||||||
* @fileoverview ${1:${VISUAL:A description of the file}}$0
|
|
||||||
*/
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet @constr "@constructor"
|
|
||||||
@constructor
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet @p "@param {Type} varname Description"
|
|
||||||
@param {${1:Type}} ${2:varname} ${3:Description}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet @ret "@return {Type} Description"
|
|
||||||
@return {${1:Type}} ${2:Description}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet @pri "@private"
|
|
||||||
@private
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet @over "@override"
|
|
||||||
@override
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet @pro "@protected"
|
|
||||||
@protected
|
|
||||||
endsnippet
|
|
|
@ -1,65 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
snippet #! "#!/usr/bin/env node" b
|
|
||||||
#!/usr/bin/env node
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet vreq "assign a CommonJS-style module to a var"
|
|
||||||
var ${0:${1/(.+\/)*(\w+)(-|\b|$)(\..+$)?/\u$2/g}} = require('$1');
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ex "module.exports"
|
|
||||||
module.exports = $1;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet hcs "http.createServer"
|
|
||||||
http.createServer($1).listen($2);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ncs "net.createServer"
|
|
||||||
net.createServer(function(${1:socket}){
|
|
||||||
$1.on('data', function(${3:data}){
|
|
||||||
$4
|
|
||||||
});
|
|
||||||
$1.on('end', function(){
|
|
||||||
$5
|
|
||||||
});
|
|
||||||
}).listen(${6:8124});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pipe "pipe"
|
|
||||||
pipe(${1:stream})$2
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Express snippets
|
|
||||||
|
|
||||||
snippet eget "express GET"
|
|
||||||
${1:app}.get('$2', $3);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet epost "express POST"
|
|
||||||
${1:app}.post('$2', $3);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet eput "express PUT"
|
|
||||||
${1:app}.put('$2', $3);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet edelete "express DELETE"
|
|
||||||
${1:app}.delete('$2', $3);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# process snippets
|
|
||||||
|
|
||||||
snippet stdout "stdout"
|
|
||||||
process.stdout
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet stdin "stdin"
|
|
||||||
process.stdin
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet stderr "stderr"
|
|
||||||
process.stderr
|
|
||||||
endsnippet
|
|
||||||
|
|
|
@ -1,225 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
############
|
|
||||||
# COMMON #
|
|
||||||
############
|
|
||||||
|
|
||||||
# The smart snippets use a global options called
|
|
||||||
# "g:ultisnips_javascript.{option}" which can control the format
|
|
||||||
# of trailing semicolon, space before function paren, etc.
|
|
||||||
#
|
|
||||||
# e.g.
|
|
||||||
# let g:ultisnips_javascript = {
|
|
||||||
# \ 'keyword-spacing': 'always',
|
|
||||||
# \ 'semi': 'never',
|
|
||||||
# \ 'space-before-function-paren': 'always',
|
|
||||||
# \ }
|
|
||||||
|
|
||||||
|
|
||||||
global !p
|
|
||||||
from javascript_snippets import (
|
|
||||||
semi, space_before_function_paren, keyword_spacing
|
|
||||||
)
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
###########################################################################
|
|
||||||
# TextMate Snippets #
|
|
||||||
###########################################################################
|
|
||||||
snippet get "Get Elements"
|
|
||||||
getElement${1/(T)|(C)|.*/(?1:s)(?2:s)/}By${1:T}${1/(T)|(I)|(C).*/(?1:agName)(?2:d)(?3:lassName)/}('$2')
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet '':f "object method string"
|
|
||||||
'${1:${2:#thing}:${3:click}}': function`!p snip.rv = space_before_function_paren(snip)`(element) {
|
|
||||||
${VISUAL}$0
|
|
||||||
}${10:,}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet :f "Object Method"
|
|
||||||
${1:method_name}: function`!p snip.rv = space_before_function_paren(snip)`(${3:attribute}) {
|
|
||||||
${VISUAL}$0
|
|
||||||
}${10:,}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet :, "Object Value JS"
|
|
||||||
${1:value_name}: ${0:value},
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet : "Object key key: 'value'"
|
|
||||||
${1:key}: ${2:"${3:value}"}${4:, }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet proto "Prototype (proto)"
|
|
||||||
${1:class_name}.prototype.${2:method_name} = function`!p snip.rv = space_before_function_paren(snip)`(${3:first_argument}) {
|
|
||||||
${VISUAL}$0
|
|
||||||
}`!p snip.rv = semi(snip)`
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fun "function (named)" b
|
|
||||||
function ${1:function_name}`!p snip.rv = space_before_function_paren(snip)`(${2:argument}) {
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet vf "function (assigned to var)"
|
|
||||||
${1:var }${2:function_name} = function $2`!p snip.rv = space_before_function_paren(snip)`($3) {
|
|
||||||
${VISUAL}$0
|
|
||||||
}`!p snip.rv = semi(snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Drop priority so this only triggers when not beginning of line.
|
|
||||||
priority -51
|
|
||||||
snippet fun "function (anonymous)" w
|
|
||||||
function`!p snip.rv = space_before_function_paren(snip)`($1) {
|
|
||||||
${VISUAL}$0
|
|
||||||
}$2
|
|
||||||
endsnippet
|
|
||||||
priority -50
|
|
||||||
|
|
||||||
snippet anf "function (anonymous)" i
|
|
||||||
function`!p snip.rv = space_before_function_paren(snip)`($1) {
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet iife "Immediately-Invoked Function Expression (iife)"
|
|
||||||
(function`!p snip.rv = space_before_function_paren(snip)`(${1:window}) {
|
|
||||||
${VISUAL}$0
|
|
||||||
}(${2:$1}))`!p snip.rv = semi(snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;fe "Minify safe iife"
|
|
||||||
;(function`!p snip.rv = space_before_function_paren(snip)`(${1}) {
|
|
||||||
${VISUAL}$0
|
|
||||||
}(${2}))
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet timeout "setTimeout function"
|
|
||||||
setTimeout(function`!p snip.rv = space_before_function_paren(snip)`() {
|
|
||||||
${VISUAL}$0
|
|
||||||
}${2:.bind(${3:this})}, ${1:10})`!p snip.rv = semi(snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fi "for prop in obj using hasOwnProperty" b
|
|
||||||
for`!p snip.rv = keyword_spacing(snip)`(${1:prop} in ${2:obj}){
|
|
||||||
if`!p snip.rv = keyword_spacing(snip)`($2.hasOwnProperty($1)) {
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet if "if (condition) { ... }"
|
|
||||||
if`!p snip.rv = keyword_spacing(snip)`(${1:true}) {
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ife "if (condition) { ... } else { ... }"
|
|
||||||
if`!p snip.rv = keyword_spacing(snip)`(${1:true}) {
|
|
||||||
${VISUAL}$0
|
|
||||||
}`!p snip.rv = keyword_spacing(snip)`else`!p snip.rv = keyword_spacing(snip)`{
|
|
||||||
${2}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet switch
|
|
||||||
switch`!p snip.rv = keyword_spacing(snip)`(${VISUAL}${1:expression}) {
|
|
||||||
case '${VISUAL}${3:case}':
|
|
||||||
${4}
|
|
||||||
break`!p snip.rv = semi(snip)`
|
|
||||||
${0}
|
|
||||||
default:
|
|
||||||
${2}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet case "case 'xyz': ... break"
|
|
||||||
case`!p snip.rv = keyword_spacing(snip)`'${VISUAL}${1:case}':
|
|
||||||
${VISUAL}$0
|
|
||||||
break`!p snip.rv = semi(snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet do "do { ... } while (condition)"
|
|
||||||
do`!p snip.rv = keyword_spacing(snip)`{
|
|
||||||
${VISUAL}$0
|
|
||||||
}`!p snip.rv = keyword_spacing(snip)`while`!p snip.rv = keyword_spacing(snip)`(${1:/* condition */})`!p snip.rv = semi(snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ret "Return statement"
|
|
||||||
return ${VISUAL}$0`!p snip.rv = semi(snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet us
|
|
||||||
'use strict'`!p snip.rv = semi(snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet imp "import"
|
|
||||||
import ${2} from ${1}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Debugging
|
|
||||||
snippet de
|
|
||||||
debugger`!p snip.rv = semi(snip)`
|
|
||||||
endsnippet
|
|
||||||
snippet cl "console.log"
|
|
||||||
console.log(${0})`!p snip.rv = semi(snip)`
|
|
||||||
endsnippet
|
|
||||||
snippet cd "console.debug"
|
|
||||||
console.debug(${0})`!p snip.rv = semi(snip)`
|
|
||||||
endsnippet
|
|
||||||
snippet ce "console.error"
|
|
||||||
console.error(${0})`!p snip.rv = semi(snip)`
|
|
||||||
endsnippet
|
|
||||||
snippet cw "console.warn"
|
|
||||||
console.warn(${0})`!p snip.rv = semi(snip)`
|
|
||||||
endsnippet
|
|
||||||
snippet ci "console.info"
|
|
||||||
console.info(${0})`!p snip.rv = semi(snip)`
|
|
||||||
endsnippet
|
|
||||||
snippet ct "console.trace"
|
|
||||||
console.trace(${0:label})`!p snip.rv = semi(snip)`
|
|
||||||
endsnippet
|
|
||||||
snippet ctime "console.time ... console.timeEnd"
|
|
||||||
console.time("${1:label}")`!p snip.rv = semi(snip)`
|
|
||||||
${0:${VISUAL}}
|
|
||||||
console.timeEnd("$1")`!p snip.rv = semi(snip)`
|
|
||||||
endsnippet
|
|
||||||
snippet ctimestamp "console.timeStamp"
|
|
||||||
console.timeStamp("${1:label}")`!p snip.rv = semi(snip)`
|
|
||||||
endsnippet
|
|
||||||
snippet ca "console.assert"
|
|
||||||
console.assert(${1:expression}, ${0:obj})`!p snip.rv = semi(snip)`
|
|
||||||
endsnippet
|
|
||||||
snippet cclear "console.clear"
|
|
||||||
console.clear()`!p snip.rv = semi(snip)`
|
|
||||||
endsnippet
|
|
||||||
snippet cdir "console.dir"
|
|
||||||
console.dir(${0:obj})`!p snip.rv = semi(snip)`
|
|
||||||
endsnippet
|
|
||||||
snippet cdirx "console.dirxml"
|
|
||||||
console.dirxml(${1:object})`!p snip.rv = semi(snip)`
|
|
||||||
endsnippet
|
|
||||||
snippet cgroup "console.group"
|
|
||||||
console.group("${1:label}")`!p snip.rv = semi(snip)`
|
|
||||||
${0:${VISUAL}}
|
|
||||||
console.groupEnd()`!p snip.rv = semi(snip)`
|
|
||||||
endsnippet
|
|
||||||
snippet cgroupc "console.groupCollapsed"
|
|
||||||
console.groupCollapsed("${1:label}")`!p snip.rv = semi(snip)`
|
|
||||||
${0:${VISUAL}}
|
|
||||||
console.groupEnd()`!p snip.rv = semi(snip)`
|
|
||||||
endsnippet
|
|
||||||
snippet cprof "console.profile"
|
|
||||||
console.profile("${1:label}")`!p snip.rv = semi(snip)`
|
|
||||||
${0:${VISUAL}}
|
|
||||||
console.profileEnd()`!p snip.rv = semi(snip)`
|
|
||||||
endsnippet
|
|
||||||
snippet ctable "console.table"
|
|
||||||
console.table(${1:"${2:value}"})`!p snip.rv = semi(snip)`
|
|
||||||
endsnippet
|
|
||||||
snippet clstr "console.log stringified"
|
|
||||||
console.log(JSON.stringify(${0}, null, 2))`!p snip.rv = semi(snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -1,56 +0,0 @@
|
||||||
global !p
|
|
||||||
# Capitalize the first letter without affecting the rest of the letters
|
|
||||||
def capitalize_first(word):
|
|
||||||
if(word):
|
|
||||||
word = word[0].upper() + word[1:]
|
|
||||||
return word
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
# Functional components
|
|
||||||
snippet rfc "react functional component" b
|
|
||||||
import React, {useState} from "react"
|
|
||||||
|
|
||||||
function ${1:`!p snip.rv = snip.basename`}(${2}){
|
|
||||||
return(
|
|
||||||
<div>
|
|
||||||
${3:<p>Body</p>}
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default $4`!p snip.rv = snip.basename`
|
|
||||||
endsnippet
|
|
||||||
# React Hooks
|
|
||||||
snippet useS "useState Hook" b
|
|
||||||
const [${1}, set`!p snip.rv=capitalize_first(t[1])`] = useState(${3:"${4}"})
|
|
||||||
endsnippet
|
|
||||||
snippet useE "useEffect Hook" b
|
|
||||||
useEffect(() => {
|
|
||||||
${1:${0}}
|
|
||||||
}${2})
|
|
||||||
endsnippet
|
|
||||||
snippet useC "useContext Hook" b
|
|
||||||
const ${1:context} = useContext(${2})
|
|
||||||
endsnippet
|
|
||||||
snippet useRe "useReducer Hook" b
|
|
||||||
const [${3:state}, ${4:dispatch}] = useReducer(${5:reducer}, ${2:initial_value})
|
|
||||||
endsnippet
|
|
||||||
snippet useCB "useCallback(fn, inputs)" b
|
|
||||||
const ${1:callback} = useCallback((${2})) => ${3:{
|
|
||||||
${4}
|
|
||||||
}}, [${5}])
|
|
||||||
endsnippet
|
|
||||||
snippet useM "useMemo(fn, inputs)" b
|
|
||||||
const ${1:memorized} = useMemo(() => ${2:{
|
|
||||||
${3}
|
|
||||||
}}, [${4}])
|
|
||||||
endsnippet
|
|
||||||
snippet useR "useRef(defaultValue)" b
|
|
||||||
const ${1:ref} = useRef(${2:null})
|
|
||||||
endsnippet
|
|
||||||
snippet ir "import React"
|
|
||||||
import React from "react"
|
|
||||||
endsnippet
|
|
||||||
snippet irc "import React and Component"
|
|
||||||
import React, { Component } from "react"
|
|
||||||
endsnippet
|
|
|
@ -1,209 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
# http://jinja.pocoo.org/
|
|
||||||
|
|
||||||
# jinja2 is a full featured template engine for Python. It has full
|
|
||||||
# unicode support, an optional integrated sandboxed execution
|
|
||||||
# environment, widely used and BSD licensed.
|
|
||||||
|
|
||||||
# possible extends:
|
|
||||||
#extends html
|
|
||||||
|
|
||||||
|
|
||||||
snippet block "block" b
|
|
||||||
{% block ${1:name} %}
|
|
||||||
$2
|
|
||||||
{% endblock $1 %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet {{ "variable" b
|
|
||||||
{{ $1 }}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet {# "comment" b
|
|
||||||
{# $1 #}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet # "comment" b
|
|
||||||
{# $1 #}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet raw "escaped block" b
|
|
||||||
{% raw %}
|
|
||||||
$1
|
|
||||||
{% endraw %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet extends "extends" b
|
|
||||||
{% extends "${1:template}" %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet include "include" b
|
|
||||||
{% include "${1:template}" %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet import "import" b
|
|
||||||
{% import "${1:template}" %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet from "from/import/as" b
|
|
||||||
{% from "${1:template}" import ${2:name}${3: as ${4:$2}} %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet filter "filter" b
|
|
||||||
{% filter ${1:filter} %}
|
|
||||||
$2
|
|
||||||
{% endfilter %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
# Being able to quickly remove the whole 'else' block seems faster to me than
|
|
||||||
# choosing between 'for' and 'for/else' snippets from the menu.
|
|
||||||
# snippet for "for" b
|
|
||||||
# {% for ${1:item} in ${2:sequence} %}
|
|
||||||
# $3${4:
|
|
||||||
# {% else %}
|
|
||||||
# $5}
|
|
||||||
# {% endfor %}
|
|
||||||
# endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet for "for" b
|
|
||||||
{% for ${1:item} in ${2:sequence} %}
|
|
||||||
$3
|
|
||||||
{% endfor %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet for "for/else" b
|
|
||||||
{% for ${1:item} in ${2:sequence} %}
|
|
||||||
$3
|
|
||||||
{% else %}
|
|
||||||
$4
|
|
||||||
{% endfor %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet if "if" b
|
|
||||||
{% if ${1:expr} %}
|
|
||||||
$2
|
|
||||||
{% endif %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet if "if/else" b
|
|
||||||
{% if ${1:expr} %}
|
|
||||||
$2
|
|
||||||
{% else %}
|
|
||||||
$3
|
|
||||||
{% endif %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet if "if/elif/else" b
|
|
||||||
{% if ${1:expr} %}
|
|
||||||
$2
|
|
||||||
{% elif %}
|
|
||||||
$3
|
|
||||||
{% else %}
|
|
||||||
$4
|
|
||||||
{% endif %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet macro "macro" b
|
|
||||||
{% macro ${1:name}(${2:args}) %}
|
|
||||||
$3
|
|
||||||
{% endmacro %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet call "call" b
|
|
||||||
{% call ${1:name}(${2:args}) %}
|
|
||||||
$3
|
|
||||||
{% endcall %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet set "set" b
|
|
||||||
{% set ${1:name} = ${2:'value'} %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet trans "translation" b
|
|
||||||
{% trans %}
|
|
||||||
$1
|
|
||||||
{% endtrans %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet with "with" b
|
|
||||||
{% with %}
|
|
||||||
$1
|
|
||||||
{% endwith %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet autoescape "autoescape" b
|
|
||||||
{% autoescape ${1:true} %}
|
|
||||||
$2
|
|
||||||
{% endautoescape %}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Filters
|
|
||||||
# @todo: expand only when snippet is preceeded by a |
|
|
||||||
|
|
||||||
snippet batch "batch items" w
|
|
||||||
batch(linecount=$1, fill_with=${2:None})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet dictsort "sort and yield (key, value) pairs" w
|
|
||||||
dictsort(case_sensitive=${1:False}, by=${2:'key'})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet round "round number" w
|
|
||||||
round(precision=${1:0}, method=${2:'common|ceil|floor'})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet urlize "convert plain-text url to <a/>" w
|
|
||||||
urlize(trim_url_limit=${1:None}, nofollow=${2:False})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet wordwrap "wordwrap" w
|
|
||||||
wordwrap(width=${1:79}, break_long_words=${2:True})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet truncate "truncate" w
|
|
||||||
truncate(lenght=${1:79}, killwords=${2:False}, end=${3:'...''})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet sum "sum of sequence of numbers + start" w
|
|
||||||
sum(attribute=${1:None}, start=${2:0})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet sort "sort an iterable" w
|
|
||||||
sort(reverse=${1:False}, case_sensitive=${2:False}, attribute=${3:None})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet indent "indent" w
|
|
||||||
indent(width=${1:4}, indentfirst=${2:False})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -1,51 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
snippet s "String" b
|
|
||||||
"${1:key}": "${0:value}",
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet n "Number" b
|
|
||||||
"${1:key}": ${0:value},
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet a "Array" b
|
|
||||||
[
|
|
||||||
${VISUAL}$0
|
|
||||||
],
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet na "Named array" b
|
|
||||||
"${1:key}": [
|
|
||||||
${VISUAL}$0
|
|
||||||
],
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet o "Object" b
|
|
||||||
{
|
|
||||||
${VISUAL}$0
|
|
||||||
},
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet no "Named object" b
|
|
||||||
"${1:key}": {
|
|
||||||
${VISUAL}$0
|
|
||||||
},
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet null "Null" b
|
|
||||||
"${0:key}": null,
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
global !p
|
|
||||||
def compB(t, opts):
|
|
||||||
if t:
|
|
||||||
opts = [m[len(t):] for m in opts if m.startswith(t)]
|
|
||||||
if len(opts) == 1:
|
|
||||||
return opts[0]
|
|
||||||
return "(" + '|'.join(opts) + ')'
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
snippet b "Bool" b
|
|
||||||
"${1:key}": $2`!p snip.rv=compB(t[2], ['true', 'false'])`,
|
|
||||||
endsnippet
|
|
|
@ -1,43 +0,0 @@
|
||||||
# Documentation
|
|
||||||
snippet docf "function documentation" b
|
|
||||||
#' @description
|
|
||||||
#'
|
|
||||||
#' ${1:function description}
|
|
||||||
#'
|
|
||||||
#' ${2:@param ${3:name}::${4:Type} ${5:Description}}
|
|
||||||
#'
|
|
||||||
#' ${6:@returns ${7:name}::${8:Type} ${9:Description}}
|
|
||||||
#'
|
|
||||||
#' @examples
|
|
||||||
#'
|
|
||||||
#' ${10: function call examples}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet doct "type definition" b
|
|
||||||
#' @description
|
|
||||||
#'
|
|
||||||
#' ${1:type description}
|
|
||||||
#'
|
|
||||||
#' ${2:@field ${3:name}::${4:Type} ${5:Description}}
|
|
||||||
#'
|
|
||||||
#' @examples
|
|
||||||
#'
|
|
||||||
#' ${10: constructor examples}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet par "function parameter documentation" b
|
|
||||||
#' @param ${1:name}::${2:Type} ${0:Description}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fld "type field documentation" b
|
|
||||||
#' @field ${1:name}::${2:Type} ${0:Description}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Debugging
|
|
||||||
snippet deb "Debugger breakpoint" b
|
|
||||||
Main.@bp
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet inf "Infiltrator breakpoint" b
|
|
||||||
Main.@infiltrate
|
|
||||||
endsnippet
|
|
|
@ -1,7 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
snippet t "Transaction" b
|
|
||||||
${1:`!v strftime("%Y")`}-${2:`!v strftime("%m")`}-${3:`!v strftime("%d")`} ${4:*} ${5:Payee}
|
|
||||||
${6:Expenses} \$${7:0.00}
|
|
||||||
${8:Assets:Checking}$0
|
|
||||||
endsnippet
|
|
|
@ -1,3 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
extends haskell
|
|
|
@ -1,116 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
#################################
|
|
||||||
# Snippets for the Lua language #
|
|
||||||
#################################
|
|
||||||
snippet #! "#!/usr/bin/env lua" b
|
|
||||||
#!/usr/bin/env lua
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet assert "Assertion" b
|
|
||||||
assert(${1:condition}`!p
|
|
||||||
if t[2]:
|
|
||||||
snip.rv = ", "
|
|
||||||
else:
|
|
||||||
snip.rv = ""
|
|
||||||
`${2:msg})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet !fun(ction)?! "New function" br
|
|
||||||
function ${1:new_function}(${2:args})
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet forp "pair for loop" b
|
|
||||||
for ${1:name},${2:val} in pairs(${3:table_name}) do
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fori "ipair for foop" b
|
|
||||||
for ${1:idx},${2:val} in ipairs(${3:table_name}) do
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet for "numeric for loop" b
|
|
||||||
for ${1:i}=${2:first},${3:last}${4/^..*/(?0:,:)/}${4:step} do
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet do "do block"
|
|
||||||
do
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet repeat "repeat loop" b
|
|
||||||
repeat
|
|
||||||
$1
|
|
||||||
until $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet while "while loop" b
|
|
||||||
while $1 do
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet if "if statement" b
|
|
||||||
if $1 then
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ife "if/else statement" b
|
|
||||||
if $1 then
|
|
||||||
$2
|
|
||||||
else
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet eif "if/elseif statement" b
|
|
||||||
if $1 then
|
|
||||||
$2
|
|
||||||
elseif $3 then
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet eife "if/elseif/else statement" b
|
|
||||||
if $1 then
|
|
||||||
$2
|
|
||||||
elseif $3 then
|
|
||||||
$4
|
|
||||||
else
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pcall "pcall statement" b
|
|
||||||
local ok, err = pcall(${1:your_function})
|
|
||||||
if not ok then
|
|
||||||
handler(${2:ok, err})
|
|
||||||
${3:else
|
|
||||||
success(${4:ok, err})
|
|
||||||
}end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet local "local x = 1"
|
|
||||||
local ${1:x} = ${0:1}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet use "Use" b
|
|
||||||
use { '$1' }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet req "Require" b
|
|
||||||
require('$1')
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -1,11 +0,0 @@
|
||||||
# Delimiters
|
|
||||||
|
|
||||||
# set priority 2 to override snippets in all.snippets
|
|
||||||
priority 2
|
|
||||||
snippet "(^|[\W])\\\{" "\{ ... \}" rA
|
|
||||||
`!p snip.rv = match.group(1)`\\{ ${1:${VISUAL:}} \\}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(^|[^a-zA-Z0-9])``" "LaTeX quotation marks" rA
|
|
||||||
`!p snip.rv = match.group(1)`\`\`${1:${VISUAL:}}''$0
|
|
||||||
endsnippet
|
|
|
@ -1,29 +0,0 @@
|
||||||
snippet env "New environment" bA
|
|
||||||
\begin{$1}
|
|
||||||
$0
|
|
||||||
\end{$1}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# hacky way to stop UltiSnips from mirroring the {$2} tag
|
|
||||||
snippet eenv "New environment" bA
|
|
||||||
\begin{$1}{$2}
|
|
||||||
$0
|
|
||||||
\end{$1}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet itt "Itemize environment" bA
|
|
||||||
\begin{itemize}
|
|
||||||
|
|
||||||
\item $0
|
|
||||||
|
|
||||||
\end{itemize}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet enn "Enumerate environment" bA
|
|
||||||
\begin{enumerate}
|
|
||||||
|
|
||||||
\item $0
|
|
||||||
|
|
||||||
\end{enumerate}
|
|
||||||
endsnippet
|
|
|
@ -1,17 +0,0 @@
|
||||||
# Font styles
|
|
||||||
|
|
||||||
snippet "(^|[^a-zA-Z\\])tt" "\texttt{} (typewriter)" rA
|
|
||||||
`!p snip.rv = match.group(1)`\texttt{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(^|[^a-zA-Z])tii" "\textit{} " rA
|
|
||||||
`!p snip.rv = match.group(1)`\textit{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(^|[^a-zA-Z])tbb" "\textbf{} " rA
|
|
||||||
`!p snip.rv = match.group(1)`\textbf{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(^|[^a-zA-Z])ul" "\underline{} (underline)" r
|
|
||||||
`!p snip.rv = match.group(1)`\underline{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
|
@ -1,26 +0,0 @@
|
||||||
snippet ll "Lilypond environment" bA
|
|
||||||
%<LILY_START>
|
|
||||||
\begin{lilypond}
|
|
||||||
$0
|
|
||||||
\end{lilypond}
|
|
||||||
%<LILY_END>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet lf "\lilypondfile command" bA
|
|
||||||
%<LILY_START>
|
|
||||||
\lilypondfile{$1}$0
|
|
||||||
%<LILY_END>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(^|[^a-zA-Z])sd" "\music{} command" rA
|
|
||||||
`!p snip.rv = match.group(1)`\music{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;f "\flat" iA
|
|
||||||
\flat
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;s "\sharp" iA
|
|
||||||
\sharp
|
|
||||||
endsnippet
|
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
global !p
|
|
||||||
def math():
|
|
||||||
return vim.eval('vimtex#syntax#in_mathzone()') == '1'
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
|
|
||||||
snippet -- "Commented line % ----------------- %" bA
|
|
||||||
% --------------------------------------------- %
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([\W_])LL" "& (alignment character, which is a pain to reach)" rA
|
|
||||||
`!p snip.rv = match.group(1)`&
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rule "horizontal rule" b
|
|
||||||
\rule{\textwidth}{0.5pt}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet hl "\hline with vertical spacing for tables"
|
|
||||||
\hline {\rule{0pt}{2.5ex}} \hspace{-7pt}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tbs "\textbackslash" iA
|
|
||||||
\textbackslash
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ii "Item for enumerated environments \item" bA
|
|
||||||
\item
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet hff "\hfill" iA
|
|
||||||
\hfill
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(^|[^a-zA-Z0-9\\])qq" "\qquad" rA
|
|
||||||
`!p snip.rv = match.group(1)`\qquad
|
|
||||||
endsnippet
|
|
|
@ -1,111 +0,0 @@
|
||||||
# Various ``system-style'' commands.
|
|
||||||
|
|
||||||
# BEGIN PREAMBLE SNIPPETS
|
|
||||||
# --------------------------------------------- #
|
|
||||||
snippet pack "\usepackage{}" b
|
|
||||||
\usepackage{$1}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet nc "\newcommand{}{}" b
|
|
||||||
\newcommand{$1}{$2}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rnc "\renewcommand{}{}" b
|
|
||||||
\renewcommand{$1}{$2}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet inn "\input{} intended for use in FMF documents" bA
|
|
||||||
\input{${1:~/MEGA/academics/templates/}$2}$0
|
|
||||||
endsnippet
|
|
||||||
# --------------------------------------------- #
|
|
||||||
# END PREAMBLE SNIPPETS
|
|
||||||
|
|
||||||
|
|
||||||
# BEGIN SECTIONING SNIPPETS
|
|
||||||
# --------------------------------------------- #
|
|
||||||
snippet s "New section" b
|
|
||||||
\section{$1}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ss "New subsection" b
|
|
||||||
\subsection{$1}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sss "New subsubsection" bA
|
|
||||||
\subsubsection{$1}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ns "\newsec{} (for equation sheet sections)" bA
|
|
||||||
\newsec{$1}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet toc "\tableofcontents" b
|
|
||||||
\tableofcontents
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet np "\newpage" b
|
|
||||||
\newpage
|
|
||||||
endsnippet
|
|
||||||
# --------------------------------------------- #
|
|
||||||
# END SECTIONING SNIPPETS
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(^|[\W_])TODOO" "TODO mark" rA
|
|
||||||
`!p snip.rv = match.group(1)`\TODO{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
# BEGIN REFERENCING SNIPPETS
|
|
||||||
# --------------------------------------------- #
|
|
||||||
snippet "([\W_])lbl" "\label{} (for creating cross-references and hyperlinks)" rA
|
|
||||||
`!p snip.rv = match.group(1)`\label{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([^a-zA-Z\s])RR" "\ref{}" rA
|
|
||||||
`!p snip.rv = match.group(1)`~\ref{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# one or more white space characters followed by RR
|
|
||||||
snippet "[\s]+RR" "\ref{}" rA
|
|
||||||
~\ref{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(^|[\W_])REF" "TODO: reference" rA
|
|
||||||
`!p snip.rv = match.group(1)`\TODO{reference}$0
|
|
||||||
endsnippet
|
|
||||||
# --------------------------------------------- #
|
|
||||||
# END REFERENCING SNIPPETS
|
|
||||||
|
|
||||||
|
|
||||||
snippet url "\myurl{url}"
|
|
||||||
\url{${1:${VISUAL:url}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet hr "\href{url}{display name} (for url links)"
|
|
||||||
\href{${1:url}}{${2:display name}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet hrr "\hyperref[label]{display name} (for referencing labeled sections)" A
|
|
||||||
\hyperref[${1:label}]{${2:display name}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
# BEGIN SPACING SNIPPETS
|
|
||||||
# --------------------------------------------- #
|
|
||||||
snippet "([vhm])s" "(vhm)space (various spacing commands in one regex)" r
|
|
||||||
\\`!p snip.rv = match.group(1)`space{$1}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "vs([1-9])" "vspace with predefined spacing" rA
|
|
||||||
\\vspace{0.`!p snip.rv = match.group(1)`ex}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet hpp "\hphantom{}" iA
|
|
||||||
\hphantom{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tls "\textls[]{}" i
|
|
||||||
\textls[$1]{${2:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
# --------------------------------------------- #
|
|
||||||
# END SPACING SNIPPETS
|
|
|
@ -1,92 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
#################
|
|
||||||
# From snipmate #
|
|
||||||
#################
|
|
||||||
snippet def "definition" b
|
|
||||||
<%def name="${1:name}">
|
|
||||||
${2:}
|
|
||||||
</%def>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet call "call" b
|
|
||||||
<%call expr="${1:name}">
|
|
||||||
${2:}
|
|
||||||
</%call>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet doc "doc" b
|
|
||||||
<%doc>
|
|
||||||
${1:}
|
|
||||||
</%doc>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet text "text" b
|
|
||||||
<%text>
|
|
||||||
${1:}
|
|
||||||
</%text>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet for "for" b
|
|
||||||
% for ${1:i} in ${2:iter}:
|
|
||||||
${3:}
|
|
||||||
% endfor
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet if "if " b
|
|
||||||
% if ${1:condition}:
|
|
||||||
${2:}
|
|
||||||
% endif
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet if "if/else" b
|
|
||||||
% if ${1:condition}:
|
|
||||||
${2:}
|
|
||||||
% else:
|
|
||||||
${3:}
|
|
||||||
% endif
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet try "try" b
|
|
||||||
% try:
|
|
||||||
${1:}
|
|
||||||
% except${2:}:
|
|
||||||
${3:pass}
|
|
||||||
% endtry
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet wh "wh" b
|
|
||||||
% while ${1:}:
|
|
||||||
${2:}
|
|
||||||
% endwhile
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet $ "$" i
|
|
||||||
${${1:}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet <% "<%" b
|
|
||||||
<% ${1:} %>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet <!% "<!%" b
|
|
||||||
<!% ${1:} %>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet inherit "inherit" b
|
|
||||||
<%inherit file="${1:filename}" />
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet include "include" b
|
|
||||||
<%include file="${1:filename}" />
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet namespace "namespace" b
|
|
||||||
<%namespace file="${1:name}" />
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet page "page" b
|
|
||||||
<%page args="${1:}" />
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -1,148 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
global !p
|
|
||||||
# A overkill(dirty) table with automatic alignment feature
|
|
||||||
def create_table(snip):
|
|
||||||
# retrieving single line from current string and treat it like tabstops count
|
|
||||||
placeholders_string = snip.buffer[snip.line].strip()
|
|
||||||
rows_amount = int(placeholders_string[0])
|
|
||||||
columns_amount = int(placeholders_string[1])
|
|
||||||
|
|
||||||
prefix_str = "from vimsnippets import display_width;"
|
|
||||||
|
|
||||||
# erase current line
|
|
||||||
snip.buffer[snip.line] = ""
|
|
||||||
|
|
||||||
# create anonymous snippet with expected content and number of tabstops
|
|
||||||
anon_snippet_title = "| "
|
|
||||||
anon_snippet_delimiter = "|"
|
|
||||||
for col in range(1, columns_amount+1):
|
|
||||||
sync_rows = [x*columns_amount+col for x in range(rows_amount+1)]
|
|
||||||
sync_str = ",".join(["t[{0}]".format(x) for x in sync_rows])
|
|
||||||
max_width_str = "max(list(map(display_width, [" + sync_str + "])))"
|
|
||||||
cur_width_str = "display_width(t[" + str(col) + "])"
|
|
||||||
rv_val = "(" + max_width_str + "-" + cur_width_str + ")*' '"
|
|
||||||
anon_snippet_title += "${" + str(col) + ":head" + str(col)\
|
|
||||||
+ "}`!p " + prefix_str + "snip.rv=" + rv_val + "` | "
|
|
||||||
anon_snippet_delimiter += ":`!p " + prefix_str + "snip.rv = "\
|
|
||||||
+ max_width_str + "*'-'" + "`-|"
|
|
||||||
|
|
||||||
anon_snippet_title += "\n"
|
|
||||||
|
|
||||||
anon_snippet_delimiter += "\n"
|
|
||||||
anon_snippet_body = ""
|
|
||||||
for row in range(1, rows_amount+1):
|
|
||||||
body_row = "| "
|
|
||||||
for col in range(1, columns_amount+1):
|
|
||||||
sync_rows = [x*columns_amount+col for x in range(rows_amount+1)]
|
|
||||||
sync_str = ",".join(["t[{0}]".format(x) for x in sync_rows])
|
|
||||||
max_width_str = "max(list(map(display_width, [" + sync_str + "])))"
|
|
||||||
cur_width_str = "display_width(t[" + str(row*columns_amount+col) + "])"
|
|
||||||
rv_val = "(" + max_width_str + "-" + cur_width_str + ")*' '"
|
|
||||||
placeholder = "R{0}C{1}".format(row, col)
|
|
||||||
body_row += "${" + str(row*columns_amount+col) + ":" + placeholder\
|
|
||||||
+ "}`!p " + prefix_str + "snip.rv=" + rv_val + "` | "
|
|
||||||
|
|
||||||
body_row += "\n"
|
|
||||||
anon_snippet_body += body_row
|
|
||||||
|
|
||||||
anon_snippet_table = anon_snippet_title + anon_snippet_delimiter + anon_snippet_body
|
|
||||||
|
|
||||||
# expand anonymous snippet
|
|
||||||
snip.expand_anon(anon_snippet_table)
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
###########################
|
|
||||||
# Sections and Paragraphs #
|
|
||||||
###########################
|
|
||||||
snippet sec "Section" b
|
|
||||||
# ${1:Section Name} #
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ssec "Sub Section" b
|
|
||||||
## ${1:Section Name} ##
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sssec "SubSub Section" b
|
|
||||||
### ${1:Section Name} ###
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet par "Paragraph" b
|
|
||||||
#### ${1:Paragraph Name} ####
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet spar "Paragraph" b
|
|
||||||
##### ${1:Paragraph Name} #####
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
###################
|
|
||||||
# Text formatting #
|
|
||||||
###################
|
|
||||||
|
|
||||||
snippet * "italics"
|
|
||||||
*${1:${VISUAL}}*$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ** "bold"
|
|
||||||
**${1:${VISUAL}}**$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet *** "bold italics"
|
|
||||||
***${1:${VISUAL}}***$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet /* "Comment"
|
|
||||||
<!-- ${1:${VISUAL}} -->$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
################
|
|
||||||
# Common stuff #
|
|
||||||
################
|
|
||||||
snippet link "Link to something"
|
|
||||||
[${1:${VISUAL:Text}}](${3:https://${2:www.url.com}})$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet img "Image"
|
|
||||||
![${1:pic alt}](${2:path}${3/.+/ "/}${3:opt title}${3/.+/"/})$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ilc "Inline Code" i
|
|
||||||
\`${1:${VISUAL}}\`$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cbl "Codeblock" b
|
|
||||||
\`\`\`$1
|
|
||||||
${2:${VISUAL}}
|
|
||||||
\`\`\`
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet refl "Reference Link"
|
|
||||||
[${1:${VISUAL:Text}}][${2:id}]$0
|
|
||||||
|
|
||||||
[$2]:${4:https://${3:www.url.com}} "${5:$4}"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fnt "Footnote"
|
|
||||||
[^${1:${VISUAL:Footnote}}]$0
|
|
||||||
|
|
||||||
[^$1]:${2:Text}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet detail "Disclosure"
|
|
||||||
<details${3: open=""}>
|
|
||||||
${1:<summary>${2}</summary>}$0
|
|
||||||
</details>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
post_jump "create_table(snip)"
|
|
||||||
snippet "tb([1-9][1-9])" "Fancy table" br
|
|
||||||
`!p snip.rv = match.group(1)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -1,24 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
snippet switch "switch ... otherwise"
|
|
||||||
switch ${1:n}
|
|
||||||
case ${2:0}
|
|
||||||
${3}${4:
|
|
||||||
otherwise
|
|
||||||
${5}}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet clc "class with constructor" b
|
|
||||||
classdef ${1:`!p
|
|
||||||
snip.rv = snip.basename or "class_name"`}
|
|
||||||
properties
|
|
||||||
${2}
|
|
||||||
end
|
|
||||||
methods
|
|
||||||
function obj = $1(${3})
|
|
||||||
${4}
|
|
||||||
end${0}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
endsnippet
|
|
|
@ -1,272 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
###########################################################################
|
|
||||||
# TextMate Snippets #
|
|
||||||
###########################################################################
|
|
||||||
|
|
||||||
snippet imp "#import (imp)" b
|
|
||||||
#import "${1:`!p snip.rv = re.sub(r'\..*$', '.h', fn)`}"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet Imp "#import <> (Imp)"
|
|
||||||
#import <${1:Cocoa/Cocoa.h}>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cl "020 Class (objc)"
|
|
||||||
@interface ${1:`!p
|
|
||||||
if len(fn):
|
|
||||||
snip.rv = re.sub(r'\..*$', '', fn)
|
|
||||||
else:
|
|
||||||
snip.rv = "object"
|
|
||||||
`} : ${2:NSObject}
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation $1
|
|
||||||
- (id)init
|
|
||||||
{
|
|
||||||
if((self = [super init]))
|
|
||||||
{$0
|
|
||||||
}
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
@end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet array "NSArray (array)"
|
|
||||||
NSMutableArray *${1:array} = [NSMutableArray array];
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet dict "NSDictionary (dict)"
|
|
||||||
NSMutableDictionary *${1:dict} = [NSMutableDictionary dictionary];
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet forarray "for NSArray loop (forarray)"
|
|
||||||
unsigned int ${1:object}Count = [${2:array} count];
|
|
||||||
|
|
||||||
for(unsigned int index = 0; index < $1Count; index += 1)
|
|
||||||
{
|
|
||||||
${3:id} $1 = [$2 objectAtIndex:index];
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet objacc "Object Accessors (objacc)"
|
|
||||||
- (${1:id})${2:thing}
|
|
||||||
{
|
|
||||||
return $2;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)set${2/./\u$0/}:($1)aValue
|
|
||||||
{
|
|
||||||
$0${1/( \*)?$/(?1:$1: )/}old${2/./\u$0/} = $2;
|
|
||||||
$2 = [aValue retain];
|
|
||||||
[old${2/./\u$0/} release];
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sel "@selector"
|
|
||||||
@selector(${1:method}:)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cdacc "CoreData Accessors Implementation"
|
|
||||||
- (${1:id})${2:attribute}
|
|
||||||
{
|
|
||||||
[self willAccessValueForKey:@"$2"];
|
|
||||||
$1 value = [self primitiveValueForKey:@"$2"];
|
|
||||||
[self didAccessValueForKey:@"$2"];
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)set${2/./\u$0/}:($1)aValue
|
|
||||||
{
|
|
||||||
[self willChangeValueForKey:@"$2"];
|
|
||||||
[self setPrimitiveValue:aValue forKey:@"$2"];
|
|
||||||
[self didChangeValueForKey:@"$2"];
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet delegate "Delegate Responds to Selector"
|
|
||||||
if([${1:[self delegate]} respondsToSelector:@selector(${2:selfDidSomething:})])
|
|
||||||
[$1 ${3:${2/((^\s*([A-Za-z0-9_]*:)\s*)|(:\s*$)|(:\s*))/(?2:$2self :\:<>)(?4::)(?5: :)/g}}];
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet thread "Detach New NSThread"
|
|
||||||
[NSThread detachNewThreadSelector:@selector(${1:method}:) toTarget:${2:aTarget} withObject:${3:anArgument}]
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ibo "IBOutlet (ibo)"
|
|
||||||
IBOutlet ${1:NSSomeClass} *${2:${1/^[A-Z](?:[A-Z]+|[a-z]+)([A-Z]\w*)/\l$1/}};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet I "Initialize Implementation (I)"
|
|
||||||
+ (void)initialize
|
|
||||||
{
|
|
||||||
[[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
|
|
||||||
$0@"value", @"key",
|
|
||||||
nil]];
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet bind "Key:value binding (bind)"
|
|
||||||
bind:@"${1:binding}" toObject:${2:observableController} withKeyPath:@"${3:keyPath}" options:${4:nil}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet arracc "LoD array (arracc)"
|
|
||||||
- (void)addObjectTo${1:Things}:(${2:id})anObject
|
|
||||||
{
|
|
||||||
[${3:${1/./\l$0/}} addObject:anObject];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)insertObject:($2)anObject in$1AtIndex:(unsigned int)i
|
|
||||||
{
|
|
||||||
[$3 insertObject:anObject atIndex:i];
|
|
||||||
}
|
|
||||||
|
|
||||||
- ($2)objectIn$1AtIndex:(unsigned int)i
|
|
||||||
{
|
|
||||||
return [$3 objectAtIndex:i];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (unsigned int)indexOfObjectIn$1:($2)anObject
|
|
||||||
{
|
|
||||||
return [$3 indexOfObject:anObject];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)removeObjectFrom$1AtIndex:(unsigned int)i
|
|
||||||
{
|
|
||||||
[$3 removeObjectAtIndex:i];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (unsigned int)countOf$1
|
|
||||||
{
|
|
||||||
return [$3 count];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSArray *${1/./\l$0/}
|
|
||||||
{
|
|
||||||
return $3;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)set$1:(NSArray *)new$1
|
|
||||||
{
|
|
||||||
[$3 setArray:new$1];
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet arracc "LoD array interface (arracc)"
|
|
||||||
- (void)addObjectTo${1:Things}:(${2:id})anObject;
|
|
||||||
- (void)insertObject:($2)anObject in$1AtIndex:(unsigned int)i;
|
|
||||||
- ($2)objectIn$1AtIndex:(unsigned int)i;
|
|
||||||
- (unsigned int)indexOfObjectIn$1:($2)anObject;
|
|
||||||
- (void)removeObjectFrom$1AtIndex:(unsigned int)i;
|
|
||||||
- (unsigned int)countOf$1;
|
|
||||||
- (NSArray *)${1/./\l$0/};
|
|
||||||
- (void)set$1:(NSArray *)new$1;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet focus "Lock Focus"
|
|
||||||
[self lockFocus];
|
|
||||||
$0
|
|
||||||
[self unlockFocus];
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pool "NSAutoreleasePool (pool)"
|
|
||||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
|
||||||
$0
|
|
||||||
[pool drain];
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet log "NSLog (log) 2"
|
|
||||||
NSLog(@"$1"${1/[^%]*(%)?.*/(?1:, :\);)/}$2${1/[^%]*(%)?.*/(?1:\);)/}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet alert "NSRunAlertPanel (alert)"
|
|
||||||
int choice = NSRunAlertPanel(@"${1:Something important!}", @"${2:Something important just happend, and now I need to ask you, do you want to continue?}", @"${3:Continue}", @"${4:Cancel}", nil);
|
|
||||||
if(choice == NSAlertDefaultReturn) // "$3"
|
|
||||||
{
|
|
||||||
$0;
|
|
||||||
}
|
|
||||||
else if(choice == NSAlertAlternateReturn) // "$4"
|
|
||||||
{
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet format "NSString stringWithFormat (format)"
|
|
||||||
[NSString stringWithFormat:@"$1", $2]$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet objacc "Object Accessors Interface (objacc)"
|
|
||||||
- (${1:id})${2:thing};
|
|
||||||
- (void)set${2/./\u$0/}:($1)aValue;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet prop "Property"
|
|
||||||
@property (${1/^(e)$|.*/(?1:r)/}${1:r}${1/^(?:(r)|(e)|(c)|(a))$|.*/(?1:etain)(?2:adonly)(?3:opy)(?4:ssign)/}) ${2:NSSomeClass}$ *${3:${2/^[A-Z](?:[A-Z]+|[a-z]+)([A-Z]\w*)/\l$1/}};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet getprefs "Read from defaults (getprefs)"
|
|
||||||
[[NSUserDefaults standardUserDefaults] objectForKey:${1:key}];
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet obs "Register for Notification"
|
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:${1:self} selector:@selector(${3:${2/^([A-Z]{2})?(.+?)(Notification)?$/\l$2/}}:) name:${2:NSWindowDidBecomeMainNotification} object:${4:nil}];
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet responds "Responds to Selector"
|
|
||||||
if ([${1:self} respondsToSelector:@selector(${2:someSelector:})])
|
|
||||||
{
|
|
||||||
[$1 ${3:${2/((:\s*$)|(:\s*))/:<>(?3: )/g}}];
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet gsave "Save and Restore Graphics Context (gsave)"
|
|
||||||
[NSGraphicsContext saveGraphicsState];
|
|
||||||
$0
|
|
||||||
[NSGraphicsContext restoreGraphicsState];
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet acc "Scalar Accessors (acc)"
|
|
||||||
- (${1:unsigned int})${2:thing}
|
|
||||||
{
|
|
||||||
return ${3:$2};
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)set${2/./\u$0/}:(${1:unsigned int})new${2/./\u$0/}
|
|
||||||
{
|
|
||||||
$3 = new${2/./\u$0/};
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet acc "Scalar Accessors Interface (acc)"
|
|
||||||
- (${1:unsigned int})${2:thing};
|
|
||||||
- (void)set${2/./\u$0/}:($1)new${2/./\u$0/};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet stracc "String Accessors (stracc)"
|
|
||||||
- (NSString *)${1:thing}
|
|
||||||
{
|
|
||||||
return ${2:$1};
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)set${1/.*/\u$0/}:(NSString *)/})${3:a${1/.*/\u$0/}}
|
|
||||||
{
|
|
||||||
$3 = [$3 copy];
|
|
||||||
[$2 release];
|
|
||||||
$2 = $3;
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet syn "Synthesize"
|
|
||||||
@synthesize ${1:property};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet setprefs "Write to defaults (setprefs)"
|
|
||||||
[[NSUserDefaults standardUserDefaults] setObject:${1:object} forKey:${2:key}];
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -1,174 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
snippet rs "raise" b
|
|
||||||
raise (${1:Not_found})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet open "open"
|
|
||||||
let open ${1:module} in
|
|
||||||
${2:e}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet try "try"
|
|
||||||
try ${1:e}
|
|
||||||
with ${2:Not_found} -> ${3:()}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ref "ref"
|
|
||||||
let ${1:name} = ref ${2:val} in
|
|
||||||
${3:e}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet matchl "pattern match on a list"
|
|
||||||
match ${1:list} with
|
|
||||||
| [] -> ${2:()}
|
|
||||||
| x::xs -> ${3:()}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet matcho "pattern match on an option type"
|
|
||||||
match ${1:x} with
|
|
||||||
| Some(${2:y}) -> ${3:()}
|
|
||||||
| None -> ${4:()}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fun "anonymous function"
|
|
||||||
(fun ${1:x} -> ${2:x})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cc "commment"
|
|
||||||
(* ${1:comment} *)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet let "let .. in binding"
|
|
||||||
let ${1:x} = ${2:v} in
|
|
||||||
${3:e}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet lr "let rec"
|
|
||||||
let rec ${1:f} =
|
|
||||||
${2:expr}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet if "if"
|
|
||||||
if ${1:(* condition *)} then
|
|
||||||
${2:(* A *)}
|
|
||||||
else
|
|
||||||
${3:(* B *)}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet If "If"
|
|
||||||
if ${1:(* condition *)} then
|
|
||||||
${2:(* A *)}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet while "while"
|
|
||||||
while ${1:(* condition *)} do
|
|
||||||
${2:(* A *)}
|
|
||||||
done
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet for "for"
|
|
||||||
for ${1:i} = ${2:1} to ${3:10} do
|
|
||||||
${4:(* BODY *)}
|
|
||||||
done
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet match "match"
|
|
||||||
match ${1:(* e1 *)} with
|
|
||||||
| ${2:p} -> ${3:e2}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet Match "match"
|
|
||||||
match ${1:(* e1 *)} with
|
|
||||||
| ${2:p} -> ${3:e2}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet class "class"
|
|
||||||
class ${1:name} = object
|
|
||||||
${2:methods}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet obj "obj"
|
|
||||||
object
|
|
||||||
${2:methods}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet Obj "object"
|
|
||||||
object (self)
|
|
||||||
${2:methods}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet {{ "object functional update"
|
|
||||||
{< ${1:x} = ${2:y} >}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet beg "beg"
|
|
||||||
begin
|
|
||||||
${1:block}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ml "module instantiantion with functor"
|
|
||||||
module ${1:Mod} = ${2:Functor}(${3:Arg})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mod "module - no signature"
|
|
||||||
module ${1:(* Name *)} = struct
|
|
||||||
${2:(* BODY *)}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet Mod "module with signature"
|
|
||||||
module ${1:(* Name *)} : ${2:(* SIG *)} = struct
|
|
||||||
${3:(* BODY *)}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sig "anonymous signature"
|
|
||||||
sig
|
|
||||||
${2:(* BODY *)}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sigf "functor signature or anonymous functor"
|
|
||||||
functor (${1:Arg} : ${2:ARG}) -> ${3:(* BODY *)}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet func "define functor - no signature"
|
|
||||||
module ${1:M} (${2:Arg} : ${3:ARG}) = struct
|
|
||||||
${4:(* BODY *)}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet Func "define functor - with signature"
|
|
||||||
module ${1:M} (${2:Arg} : ${3:ARG}) : ${4:SIG} = struct
|
|
||||||
${5:(* BODY *)}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mot "Declare module signature"
|
|
||||||
module type ${1:(* Name *)} = sig
|
|
||||||
${2:(* BODY *)}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet module "Module with anonymous signature"
|
|
||||||
module ${1:(* Name *)} : sig
|
|
||||||
${2:(* SIGNATURE *)}
|
|
||||||
end = struct
|
|
||||||
${3:(* BODY *)}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet oo "odoc"
|
|
||||||
(** ${1:odoc} *)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet qt "inline qtest"
|
|
||||||
(*$T ${1:name}
|
|
||||||
${2:test}
|
|
||||||
*)
|
|
||||||
endsnippet
|
|
|
@ -1,2 +0,0 @@
|
||||||
extends matlab
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
extends markdown
|
|
||||||
|
|
||||||
# overwrite if necessary
|
|
||||||
priority -49
|
|
||||||
|
|
||||||
snippet title "Title Header" b
|
|
||||||
% ${1:`!v vim_snippets#Filename('$1', 'title')`}
|
|
||||||
% ${2:`!v g:snips_author`}
|
|
||||||
% ${3:`!v strftime("%d %B %Y")`}
|
|
||||||
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
|
@ -1,139 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
###########################################################################
|
|
||||||
# TextMate Snippets #
|
|
||||||
###########################################################################
|
|
||||||
snippet ife "Conditional if..else (ife)"
|
|
||||||
if ($1) {
|
|
||||||
${2:# body...}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
${3:# else...}
|
|
||||||
}
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ifee "Conditional if..elsif..else (ifee)"
|
|
||||||
if ($1) {
|
|
||||||
${2:# body...}
|
|
||||||
}
|
|
||||||
elsif ($3) {
|
|
||||||
${4:# elsif...}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
${5:# else...}
|
|
||||||
}
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet xunless "Conditional one-line (unless)"
|
|
||||||
${1:expression} unless ${2:condition};
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet xif "Conditional one-line (xif)"
|
|
||||||
${1:expression} if ${2:condition};
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sub "Function (sub)"
|
|
||||||
sub ${1:function_name} {
|
|
||||||
${2:# body...}
|
|
||||||
}
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet xfore "Loop one-line (xforeach)"
|
|
||||||
${1:expression} foreach @${2:array};
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet xwhile "Loop one-line (xwhile)"
|
|
||||||
${1:expression} while ${2:condition};
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet test "Test"
|
|
||||||
#!/usr/bin/env perl -w
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use Test::More tests => ${1:1};
|
|
||||||
use ${2:ModuleName};
|
|
||||||
|
|
||||||
ok(${3:assertion});
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet class "class"
|
|
||||||
package ${1:ClassName};
|
|
||||||
|
|
||||||
${2:use parent qw(${3:ParentClass});}${2/.+/\n\n/}sub new {
|
|
||||||
my $class = shift;
|
|
||||||
$class = ref $class if ref $class;
|
|
||||||
my $self = bless {}, $class;
|
|
||||||
$self;
|
|
||||||
}
|
|
||||||
|
|
||||||
1;
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet eval "eval"
|
|
||||||
local $@;
|
|
||||||
eval {
|
|
||||||
${1:# do something risky...}
|
|
||||||
};
|
|
||||||
if (my $${2:exception} = $@) {
|
|
||||||
${3:# handle failure...}
|
|
||||||
}
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet for "for"
|
|
||||||
for (my $${1:var} = 0; $$1 < ${2:expression}; $$1++) {
|
|
||||||
${3:# body...}
|
|
||||||
}
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fore "foreach"
|
|
||||||
foreach ${1:my $${2:x}} (@${3:array}) {
|
|
||||||
${4:# body...}
|
|
||||||
}
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet if "if"
|
|
||||||
if ($1) {
|
|
||||||
${2:# body...}
|
|
||||||
}
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet slurp "slurp"
|
|
||||||
my $${1:var} = do { local $/ = undef; open my $fh, '<', ${2:$file}; <$fh> };
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet unless "unless"
|
|
||||||
unless ($1) {
|
|
||||||
${2:# body...}
|
|
||||||
}
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet while "while"
|
|
||||||
while ($1) {
|
|
||||||
${2:# body...}
|
|
||||||
}
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet until "until"
|
|
||||||
until ($1) {
|
|
||||||
${2:# body...}
|
|
||||||
}
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -1,270 +0,0 @@
|
||||||
#resource controller
|
|
||||||
snippet l_rsc "Laravel resource controller" b
|
|
||||||
/*!
|
|
||||||
* \class $1
|
|
||||||
*
|
|
||||||
* \author ${3:`!v g:snips_author`}
|
|
||||||
* \date `!v strftime('%d-%m-%y')`
|
|
||||||
*/
|
|
||||||
|
|
||||||
class ${1:`!v expand('%:t:r')`} extends ${2:BaseController} {
|
|
||||||
function __construct() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public function index() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public function create() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public function store() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public function show($id) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public function edit($id) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public function update($id) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public function destroy($id) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
#service service provider
|
|
||||||
snippet l_ssp "Laravel service provider for service" b
|
|
||||||
<?php
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \namespace $1
|
|
||||||
* \class $2
|
|
||||||
*
|
|
||||||
* \author ${3:`!v g:snips_author`}
|
|
||||||
* \date `!v strftime('%d-%m-%y')`
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace ${1:Services};
|
|
||||||
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
|
||||||
|
|
||||||
class ${2:`!v expand('%:t:r')`} extends ServiceProvider {
|
|
||||||
|
|
||||||
public function register() {
|
|
||||||
$this->app->bind('$4Service', function ($app) {
|
|
||||||
return new $5(
|
|
||||||
$app->make('Repositories\\$6Interface')
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
#repository service provider
|
|
||||||
snippet l_rsp "Laravel service provider for repository" b
|
|
||||||
<?php
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \namespace $2
|
|
||||||
* \class $3
|
|
||||||
*
|
|
||||||
* \author ${4:`!v g:snips_author`}
|
|
||||||
* \date `!v strftime('%d-%m-%y')`
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace ${2:Repositories\\${1:}};
|
|
||||||
|
|
||||||
use Entities\\$1;
|
|
||||||
use $2\\$1Repository;
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
|
||||||
|
|
||||||
class ${3:`!v expand('%:t:r')`} extends ServiceProvider {
|
|
||||||
/*!
|
|
||||||
* \var defer
|
|
||||||
* \brief Defer service
|
|
||||||
*/
|
|
||||||
protected $defer = ${5:true};
|
|
||||||
|
|
||||||
public function register() {
|
|
||||||
$this->app->bind('$2\\$1Interface', function($app) {
|
|
||||||
return new $1Repository(new $1());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief If $defer == true need this fn
|
|
||||||
*/
|
|
||||||
public function provides() {
|
|
||||||
return ['$2\\$1Interface'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
#model
|
|
||||||
snippet l_md "Laravel simple model" b
|
|
||||||
<?php
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \namespace $1
|
|
||||||
* \class $2
|
|
||||||
*
|
|
||||||
* \author ${3:`!v g:snips_author`}
|
|
||||||
* \date `!v strftime('%d-%m-%y')`
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace ${1:Entities};
|
|
||||||
|
|
||||||
class ${2:`!v expand('%:t:r')`} extends \Eloquent {
|
|
||||||
protected $table = '${4:`!p snip.rv = t[2].lower()`}';
|
|
||||||
|
|
||||||
public $timestamps = ${5:false};
|
|
||||||
|
|
||||||
protected $hidden = [$6];
|
|
||||||
|
|
||||||
protected $guarded = [${7:'id'}];
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
#abstract repository
|
|
||||||
snippet l_ar "Laravel abstract Repository" b
|
|
||||||
<?php
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \namespace $1
|
|
||||||
* \class $2
|
|
||||||
* \implements $3
|
|
||||||
*
|
|
||||||
* \author ${4:`!v g:snips_author`}
|
|
||||||
* \date `!v strftime('%d-%m-%y')`
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace ${1:Repositories};
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
abstract class ${2:`!v expand('%:t:r')`} implements ${3:BaseRepositoryInterface} {
|
|
||||||
protected $model;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \fn __construct
|
|
||||||
*
|
|
||||||
* \brief Take the model
|
|
||||||
*/
|
|
||||||
|
|
||||||
public function __construct(Model $model) {
|
|
||||||
$this->model = $model;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \fn all
|
|
||||||
*
|
|
||||||
* \return Illuminate\Database\Eloquent\Collection
|
|
||||||
*/
|
|
||||||
public function all($columns = ['*']) {
|
|
||||||
return $this->model->all()->toArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \fn create
|
|
||||||
*
|
|
||||||
* \return Illuminate\Database\Eloquent\Model
|
|
||||||
*/
|
|
||||||
public function create(array $attributes) {
|
|
||||||
return $this->model->create($attributes);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \fn destroy
|
|
||||||
*
|
|
||||||
* \return int
|
|
||||||
*/
|
|
||||||
public function destroy($ids) {
|
|
||||||
return $this->model->destroy($ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \fn find
|
|
||||||
*
|
|
||||||
* \return mixed
|
|
||||||
*/
|
|
||||||
public function find($id, $columns = ['*']) {
|
|
||||||
return $this->model->find($id, $columns);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
#repository
|
|
||||||
snippet l_r "Laravel Repository" b
|
|
||||||
<?php
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \namespace $1
|
|
||||||
* \class $3
|
|
||||||
* \implements $4
|
|
||||||
*
|
|
||||||
* \author ${5:`!v g:snips_author`}
|
|
||||||
* \date `!v strftime('%d-%m-%y')`
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace ${1:Repositories\\$2};
|
|
||||||
|
|
||||||
class ${3:`!v expand('%:t:r')`} extends \\$6 implements ${4:$3RepositoryInterface} {
|
|
||||||
$7
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
#service
|
|
||||||
snippet l_s "Laravel Service" b
|
|
||||||
<?php
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \namespace $1
|
|
||||||
* \class $2
|
|
||||||
*
|
|
||||||
* \author ${6:`!v g:snips_author`}
|
|
||||||
* \date `!v strftime('%d-%m-%y')`
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Services\\$1;
|
|
||||||
|
|
||||||
use ${3:Repositories\\${4:Interface}};
|
|
||||||
|
|
||||||
class ${2:`!v expand('%:t:r')`} {
|
|
||||||
protected $${5:repo};
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \fn __construct
|
|
||||||
*/
|
|
||||||
public function __construct($4 $repo) {
|
|
||||||
$this->$5 = $repo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
#facade
|
|
||||||
snippet l_f "Laravel Facade" b
|
|
||||||
<?php
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \namespace $1
|
|
||||||
* \class $2
|
|
||||||
*
|
|
||||||
* \author ${5:`!v g:snips_author`}
|
|
||||||
* \date `!v strftime('%d-%m-%y')`
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace ${1:Services};
|
|
||||||
|
|
||||||
use \Illuminate\Support\Facades\Facade;
|
|
||||||
|
|
||||||
class ${2:`!v expand('%:t:r')`} extends Facade {
|
|
||||||
/*!
|
|
||||||
* \fn getFacadeAccessor
|
|
||||||
*
|
|
||||||
* \return string
|
|
||||||
*/
|
|
||||||
protected static function getFacadeAccessor() { return '${4:$3Service}'; }
|
|
||||||
}
|
|
||||||
endsnippet
|
|
|
@ -1,222 +0,0 @@
|
||||||
# Snippets for phpspec, to use add the following to your .vimrc
|
|
||||||
# `autocmd BufRead,BufNewFile,BufEnter *Spec.php UltiSnipsAddFiletypes php-phpspec`
|
|
||||||
|
|
||||||
priority -50
|
|
||||||
|
|
||||||
snippet spec "class XYZSpec extends ObjectBehaviour"
|
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace `!p
|
|
||||||
relpath = os.path.relpath(path)
|
|
||||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
|
||||||
if m:
|
|
||||||
snip.rv = m.group().replace('/', '\\')
|
|
||||||
`;
|
|
||||||
|
|
||||||
use PhpSpec\ObjectBehavior;
|
|
||||||
use Prophecy\Argument;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author `!v g:snips_author`
|
|
||||||
*/
|
|
||||||
class `!p
|
|
||||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|
||||||
` extends ObjectBehavior
|
|
||||||
{
|
|
||||||
function it_$1()
|
|
||||||
{
|
|
||||||
${0:${VISUAL}}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet it "function it_does_something() { ... }"
|
|
||||||
function it_$1()
|
|
||||||
{
|
|
||||||
${0:${VISUAL}}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet let "function let() { ... }"
|
|
||||||
function let()
|
|
||||||
{
|
|
||||||
${0:${VISUAL}}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet letgo "function letgo() { ... }"
|
|
||||||
function letgo()
|
|
||||||
{
|
|
||||||
${0:${VISUAL}}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Object construction
|
|
||||||
snippet cw "$this->beConstructedWith($arg)"
|
|
||||||
$this->beConstructedWith($1);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ct "$this->beConstructedThrough($methodName, [$arg])"
|
|
||||||
$this->beConstructedThrough(${1:'methodName'}, [${2:'$arg'}]);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Identity and comparison matchers
|
|
||||||
snippet sreturn "$this->XYZ()->shouldReturn('value')"
|
|
||||||
$this->${1:method}()->shouldReturn(${2:'value'});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet snreturn "$this->XYZ()->shouldNotReturn('value')"
|
|
||||||
$this->${1:method}()->shouldNotReturn(${2:'value'});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sbe "$this->XYZ()->shouldBe('value')"
|
|
||||||
$this->${1:method}()->shouldBe(${2:'value'});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet snbe "$this->XYZ()->shouldNotBe('value')"
|
|
||||||
$this->${1:method}()->shouldNotBe(${2:'value'});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sequal "$this->XYZ()->shouldEqual('value')"
|
|
||||||
$this->${1:method}()->shouldEqual(${2:'value'});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet snequal "$this->XYZ()->shouldNotEqual('value')"
|
|
||||||
$this->${1:method}()->shouldNotEqual(${2:'value'});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sbequalto "$this->XYZ()->shouldBeEqualTo('value')"
|
|
||||||
$this->${1:method}()->shouldBeEqualTo(${2:'value'});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet snbequalto "$this->XYZ()->shouldNotBeEqualTo('value')"
|
|
||||||
$this->${1:method}()->shouldNotBeEqualTo(${2:'value'});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sblike "$this->XYZ()->shouldBeLike('value')"
|
|
||||||
$this->${1:method}()->shouldBeLike(${2:'value'});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet snblike "$this->XYZ()->shouldNotBeLike('value')"
|
|
||||||
$this->${1:method}()->shouldNotBeLike(${2:'value'});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Throw matcher
|
|
||||||
snippet sthrowm "$this->shouldThrow('\Exception')->duringXYZ($arg)"
|
|
||||||
$this->shouldThrow(${1:'\Exception'})->during${2:Method}(${3:'$arg'});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sthrowi "$this->shouldThrow('\Exception')->duringInstantiation()"
|
|
||||||
$this->shouldThrow(${1:'\Exception'})->duringInstantiation();
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Type matchers
|
|
||||||
snippet stype "$this->shouldHaveType('Type')"
|
|
||||||
$this->shouldHaveType($1);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sntype "$this->shouldNotHaveType('Type')"
|
|
||||||
$this->shouldNotHaveType($1);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet srinstance "$this->shouldReturnAnInstanceOf('Type')"
|
|
||||||
$this->shouldReturnAnInstanceOf($1);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet snrinstance "$this->shouldNotReturnAnInstanceOf('Type')"
|
|
||||||
$this->shouldNotReturnAnInstanceOf($1);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sbinstance "$this->shouldBeAnInstanceOf('Type')"
|
|
||||||
$this->shouldBeAnInstanceOf($1);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet snbinstance "$this->shouldNotBeAnInstanceOf('Type')"
|
|
||||||
$this->shouldNotBeAnInstanceOf($1);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet simplement "$this->shouldImplement('Type')"
|
|
||||||
$this->shouldImplement($1);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet snimplement "$this->shouldNotImplement('Type')"
|
|
||||||
$this->shouldNotImplement($1);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Object state matchers
|
|
||||||
snippet sbstate "$this->shouldBeXYZ()"
|
|
||||||
$this->shouldBe$1();
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet snbstate "$this->shouldNotBeXYZ()"
|
|
||||||
$this->shouldNotBe$1();
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Count matchers
|
|
||||||
snippet scount "$this->XYZ()->shouldHaveCount(7)"
|
|
||||||
$this->${1:method}()->shouldHaveCount(${2:7});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sncount "$this->XYZ()->shouldNotHaveCount(7)"
|
|
||||||
$this->${1:method}()->shouldNotHaveCount(${2:7});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Scalar type matchers
|
|
||||||
snippet sbscalar "$this->XYZ()->shouldBeString|Array|Bool()"
|
|
||||||
$this->${1:method}()->shouldBe${2:String|Array|Bool}();
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet snbscalar "$this->XYZ()->shouldNotBeString|Array|Bool()"
|
|
||||||
$this->${1:method}()->shouldNotBe${2:String|Array|Bool}();
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Contain matcher
|
|
||||||
snippet scontain "$this->XYZ()->shouldContain('value')"
|
|
||||||
$this->${1:method}()->shouldContain(${2:'value'});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sncontain "$this->XYZ()->shouldNotContain('value')"
|
|
||||||
$this->${1:method}()->shouldNotContain(${2:'value'});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Array matchers
|
|
||||||
snippet skey "$this->XYZ()->shouldHaveKey('key')"
|
|
||||||
$this->${1:method}()->shouldHaveKey(${2:'key'});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet snkey "$this->XYZ()->shouldNotHaveKey('key')"
|
|
||||||
$this->${1:method}()->shouldNotHaveKey(${2:'key'});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet skeyvalue "$this->XYZ()->shouldHaveKeyWithValue('key', 'value')"
|
|
||||||
$this->${1:method}()->shouldHaveKeyWithValue(${2:'key'}, ${3:'value'});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet snkeyvalue "$this->XYZ()->shouldNotHaveKeyWithValue('key', 'value')"
|
|
||||||
$this->${1:method}()->shouldNotHaveKeyWithValue(${2:'key'}, ${3:'value'});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# String matchers
|
|
||||||
snippet sstart "$this->XYZ()->shouldStartWith('string')"
|
|
||||||
$this->${1:method}()->shouldStartWith(${2:'string'});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet snstart "$this->XYZ()->shouldNotStartWith('string')"
|
|
||||||
$this->${1:method}()->shouldNotStartWith(${2:'string'});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet send "$this->XYZ()->shouldEndWith('string')"
|
|
||||||
$this->${1:method}()->shouldEndWith(${2:'string'});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet snend "$this->XYZ()->shouldNotEndWith('string')"
|
|
||||||
$this->${1:method}()->shouldNotEndWith(${2:'string'});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet smatch "$this->XYZ()->shouldMatch('/wizard/i')"
|
|
||||||
$this->${1:method}()->shouldMatch(${2:'/wizard/i'});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet snmatch "$this->XYZ()->shouldNotMatch('/wizard/i')"
|
|
||||||
$this->${1:method}()->shouldNotMatch(${2:'/wizard/i'});
|
|
||||||
endsnippet
|
|
|
@ -1,360 +0,0 @@
|
||||||
# sugguestion? report bugs?
|
|
||||||
# go to https://github.com/chrisyue/vim-snippets/issues
|
|
||||||
|
|
||||||
priority -50
|
|
||||||
|
|
||||||
snippet classn "Basic class with namespace snippet" b
|
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace `!p
|
|
||||||
relpath = os.path.relpath(path)
|
|
||||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
|
||||||
if m:
|
|
||||||
snip.rv = m.group().replace('/', '\\')
|
|
||||||
`;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ${1:@author `!v g:snips_author`}
|
|
||||||
*/
|
|
||||||
class `!p
|
|
||||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|
||||||
`$2
|
|
||||||
{
|
|
||||||
public function __construct(${3:$options})
|
|
||||||
{
|
|
||||||
${4:// code}
|
|
||||||
}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet contr "Symfony2 controller" b
|
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace `!p
|
|
||||||
relpath = os.path.relpath(path)
|
|
||||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
|
||||||
if m:
|
|
||||||
snip.rv = m.group().replace('/', '\\')
|
|
||||||
`;
|
|
||||||
|
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
|
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ${1:@author `!v g:snips_author`}
|
|
||||||
*/
|
|
||||||
class `!p
|
|
||||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|
||||||
` extends Controller
|
|
||||||
{
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sfa "Symfony 2 Controller action"
|
|
||||||
/**
|
|
||||||
* @Route("/${1:route_name}", name="$1")
|
|
||||||
* @Template()
|
|
||||||
*/
|
|
||||||
public function $1Action($2)
|
|
||||||
{
|
|
||||||
$3
|
|
||||||
return ${4:[];}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet act "Symfony2 action" b
|
|
||||||
/**
|
|
||||||
* @Route("$3", name="$4")
|
|
||||||
* @Method({${5:"POST"}})
|
|
||||||
* @Template()
|
|
||||||
*/
|
|
||||||
public function $1Action($2)
|
|
||||||
{
|
|
||||||
$6
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet actt "Symfony2 action and template" b
|
|
||||||
/**
|
|
||||||
* @Route("$3", name="$4")
|
|
||||||
* @Method({${5:"GET"}})
|
|
||||||
* @Template()
|
|
||||||
*/
|
|
||||||
public function $1Action($2)
|
|
||||||
{
|
|
||||||
$6
|
|
||||||
return [];
|
|
||||||
}`!p
|
|
||||||
relpath = os.path.relpath(path)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet comm "Symfony2 command" b
|
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace `!p
|
|
||||||
relpath = os.path.relpath(path)
|
|
||||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
|
||||||
if m:
|
|
||||||
snip.rv = m.group().replace('/', '\\')
|
|
||||||
`;
|
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ${3:@author `!v g:snips_author`}
|
|
||||||
*/
|
|
||||||
class `!p
|
|
||||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|
||||||
` extends ContainerAwareCommand
|
|
||||||
{
|
|
||||||
protected function configure()
|
|
||||||
{
|
|
||||||
$this->setName('$1')
|
|
||||||
->setDescription('$2')
|
|
||||||
->setDefinition([
|
|
||||||
new InputArgument('', InputArgument::REQUIRED, ''),
|
|
||||||
new InputOption('', null, InputOption::VALUE_NONE, ''),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet subs "Symfony2 subscriber" b
|
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace `!p
|
|
||||||
relpath = os.path.relpath(path)
|
|
||||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
|
||||||
if m:
|
|
||||||
snip.rv = m.group().replace('/', '\\')
|
|
||||||
`;
|
|
||||||
|
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ${1:@author `!v g:snips_author`}
|
|
||||||
*/
|
|
||||||
class `!p
|
|
||||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|
||||||
` implements EventSubscriberInterface
|
|
||||||
{
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public static function getSubscribedEvents()
|
|
||||||
{
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet transf "Symfony2 form data transformer" b
|
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace `!p
|
|
||||||
relpath = os.path.relpath(path)
|
|
||||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
|
||||||
if m:
|
|
||||||
snip.rv = m.group().replace('/', '\\')
|
|
||||||
`;
|
|
||||||
|
|
||||||
use Symfony\Component\Form\DataTransformerInterface;
|
|
||||||
use Symfony\Component\Form\Exception\TransformationFailedException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ${3:@author `!v g:snips_author`}
|
|
||||||
*/
|
|
||||||
class `!p
|
|
||||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|
||||||
` implements DataTransformerInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public function transform($1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public function reverseTransform($2)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ent "Symfony2 doctrine entity" b
|
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace `!p
|
|
||||||
relpath = os.path.relpath(path)
|
|
||||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
|
||||||
if m:
|
|
||||||
snip.rv = m.group().replace('/', '\\')
|
|
||||||
`;
|
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ${3:@author `!v g:snips_author`}
|
|
||||||
*
|
|
||||||
* @ORM\Entity()
|
|
||||||
* @ORM\Table(name="`!p
|
|
||||||
tmp = re.match(r'.*(?=\.)', fn).group()
|
|
||||||
tmp = re.sub(r'\B([A-Z])', r'_\1', tmp)
|
|
||||||
snip.rv = tmp.lower()
|
|
||||||
`")
|
|
||||||
*/
|
|
||||||
`!p
|
|
||||||
m = re.search(r'Abstract', path)
|
|
||||||
if m:
|
|
||||||
snip.rv = 'abstract '
|
|
||||||
`class `!p
|
|
||||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|
||||||
`
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="integer")
|
|
||||||
* @ORM\GeneratedValue
|
|
||||||
* @ORM\Id
|
|
||||||
*/
|
|
||||||
private $id;
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet form "Symfony2 form type" b
|
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace `!p
|
|
||||||
relpath = os.path.relpath(path)
|
|
||||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
|
||||||
if m:
|
|
||||||
snip.rv = m.group().replace('/', '\\')
|
|
||||||
`;
|
|
||||||
|
|
||||||
use Symfony\Component\Form\AbstractType;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ${2:@author `!v g:snips_author`}
|
|
||||||
*/
|
|
||||||
class `!p
|
|
||||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|
||||||
` extends AbstractType
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
|
||||||
{
|
|
||||||
$resolver->setDefaults();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public function getName()
|
|
||||||
{
|
|
||||||
return '$1';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ev "Symfony2 event" b
|
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace `!p
|
|
||||||
relpath = os.path.relpath(path)
|
|
||||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
|
||||||
if m:
|
|
||||||
snip.rv = m.group().replace('/', '\\')
|
|
||||||
`;
|
|
||||||
|
|
||||||
use Symfony\Component\EventDispatcher\Event;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ${2:@author `!v g:snips_author`}
|
|
||||||
*/
|
|
||||||
class `!p
|
|
||||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|
||||||
` extends Event
|
|
||||||
{
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet redir "Symfony2 redirect" b
|
|
||||||
$this->redirect($this->generateUrl('$1', $2));
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet usecontroller "Symfony2 use Symfony\..\Controller" b
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;$1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet usereauest "Symfony2 use Symfony\..\Request" b
|
|
||||||
use Symfony\Component\HttpFoundation\Request;$1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet useroute "Symfony2 use Sensio\..\Route" b
|
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;$1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet useresponse "Symfony2 use Symfony\..\Response" b
|
|
||||||
use Symfony\Component\HttpFoundation\Response;$1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet usefile "Symfony2 use Symfony\..\File" b
|
|
||||||
use Symfony\Component\HttpFoundation\File\UploadedFile;$1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet useassert "Symfony2 use Symfony\..\Constraints as Assert" b
|
|
||||||
use Symfony\Component\Validator\Constraints as Assert;$1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet usetemplate "Symfony2 use Sensio\..\Template" b
|
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;$1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet usecache "Symfony2 use Sensio\..\Cache" b
|
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;$1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet usemethod "Symfony2 use Sensio\..\Method" b
|
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;$1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet usearray "Symfony2 use Doctrine\..\ArrayCollection" b
|
|
||||||
use Doctrine\Common\Collections\ArrayCollection;$1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet useorm "Symfony2 use Doctrine\..\Mapping as ORM" b
|
|
||||||
use Doctrine\ORM\Mapping as ORM;$1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet usesecure "Symfony2 use JMS\..\Secure" b
|
|
||||||
use JMS\SecurityExtraBundle\Annotation\Secure;$1
|
|
||||||
endsnippet
|
|
||||||
|
|
|
@ -1,286 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
global !p
|
|
||||||
import vim
|
|
||||||
|
|
||||||
# Set g:ultisnips_php_scalar_types to 1 if you'd like to enable PHP 7's scalar types for return values
|
|
||||||
def isPHPScalarTypesEnabled():
|
|
||||||
isEnabled = vim.eval("get(g:, 'ultisnips_php_scalar_types', 0)") == "1"
|
|
||||||
return isEnabled or re.match('<\?php\s+declare\(strict_types=[01]\);', '\n'.join(vim.current.window.buffer))
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
## Snippets from SnipMate, taken from
|
|
||||||
## https://github.com/scrooloose/snipmate-snippets.git
|
|
||||||
|
|
||||||
snippet gm "PHP Class Getter" b
|
|
||||||
/**
|
|
||||||
* Getter for $1
|
|
||||||
*
|
|
||||||
* @return ${2:string}
|
|
||||||
*/
|
|
||||||
public function get${1/\w+\s*/\u$0/}()`!p snip.rv = ': '+t[2] if isPHPScalarTypesEnabled() else ''`
|
|
||||||
{
|
|
||||||
return $this->$1;
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sm "PHP Class Setter" b
|
|
||||||
/**
|
|
||||||
* Setter for $1
|
|
||||||
*
|
|
||||||
* @param ${2:string} $$1
|
|
||||||
* @return ${3:`!p snip.rv=snip.basename`}
|
|
||||||
*/
|
|
||||||
public function set${1/\w+\s*/\u$0/}(${4:${2/(void|string|int|integer|double|float|object|boolear|null|mixed|number|resource)|(.*)/(?1::$2 )/}}$$1)
|
|
||||||
{
|
|
||||||
$this->$1 = $$1;
|
|
||||||
|
|
||||||
${5:return $this;}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet gs "PHP Class Getter Setter" b
|
|
||||||
/**
|
|
||||||
* Getter for $1
|
|
||||||
*
|
|
||||||
* @return ${2:string}
|
|
||||||
*/
|
|
||||||
public function get${1/\w+\s*/\u$0/}()`!p snip.rv = ': '+t[2] if isPHPScalarTypesEnabled() else ''`
|
|
||||||
{
|
|
||||||
return $this->$1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter for $1
|
|
||||||
*
|
|
||||||
* @param $2 $$1
|
|
||||||
* @return ${3:`!p snip.rv=snip.basename`}
|
|
||||||
*/
|
|
||||||
public function set${1/\w+\s*/\u$0/}(${4:${2/(void|string|int|integer|double|float|object|boolear|null|mixed|number|resource)|(.*)/(?1::$2 )/}}$$1)
|
|
||||||
{
|
|
||||||
$this->$1 = $$1;
|
|
||||||
|
|
||||||
${5:return $this;}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pub "Public function" b
|
|
||||||
/**
|
|
||||||
* ${3:undocumented function}
|
|
||||||
*
|
|
||||||
* @return ${4:void}
|
|
||||||
*/
|
|
||||||
public function ${1:name}(${2:$param})
|
|
||||||
{
|
|
||||||
${VISUAL}${5:return null;}
|
|
||||||
}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pro "Protected function" b
|
|
||||||
/**
|
|
||||||
* ${3:undocumented function}
|
|
||||||
*
|
|
||||||
* @return ${4:void}
|
|
||||||
*/
|
|
||||||
protected function ${1:name}(${2:$param})
|
|
||||||
{
|
|
||||||
${VISUAL}${5:return null;}
|
|
||||||
}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pri "Private function" b
|
|
||||||
/**
|
|
||||||
* ${3:undocumented function}
|
|
||||||
*
|
|
||||||
* @return ${4:void}
|
|
||||||
*/
|
|
||||||
private function ${1:name}(${2:$param})
|
|
||||||
{
|
|
||||||
${VISUAL}${5:return null;}
|
|
||||||
}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pubs "Public static function" b
|
|
||||||
/**
|
|
||||||
* ${3:undocumented function}
|
|
||||||
*
|
|
||||||
* @return ${4:void}
|
|
||||||
*/
|
|
||||||
public static function ${1:name}(${2:$param})
|
|
||||||
{
|
|
||||||
${VISUAL}${5:return null;}
|
|
||||||
}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pros "Protected static function" b
|
|
||||||
/**
|
|
||||||
* ${3:undocumented function}
|
|
||||||
*
|
|
||||||
* @return ${4:void}
|
|
||||||
*/
|
|
||||||
protected static function ${1:name}(${2:$param})
|
|
||||||
{
|
|
||||||
${VISUAL}${5:return null;}
|
|
||||||
}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pris "Private static function" b
|
|
||||||
/**
|
|
||||||
* ${3:undocumented function}
|
|
||||||
*
|
|
||||||
* @return ${4:void}
|
|
||||||
*/
|
|
||||||
private static function ${1:name}(${2:$param})
|
|
||||||
{
|
|
||||||
${VISUAL}${5:return null;}
|
|
||||||
}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fu "Function snip" b
|
|
||||||
function ${1:name}(${2:$param})
|
|
||||||
{
|
|
||||||
${VISUAL}${3:return null;}
|
|
||||||
}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet new "New class instance" b
|
|
||||||
$${1:variableName} = new ${2:${1/\w+\s*/\u$0/}}($3);
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ns "namespace declaration" b
|
|
||||||
namespace ${1:`!p
|
|
||||||
relpath = os.path.relpath(path)
|
|
||||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
|
||||||
if m:
|
|
||||||
snip.rv = m.group().replace('/', '\\')
|
|
||||||
`};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet class "Class declaration template" b
|
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace ${1:`!p
|
|
||||||
relpath = os.path.relpath(path)
|
|
||||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
|
||||||
if m:
|
|
||||||
snip.rv = m.group().replace('/', '\\')
|
|
||||||
`};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class ${1:`!p snip.rv=snip.basename`}
|
|
||||||
* @author ${2:`!v g:snips_author`}
|
|
||||||
*/
|
|
||||||
class $1
|
|
||||||
{
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet interface "Interface declaration template" b
|
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace ${1:`!p
|
|
||||||
relpath = os.path.relpath(path)
|
|
||||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
|
||||||
if m:
|
|
||||||
snip.rv = m.group().replace('/', '\\')
|
|
||||||
`};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interface ${1:`!p snip.rv=snip.basename`}
|
|
||||||
* @author ${2:`!v g:snips_author`}
|
|
||||||
*/
|
|
||||||
interface $1
|
|
||||||
{
|
|
||||||
public function ${3:someFunction}();$4
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet trait "Trait declaration template" b
|
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace ${1:`!p
|
|
||||||
relpath = os.path.relpath(path)
|
|
||||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
|
||||||
if m:
|
|
||||||
snip.rv = m.group().replace('/', '\\')
|
|
||||||
`};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Trait ${1:`!p snip.rv=snip.basename`}
|
|
||||||
* @author ${2:`!v g:snips_author`}
|
|
||||||
*/
|
|
||||||
trait $1
|
|
||||||
{
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet construct "__construct()" b
|
|
||||||
/**
|
|
||||||
* @param$2 ${1/, /\n * \@param /g}
|
|
||||||
*/
|
|
||||||
public function __construct(${1:$dependencies})
|
|
||||||
{${1/\w* ?\$(\w+)(, )*/\n $this->$1 = $$1;/g}
|
|
||||||
}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# PHPUnit snippets
|
|
||||||
snippet testcase "class XYZTest extends \PHPUnit_Framework_TestCase { ... }"
|
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace `!p
|
|
||||||
relpath = os.path.relpath(path)
|
|
||||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
|
||||||
if m:
|
|
||||||
snip.rv = m.group().replace('/', '\\')
|
|
||||||
`;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author `!v g:snips_author`
|
|
||||||
*/
|
|
||||||
class `!p
|
|
||||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|
||||||
` extends \PHPUnit_Framework_TestCase
|
|
||||||
{
|
|
||||||
public function test$1()
|
|
||||||
{
|
|
||||||
${0:${VISUAL}}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet testcase6 "class XYZTest extends TestCase { ... }"
|
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace `!p
|
|
||||||
relpath = os.path.relpath(path)
|
|
||||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
|
||||||
if m:
|
|
||||||
snip.rv = m.group().replace('/', '\\')
|
|
||||||
`;
|
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author `!v g:snips_author`
|
|
||||||
*/
|
|
||||||
class `!p
|
|
||||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|
||||||
` extends TestCase
|
|
||||||
{
|
|
||||||
public function test$1()
|
|
||||||
{
|
|
||||||
${0:${VISUAL}}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# :vim:ft=snippets:
|
|
|
@ -1,733 +0,0 @@
|
||||||
###########################################################################
|
|
||||||
# PLSQL SNIPPETS #
|
|
||||||
###########################################################################
|
|
||||||
|
|
||||||
global !p
|
|
||||||
# Import package
|
|
||||||
import datetime
|
|
||||||
|
|
||||||
# Return the doc string for PLSQL script
|
|
||||||
def docstring_plsql(params):
|
|
||||||
comment = ""
|
|
||||||
if params:
|
|
||||||
comment = "/** Parameters\n"
|
|
||||||
# Split the arguments
|
|
||||||
args = [arg.strip() for arg in params.split(',')]
|
|
||||||
for arg in args:
|
|
||||||
comment += "* {0:30} : \n".format(arg.split(' ')[0].upper())
|
|
||||||
comment += "*/\n"
|
|
||||||
# Return the comment string
|
|
||||||
return comment
|
|
||||||
|
|
||||||
def hdr_params(params, level=0, gap=" "):
|
|
||||||
line = level * gap + "-- -----------------------------------------------"
|
|
||||||
comment = line
|
|
||||||
if params:
|
|
||||||
# Split the arguments
|
|
||||||
args = [arg.strip() for arg in params.split(',')]
|
|
||||||
for arg in args:
|
|
||||||
comment += "\n" + level * gap + "-- {0:20} : ".format(arg.split(' ')[0].upper())
|
|
||||||
# comment += line
|
|
||||||
# Return the comment string
|
|
||||||
return comment
|
|
||||||
|
|
||||||
def dyear():
|
|
||||||
""" Returns the current Year in YYYY format
|
|
||||||
"""
|
|
||||||
now = datetime.datetime.now()
|
|
||||||
rv=now.year
|
|
||||||
return rv
|
|
||||||
|
|
||||||
def today():
|
|
||||||
""" Returns the current Date in DD-MON-YYYY format
|
|
||||||
"""
|
|
||||||
now = datetime.datetime.now()
|
|
||||||
rv=now.strftime("%d-%b-%Y")
|
|
||||||
return rv
|
|
||||||
|
|
||||||
def param(var):
|
|
||||||
""" Returns the string name wrapped value """
|
|
||||||
return "'" + var + " : ' || "
|
|
||||||
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
########################################
|
|
||||||
# SQL Snippets #
|
|
||||||
########################################
|
|
||||||
snippet doc "Document comment"
|
|
||||||
/*
|
|
||||||
* ${0: comment ...}
|
|
||||||
*/
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet hdr "Header Documentation"
|
|
||||||
-- #############################################################################
|
|
||||||
-- # Copyright (c) `!p snip.rv = dyear()` ${1:company}
|
|
||||||
-- # All rights reserved
|
|
||||||
-- #
|
|
||||||
-- ############################################################################
|
|
||||||
-- # Application : ${2:schema}
|
|
||||||
-- # File Name: : ${3:`!p snip.rv=snip.fn`}
|
|
||||||
-- # Type : Table
|
|
||||||
-- # Exec Method : PL/SQL File
|
|
||||||
-- # Description : This script ${5:create} under the schema $2
|
|
||||||
-- #
|
|
||||||
-- # Change History
|
|
||||||
-- # -----------------------------------------------------------------------
|
|
||||||
-- # Version Date Author Remarks
|
|
||||||
-- # ======= =========== ================ ============================
|
|
||||||
-- # 1.0 `!p snip.rv = today()` Amit Maindola Initial Version
|
|
||||||
-- #############################################################################
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pkggbl "Package Global variables"
|
|
||||||
-- Declare Global Variables
|
|
||||||
g_sysdate DATE := SYSDATE;
|
|
||||||
g_delimiter VARCHAR2( 30 ) := ' ';
|
|
||||||
g_err_length_limit NUMBER := 1500;
|
|
||||||
g_package_name CONSTANT VARCHAR2(30) := '${0}';
|
|
||||||
g_proc_name VARCHAR2(100) := NULL;
|
|
||||||
excp_custom EXCEPTION;
|
|
||||||
|
|
||||||
-- Declare User Global Types
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet flushca "Flush Cache"
|
|
||||||
ALTER SYSTEM FLUSH BUFFER_CACHE;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet flushsp "Flush Shared Pool"
|
|
||||||
ALTER SYSTEM FLUSH SHARED_POOL;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet err
|
|
||||||
show errors;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sel "Select statement"
|
|
||||||
SELECT ${0:*} FROM ${1} WHERE 1 = 1;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet selc "Select statement"
|
|
||||||
SELECT COUNT(1) FROM ${1} WHERE ${0};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet wrn "Where ROWNNUM"
|
|
||||||
WHERE ROWNUM <= 10 ${0:AND}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet arn "AND ROWNNUM"
|
|
||||||
AND ROWNUM <= 10 ${0:;}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ppram "Retuns param in wrapped format"
|
|
||||||
||`!p snip.rv = param(t[1].upper())`$1 $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet dbo "Show output "
|
|
||||||
DBMS_OUTPUT.put_line('${0}');
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet dbop "Show Parameter output "
|
|
||||||
DBMS_OUTPUT.put_line(`!p snip.rv = param(t[1].upper())`$1 $0);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet dbl "Log message in Log Table, Change procedure as defined by you"
|
|
||||||
DEBUG_LOG_PKG.WRITE_LOG(${1:'Test'},${2:$1} ,$0 );
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet plog "Print Log output "
|
|
||||||
printlog(`!p snip.rv = param(t[1].upper())`$1 $0);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet dut "DBMS_OUTPUT.put_line"
|
|
||||||
DBMS_UTILITY.get_time;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet bc "Bulk collect into"
|
|
||||||
bulk collect into ${0}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ei "Execute Immediate"
|
|
||||||
EXECUTE IMMEDIATE '${0:statement}' ;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet eitt "Execute Immediate TRUNCATE Table"
|
|
||||||
EXECUTE IMMEDIATE( 'TRUNCATE TABLE ${0:table}');
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet eitp "Execute Immediate ALTER Table Truncate partition"
|
|
||||||
EXECUTE IMMEDIATE( 'ALTER TABLE ${1:table} TRUNCATE PARTITION ${0:partition}');
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet prmpt "Prompt message"
|
|
||||||
PROMPT ${1:Creating }...
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet crseq "Create Sequence"
|
|
||||||
DROP SEQUENCE ${1:schema}.${2:name}_s;
|
|
||||||
|
|
||||||
CREATE SEQUENCE $1.$2_s
|
|
||||||
START WITH ${3:1}
|
|
||||||
MAXVALUE 999999999999999999999999999
|
|
||||||
MINVALUE 1
|
|
||||||
NOCYCLE
|
|
||||||
NOCACHE
|
|
||||||
NOORDER;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet crsyn "Create Synonym"
|
|
||||||
|
|
||||||
CREATE OR REPLACE SYNONYM ${1:schema}.${2:name} FOR ${3:target}.${0};
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet crind "Create Index"
|
|
||||||
DROP INDEX $1.$4;
|
|
||||||
|
|
||||||
CREATE INDEX $1.${4:$2_${5}}
|
|
||||||
ON ${1:schema}.${2:table}(${3}) ${6:TABLESPACE ${0} };
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
########################################
|
|
||||||
# Table Operation #
|
|
||||||
########################################
|
|
||||||
|
|
||||||
snippet drtab "Drop Table"
|
|
||||||
DROP TABLE ${1:schema}.${2:name} CASCADE CONSTRAINTS ${3:PURGE};
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet crtab "Create Table"
|
|
||||||
|
|
||||||
DROP TABLE ${1:schema}.${2:name} CASCADE CONSTRAINTS PURGE;
|
|
||||||
|
|
||||||
CREATE TABLE $1.$2
|
|
||||||
(
|
|
||||||
${0}
|
|
||||||
)
|
|
||||||
${3:TABLESPACE ${4}}
|
|
||||||
;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ccol "Add VARCHAR2 column to table"
|
|
||||||
${1:,} ${2:name} VARCHAR2(${0:100})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet dcol "Add DATE column to table"
|
|
||||||
${1:,} ${0:name} DATE
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ncol "Add NUMBER column to table"
|
|
||||||
${1:,} ${0:name} NUMBER
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet at "Alter Table"
|
|
||||||
ALTER TABLE ${1:table} ${0}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
#########################################
|
|
||||||
# Declare Types and local variable #
|
|
||||||
#########################################
|
|
||||||
|
|
||||||
snippet tr "Type record"
|
|
||||||
TYPE t_${1:rec} IS RECORD (${0:/* columns */} );
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tt "Type Table"
|
|
||||||
TYPE t_${1:tbl} IS TABLE OF ${0:table_name}%ROWTYPE INDEX BY BINARY_INTEGER;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tc "Type Cursor"
|
|
||||||
TYPE t_${1:tbl} IS TABLE OF ${0:cur}%ROWTYPE INDEX BY BINARY_INTEGER;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pn
|
|
||||||
p_${1} ${2:IN} NUMBER ${3:DEFAULT ${0:NULL}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pd
|
|
||||||
p_${1} ${2:IN} DATE ${3:DEFAULT ${0:SYSDATE}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pc
|
|
||||||
P_${1} ${2:IN} VARCHAR2 ${3:DEFAULT ${0:NULL}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ln
|
|
||||||
l_${1} NUMBER ${2: := ${3} };
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ld
|
|
||||||
l_${1} DATE ${2: := ${3} };
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet lc
|
|
||||||
l_${1} VARCHAR2(${2:100}) ${3: := ${4} };
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet gn
|
|
||||||
g_${1} NUMBER ${2: := ${3:10} };
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet gd
|
|
||||||
g_${1} DATE ${2: := ${3:SYSDATE} };
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet gc
|
|
||||||
g_${1} VARCHAR2(${2:100}) ${3: := ${4} };
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ltbl
|
|
||||||
l_tbl_${1} ${0};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet lrec
|
|
||||||
l_rec_${1} ${0};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
#########################################
|
|
||||||
# Condition, Loops #
|
|
||||||
#########################################
|
|
||||||
snippet if "If Condition"
|
|
||||||
IF(${1}) THEN
|
|
||||||
${0};
|
|
||||||
END IF;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ife "IF-Else Condition"
|
|
||||||
IF(${1}) THEN
|
|
||||||
${2};
|
|
||||||
ELSIF
|
|
||||||
${0};
|
|
||||||
END IF;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet els "Else Condition"
|
|
||||||
ELSIF ${1:condition} THEN
|
|
||||||
${0};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet case "Case statement"
|
|
||||||
CASE WHEN (${1}) THEN
|
|
||||||
${2}
|
|
||||||
WHEN (${3}) THEN
|
|
||||||
${4}
|
|
||||||
${0:ELSE}
|
|
||||||
END
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet while "While Loop"
|
|
||||||
WHILE ${1:a} ${2:condition} ${3:b} LOOP
|
|
||||||
${0};
|
|
||||||
END LOOP;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fori "For Loop"
|
|
||||||
FOR ${1:indx} in ${2:1}..${3:10} LOOP
|
|
||||||
${4};
|
|
||||||
END LOOP;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fort "Table For Loop"
|
|
||||||
FOR ${1:indx} in 1..${2:ttb}.count LOOP
|
|
||||||
${0};
|
|
||||||
END LOOP;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet loop "Loop statement"
|
|
||||||
LOOP
|
|
||||||
${0};
|
|
||||||
END LOOP;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fora "For All Loop"
|
|
||||||
IF ( ${1:ttbl}.COUNT > 0 ) THEN
|
|
||||||
BEGIN
|
|
||||||
FORALL ${2:indx} IN 1 .. $1.COUNT
|
|
||||||
-- Insert/Update
|
|
||||||
${0}
|
|
||||||
EXCEPTION --Exception Block
|
|
||||||
WHEN OTHERS THEN
|
|
||||||
l_errmsg := 'Error while Bulk updating, Error : ' || SQLERRM;
|
|
||||||
RAISE excp_custom;
|
|
||||||
END;
|
|
||||||
END IF;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet forc "For Cursor Loop"
|
|
||||||
FOR $1_rec IN ${1:cur} ${2:(${3:param})}
|
|
||||||
LOOP
|
|
||||||
${0}
|
|
||||||
END LOOP; -- End $1
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
#########################################
|
|
||||||
# Cursor Operations #
|
|
||||||
#########################################
|
|
||||||
snippet dcur "Cursor declaration"
|
|
||||||
CURSOR ${1:cur} IS
|
|
||||||
SELECT ${0}
|
|
||||||
FROM $1
|
|
||||||
WHERE 1 = 1;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet copen "Open Cursor"
|
|
||||||
OPEN ${1:cursor} ${2:( ${3:param} )};
|
|
||||||
FETCH $1
|
|
||||||
INTO ${4:record};
|
|
||||||
${0}
|
|
||||||
IF ( $1 %NOTFOUND ) THEN
|
|
||||||
CLOSE $1;
|
|
||||||
l_errmsg := 'No records fetched in cursor : $1.';
|
|
||||||
RAISE excp_custom;
|
|
||||||
END IF;
|
|
||||||
CLOSE $1;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet copenbc "Open Cursor Bulk collect"
|
|
||||||
OPEN ${1:cursor} ${2:( ${3:param} )};
|
|
||||||
FETCH $1
|
|
||||||
BULK COLLECT INTO ${4:ttbl};
|
|
||||||
CLOSE $1;
|
|
||||||
|
|
||||||
IF ( $4.count = 0 ) THEN
|
|
||||||
l_errmsg := 'No records fetched in cursor : $1.';
|
|
||||||
RAISE excp_custom;{0}
|
|
||||||
END IF;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
#########################################
|
|
||||||
# BEGIN/DECLARE Blocks #
|
|
||||||
#########################################
|
|
||||||
snippet decl "Declare Begin block"
|
|
||||||
DECLARE
|
|
||||||
${1}
|
|
||||||
BEGIN
|
|
||||||
${0:null}
|
|
||||||
EXCEPTION --Exception Block
|
|
||||||
WHEN NO_DATA_FOUND THEN
|
|
||||||
dbms_output.put_line('No Data Found');
|
|
||||||
WHEN OTHERS THEN
|
|
||||||
dbms_output.put_line('Error while . Error : '||sqlerrm);
|
|
||||||
END;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet begin "Begin block"
|
|
||||||
BEGIN
|
|
||||||
${0}
|
|
||||||
EXCEPTION --Exception Block
|
|
||||||
WHEN NO_DATA_FOUND THEN
|
|
||||||
printlog('No Data Found');
|
|
||||||
WHEN OTHERS THEN
|
|
||||||
printlog('Error while . Error : '||sqlerrm);
|
|
||||||
END;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet excp "Exception Block"
|
|
||||||
EXCEPTION --Exception Block
|
|
||||||
${0}
|
|
||||||
WHEN OTHERS THEN
|
|
||||||
${1};
|
|
||||||
END;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rae "Raise Application Error"
|
|
||||||
RAISE_APPLICATION_ERROR(${1:-20000},${0:''});
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
#########################################
|
|
||||||
# Procedure/Function calling #
|
|
||||||
#########################################
|
|
||||||
snippet crjob "Submit DBMS Job"
|
|
||||||
-- Submit the job to get the output
|
|
||||||
BEGIN
|
|
||||||
DECLARE
|
|
||||||
vjob INTEGER;
|
|
||||||
BEGIN
|
|
||||||
DBMS_JOB.submit( vjob, '${1:procedure}${0:('''')};', SYSDATE );
|
|
||||||
DBMS_OUTPUT.put_line( 'Job id : ' || vjob );
|
|
||||||
COMMIT;
|
|
||||||
END;
|
|
||||||
END;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet whilejob "Submit DBMS Job with While Loop"
|
|
||||||
-- Submit the job to get the output
|
|
||||||
|
|
||||||
BEGIN
|
|
||||||
DECLARE
|
|
||||||
vjob INTEGER;
|
|
||||||
BEGIN
|
|
||||||
DBMS_JOB.submit ( vjob , '
|
|
||||||
DECLARE
|
|
||||||
l_start_date DATE := ''${1:01-Jan-2017}'';
|
|
||||||
BEGIN
|
|
||||||
WHILE l_start_date < ''${2:01-Jan-2017}''
|
|
||||||
LOOP
|
|
||||||
${3:Procedure}${0:( to_char(l_start_date,''YYYYMMDD'') )};
|
|
||||||
l_start_date := TRUNC( l_start_date + 1 );
|
|
||||||
END LOOP;
|
|
||||||
EXCEPTION --Exception Block
|
|
||||||
WHEN OTHERS THEN
|
|
||||||
DBMS_OUTPUT.put_line( ''Error while . Error : '' || SQLERRM );
|
|
||||||
END;
|
|
||||||
'
|
|
||||||
, SYSDATE
|
|
||||||
);
|
|
||||||
DBMS_OUTPUT.put_line( 'Job id : ' || vjob );
|
|
||||||
COMMIT;
|
|
||||||
END;
|
|
||||||
END;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
#########################################
|
|
||||||
# Function creation scripts #
|
|
||||||
#########################################
|
|
||||||
snippet crprintlog "Create Printlog Procedure"
|
|
||||||
------------------------------------------------------------------------------------------------
|
|
||||||
-- PROCEDURE : PRINTLOG
|
|
||||||
-- Description : This procedure is used to print log messages in Log file, Table and Console
|
|
||||||
------------------------------------------------------------------------------------------------
|
|
||||||
PROCEDURE printlog (p_message IN VARCHAR2)
|
|
||||||
IS
|
|
||||||
l_errmsg VARCHAR2 (10000);
|
|
||||||
BEGIN
|
|
||||||
l_errmsg := SUBSTR ( p_message, 1, g_err_length_limit);
|
|
||||||
fnd_file.put_line ( fnd_file.LOG, l_errmsg); -- Debug log file
|
|
||||||
DBMS_OUTPUT.put_line (l_errmsg); -- Console output
|
|
||||||
DEBUG_LOG_PKG.WRITE_LOG(g_package_name,g_proc_name,p_message); -- Debug table
|
|
||||||
END printlog;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet crgeterr "Create get_errmsg function"
|
|
||||||
-- Form the error message for when others
|
|
||||||
FUNCTION get_errmsg( p_message IN VARCHAR2 DEFAULT NULL )
|
|
||||||
RETURN VARCHAR2
|
|
||||||
IS
|
|
||||||
BEGIN
|
|
||||||
RETURN 'Error occured in ' || g_package_name || '.' || g_proc_name || '. ' || NVL( p_message, '' ) || ' Error : ' || SQLERRM;
|
|
||||||
EXCEPTION --Exception Block
|
|
||||||
WHEN OTHERS THEN
|
|
||||||
printlog( 'Error while forming messgage. Error : ' || SQLERRM );
|
|
||||||
RETURN NULL;
|
|
||||||
END;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet crpksfunc "Create package specification function"
|
|
||||||
------------------------------------------------------------------------------------------------
|
|
||||||
-- Function : `!p snip.rv = t[1].upper()`
|
|
||||||
-- Description : This Function will ${4:description}.
|
|
||||||
`!p snip.rv=hdr_params(t[3]) `
|
|
||||||
------------------------------------------------------------------------------------------------
|
|
||||||
FUNCTION ${1:func} ${2:(${3:params})}
|
|
||||||
RETURN ${0};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet crpksproc "Create package specification procedure"
|
|
||||||
------------------------------------------------------------------------------------------------
|
|
||||||
-- PROCEDURE : `!p snip.rv = t[1].upper()`
|
|
||||||
-- Description : This Procedure will ${4:description}.
|
|
||||||
`!p snip.rv=hdr_params(t[3],0) `
|
|
||||||
------------------------------------------------------------------------------------------------
|
|
||||||
PROCEDURE ${1:proc} ${2:(${3:params})} ;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet crpkbfunc "Create package body function"
|
|
||||||
------------------------------------------------------------------------------------------------
|
|
||||||
-- Function : `!p snip.rv = t[1].upper()`
|
|
||||||
-- Description : This Function will ${8:description}.
|
|
||||||
`!p snip.rv=hdr_params(t[3],2) `
|
|
||||||
------------------------------------------------------------------------------------------------
|
|
||||||
FUNCTION ${1:func} ${2:(${3:params})}
|
|
||||||
RETURN ${4}
|
|
||||||
IS
|
|
||||||
-- Declare Cursors
|
|
||||||
-- Declare Variables
|
|
||||||
${5:l_} $4 ${6:( ${7:length} )};
|
|
||||||
BEGIN
|
|
||||||
-- Initialize
|
|
||||||
g_proc_name := '`!p snip.rv = t[1].upper()`';
|
|
||||||
${0}
|
|
||||||
-- Return value
|
|
||||||
RETURN $5 ;
|
|
||||||
EXCEPTION
|
|
||||||
WHEN OTHERS
|
|
||||||
THEN
|
|
||||||
RETURN NULL;
|
|
||||||
END $1;
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet crpkbproc "Create package body procedure"
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------
|
|
||||||
-- PROCEDURE : `!p snip.rv = t[1].upper()`
|
|
||||||
-- Description : This Procedure will ${4:description}.
|
|
||||||
`!p snip.rv=hdr_params(t[3]) `
|
|
||||||
------------------------------------------------------------------------------------------------
|
|
||||||
PROCEDURE ${1:proc} ${2:(${3:params})}
|
|
||||||
IS
|
|
||||||
-- Declare cursors
|
|
||||||
-- Declare Out and exception variables
|
|
||||||
l_errmsg VARCHAR2( 10000 ) := null;
|
|
||||||
excp_skip EXCEPTION;
|
|
||||||
-- Declare Varibales
|
|
||||||
|
|
||||||
BEGIN
|
|
||||||
-- Initializing out parameters
|
|
||||||
g_proc_name := '`!p snip.rv = t[1].upper()`';
|
|
||||||
|
|
||||||
${0}
|
|
||||||
EXCEPTION -- Exception block of Procedure
|
|
||||||
WHEN excp_custom THEN
|
|
||||||
ROLLBACK;
|
|
||||||
printlog( l_errmsg );
|
|
||||||
WHEN OTHERS THEN
|
|
||||||
ROLLBACK;
|
|
||||||
l_errmsg := get_errmsg;
|
|
||||||
printlog( l_errmsg );
|
|
||||||
END $1;
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet crpks "Create Package specification"
|
|
||||||
CREATE OR REPLACE PACKAGE ${1}.${2}
|
|
||||||
AS
|
|
||||||
-- #############################################################################
|
|
||||||
-- # Copyright (c) `!p snip.rv = dyear()` ${3}
|
|
||||||
-- # All rights reserved
|
|
||||||
-- #
|
|
||||||
-- ############################################################################
|
|
||||||
-- #
|
|
||||||
-- # Application : $1
|
|
||||||
-- # File Name: : `!p snip.rv = t[2].upper()`.pks
|
|
||||||
-- # Exec Method : PL/SQL Stored - Procedure
|
|
||||||
-- # Description : Package used for ${4}
|
|
||||||
-- #
|
|
||||||
-- # Change History
|
|
||||||
-- # -----------------------------------------------------------------------
|
|
||||||
-- # Version Date Author Remarks
|
|
||||||
-- # ======= =========== ============= ============================
|
|
||||||
-- # 1.0 `!p snip.rv = today()` Amit Maindola Initial Version
|
|
||||||
-- #
|
|
||||||
-- #
|
|
||||||
-- ############################################################################
|
|
||||||
${0}
|
|
||||||
END $2;
|
|
||||||
/
|
|
||||||
|
|
||||||
SHOW ERROR
|
|
||||||
/
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet crpkb "Create package body"
|
|
||||||
CREATE OR REPLACE PACKAGE BODY ${1}.${2}
|
|
||||||
IS
|
|
||||||
-- #############################################################################
|
|
||||||
-- # Copyright (c) `!p snip.rv = dyear()` ${3}
|
|
||||||
-- # All rights reserved
|
|
||||||
-- #
|
|
||||||
-- ############################################################################
|
|
||||||
-- #
|
|
||||||
-- # Application : $1
|
|
||||||
-- # File Name: : `!p snip.rv = t[2].upper()`.pkb
|
|
||||||
-- # Exec Method : PL/SQL Stored - Procedure
|
|
||||||
-- # Description : Package used for ${4}
|
|
||||||
-- #
|
|
||||||
-- # Change History
|
|
||||||
-- # -----------------------------------------------------------------------
|
|
||||||
-- # Version Date Author Remarks
|
|
||||||
-- # ======= =========== ============= ============================
|
|
||||||
-- # 1.0 `!p snip.rv = today()` Amit Maindola Initial Version
|
|
||||||
-- #
|
|
||||||
-- #
|
|
||||||
-- ############################################################################
|
|
||||||
-- Declare Global Variables
|
|
||||||
g_sysdate DATE := SYSDATE;
|
|
||||||
g_delimiter VARCHAR2( 30 ) := ' ';
|
|
||||||
g_err_length_limit NUMBER := 1500;
|
|
||||||
g_package_name CONSTANT VARCHAR2(30) := '`!p snip.rv = t[2].upper()`';
|
|
||||||
g_proc_name VARCHAR2(100) := NULL;
|
|
||||||
excp_custom EXCEPTION;
|
|
||||||
|
|
||||||
-- Declare User Global Types
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------
|
|
||||||
-- PROCEDURE : PRINTLOG
|
|
||||||
-- Description : This procedure is used to print log messages
|
|
||||||
------------------------------------------------------------------------------------------------
|
|
||||||
PROCEDURE printlog( p_message IN VARCHAR2 )
|
|
||||||
IS
|
|
||||||
BEGIN
|
|
||||||
DBMS_OUTPUT.PUT_LINE( p_message );
|
|
||||||
DEBUG_LOG_PKG.WRITE_LOG(g_package_name,g_proc_name,p_message);
|
|
||||||
END printlog;
|
|
||||||
|
|
||||||
-- Form the error message for when others
|
|
||||||
FUNCTION get_errmsg( p_message IN VARCHAR2 DEFAULT NULL )
|
|
||||||
RETURN VARCHAR2
|
|
||||||
IS
|
|
||||||
BEGIN
|
|
||||||
RETURN 'Error occured in ' || g_package_name || '.' || g_proc_name || '. ' || NVL( p_message, '' ) || ' Error : ' || SQLERRM;
|
|
||||||
EXCEPTION --Exception Block
|
|
||||||
WHEN OTHERS THEN
|
|
||||||
printlog( 'Error while forming messgage. Error : ' || SQLERRM );
|
|
||||||
RETURN NULL;
|
|
||||||
END;
|
|
||||||
|
|
||||||
END $2;
|
|
||||||
/
|
|
||||||
|
|
||||||
SHOW ERROR
|
|
||||||
/
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet crproc "Create procedure"
|
|
||||||
|
|
||||||
CREATE OR REPLACE PROCEDURE ${1:schema}.${2:name} ${3:( ${4:prams} )}
|
|
||||||
-- #############################################################################
|
|
||||||
-- # Copyright (c) `!p snip.rv = dyear()` ${5}
|
|
||||||
-- # All rights reserved
|
|
||||||
-- #
|
|
||||||
-- ############################################################################
|
|
||||||
-- #
|
|
||||||
-- # Application : $1
|
|
||||||
-- # File Name: : `!p snip.rv = t[2].upper()`.prc
|
|
||||||
-- # Exec Method : PL/SQL Stored - Procedure
|
|
||||||
-- # Description : Package used for ${6}
|
|
||||||
-- #
|
|
||||||
-- # Change History
|
|
||||||
-- # -----------------------------------------------------------------------
|
|
||||||
-- # Version Date Author Remarks
|
|
||||||
-- # ======= =========== ============= ============================
|
|
||||||
-- # 1.0 `!p snip.rv = today()` Amit Maindola Initial Version
|
|
||||||
-- #
|
|
||||||
-- #
|
|
||||||
-- ############################################################################
|
|
||||||
is
|
|
||||||
g_proc_name VARCHAR2(30) := '`!p snip.rv = t[2].upper()`';
|
|
||||||
l_errmsg VARCHAR2( 10000 ) := null;
|
|
||||||
excp_custom EXCEPTION;
|
|
||||||
-- Declare cursors
|
|
||||||
-- Declare Varibales
|
|
||||||
BEGIN
|
|
||||||
-- Initializing out parameters
|
|
||||||
|
|
||||||
${0}
|
|
||||||
EXCEPTION -- Exception block of Procedure
|
|
||||||
WHEN excp_custom THEN
|
|
||||||
ROLLBACK;
|
|
||||||
DEBUG_LOG_PKG.WRITE_LOG(g_proc_name,g_proc_name ,l_errmsg );
|
|
||||||
WHEN OTHERS THEN
|
|
||||||
ROLLBACK;
|
|
||||||
l_errmsg := 'Exception in procedure. '||SQLERRM;
|
|
||||||
DEBUG_LOG_PKG.WRITE_LOG(g_proc_name,g_proc_name ,l_errmsg );
|
|
||||||
END $2;
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
global !p
|
|
||||||
from vimsnippets import complete
|
|
||||||
|
|
||||||
FIELD_TYPES = [
|
|
||||||
'double',
|
|
||||||
'float',
|
|
||||||
'int32',
|
|
||||||
'int64',
|
|
||||||
'uint32',
|
|
||||||
'uint64',
|
|
||||||
'sint32',
|
|
||||||
'sint64',
|
|
||||||
'fixed32',
|
|
||||||
'fixed64',
|
|
||||||
'sfixed32',
|
|
||||||
'sfixed64',
|
|
||||||
'bool',
|
|
||||||
'string',
|
|
||||||
'bytes']
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
snippet mess "Proto message" b
|
|
||||||
// ${2:TODO(`whoami`): Describe this message.}
|
|
||||||
message ${1:Name} {
|
|
||||||
$0
|
|
||||||
|
|
||||||
// Next available id: 1
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet reqf "Required field" b
|
|
||||||
// ${4:TODO(`whoami`): Describe this field.}
|
|
||||||
optional $1`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1}; // Required
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet optf "Optional field" b
|
|
||||||
// ${4:TODO(`whoami`): Describe this field.}
|
|
||||||
optional $1`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet repf "Repeated field" b
|
|
||||||
// ${4:TODO(`whoami`): Describe this field.}
|
|
||||||
repeated $1`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet enum "Enumeration" b
|
|
||||||
// ${2:TODO(`whoami`): Describe this enum.}
|
|
||||||
enum ${1:Name} {
|
|
||||||
}
|
|
||||||
endsnippet
|
|
|
@ -1,260 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
#########################################################################
|
|
||||||
# Python helper code #
|
|
||||||
#########################################################################
|
|
||||||
|
|
||||||
global !p
|
|
||||||
import vim
|
|
||||||
import os.path
|
|
||||||
def get_module_namespace_and_basename():
|
|
||||||
"""This function will try to guess the current class, define or type
|
|
||||||
name you are trying to create. Note that for this to work you should be
|
|
||||||
using the module structure as per the style guide. Examples inputs and
|
|
||||||
it's output
|
|
||||||
* /home/nikolavp/puppet/modules/collectd/manifests/init.pp -> collectd
|
|
||||||
* /home/nikolavp/puppet/modules/collectd/manifests/mysql.pp -> collectd::mysql
|
|
||||||
* /home/nikolavp/puppet/modules/collectd/types/dbname.pp -> Collectd::Dbname
|
|
||||||
"""
|
|
||||||
first_time = True
|
|
||||||
current_file_path_without_ext = vim.eval('expand("%:p:r")') or ""
|
|
||||||
if not current_file_path_without_ext:
|
|
||||||
return "name"
|
|
||||||
parts = os.path.split(current_file_path_without_ext)
|
|
||||||
namespace = ''
|
|
||||||
while parts[0] and parts[0] != '/':
|
|
||||||
if parts[1] == 'init' and first_time and not namespace:
|
|
||||||
first_time = False
|
|
||||||
parts = os.path.split(parts[0])
|
|
||||||
continue
|
|
||||||
if parts[1] in ['manifests', 'types']:
|
|
||||||
parsed_name = os.path.split(
|
|
||||||
parts[0])[1] + ('::' + namespace).rstrip(':')
|
|
||||||
if parts[1] == 'types':
|
|
||||||
parsed_name = parsed_name.title()
|
|
||||||
return parsed_name
|
|
||||||
else:
|
|
||||||
namespace = parts[1] + '::' + namespace
|
|
||||||
parts = os.path.split(parts[0])
|
|
||||||
# couldn't guess the namespace. The user is editing a raw file in no module like the site.pp file
|
|
||||||
return "name"
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Puppet Language Constructs #
|
|
||||||
# See http://docs.puppetlabs.com/puppet/latest/reference/lang_summary.html #
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
snippet class "Class declaration" b
|
|
||||||
class ${1:`!p snip.rv = get_module_namespace_and_basename()`} {
|
|
||||||
${0:# body}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet define "Definition" b
|
|
||||||
define ${1:`!p snip.rv = get_module_namespace_and_basename()`} {
|
|
||||||
${0:# body}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet type "Data type alias" b
|
|
||||||
type ${1:`!p snip.rv = get_module_namespace_and_basename()`} = ${2:Type}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet lambda "Lambda function chain-called on a variable"
|
|
||||||
$${1:varname}.${2:each} |${3:Type} $${4:param}| {
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
#################################################################
|
|
||||||
# Puppet Types #
|
|
||||||
# See http://docs.puppetlabs.com/references/latest/type.html #
|
|
||||||
#################################################################
|
|
||||||
|
|
||||||
snippet cron "Cron resource type" b
|
|
||||||
cron { '${1:name}':
|
|
||||||
user => ${2:user},
|
|
||||||
command => '${3:command}',
|
|
||||||
minute => ${3:minute},
|
|
||||||
hour => ${4:hour},
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet exec "Exec resource type" b
|
|
||||||
exec { '${1:command}':
|
|
||||||
command => "${2:$1}",
|
|
||||||
user => "${3:root}",
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet file "File resource type" b
|
|
||||||
file { '${1:name}':
|
|
||||||
source => "puppet://${2:path}",
|
|
||||||
mode => ${3:mode},
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet File "Defaults for file" b
|
|
||||||
File {
|
|
||||||
owner => ${1:username},
|
|
||||||
group => ${2:groupname},
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet group "Group resource type" b
|
|
||||||
group { '${1:groupname}':
|
|
||||||
ensure => ${3:present},
|
|
||||||
gid => ${2:gid},
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mount "Mount resource type" b
|
|
||||||
mount { '${1:path}':
|
|
||||||
device => '${2:/dev}',
|
|
||||||
fstype => '${3:filesystem}',
|
|
||||||
ensure => mounted,
|
|
||||||
options => 'rw,errors=remount-ro',
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet package "Package resource type" b
|
|
||||||
package { '${1:name}':
|
|
||||||
ensure => ${2:installed},
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet user "user resource type" b
|
|
||||||
user { '${1:username}':
|
|
||||||
ensure => ${2:present},
|
|
||||||
uid => ${3:uid},
|
|
||||||
gid => ${4:gid},
|
|
||||||
comment => ${5:gecos},
|
|
||||||
home => ${6:homedirectory},
|
|
||||||
managehome => false,
|
|
||||||
require => Group['${7:group'}],
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet service "Service resource type" b
|
|
||||||
service { '${1:name}':
|
|
||||||
hasstatus => true,
|
|
||||||
enable => true,
|
|
||||||
ensure => running,
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
########################################################################
|
|
||||||
# Puppet Functions #
|
|
||||||
# See http://docs.puppetlabs.com/references/latest/function.html #
|
|
||||||
########################################################################
|
|
||||||
|
|
||||||
snippet alert "Alert Function" b
|
|
||||||
alert("${1:message}")$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet crit "Crit Function" b
|
|
||||||
crit("${1:message}")$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet debug "Debug Function" b
|
|
||||||
debug("${1:message}")$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet defined "Defined Function" b
|
|
||||||
defined(${1:Resource}["${2:name}"])$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet emerg "Emerg Function" b
|
|
||||||
emerg("${1:message}")$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet extlookup "Simple Extlookup" b
|
|
||||||
$${1:Variable} = extlookup("${2:Lookup}")$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet extlookup "Extlookup with defaults" b
|
|
||||||
$${1:Variable} = extlookup("${2:Lookup}", ${3:Default})$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet extlookup "Extlookup with defaults and custom data file" b
|
|
||||||
$${1:Variable} = extlookup("${2:Lookup}", ${3:Default}, ${4:Data Source})$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fail "Fail Function" b
|
|
||||||
fail("${1:message}")$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet hiera "Hiera Function" b
|
|
||||||
$${1:Variable} = hiera("${2:Lookup}")$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet hiera "Hiera with defaults" b
|
|
||||||
$${1:Variable} = hiera("${2:Lookup}", ${3:Default})$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet hiera "Hiera with defaults and override" b
|
|
||||||
$${1:Variable} = hiera("${2:Lookup}", ${3:Default}, ${4:Override})$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet hiera_hash "Hiera Hash Function" b
|
|
||||||
$${1:Variable} = hiera_hash("${2:Lookup}")$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet hiera_hash "Hiera Hash with defaults" b
|
|
||||||
$${1:Variable} = hiera_hash("${2:Lookup}", ${3:Default})$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet hiera_hash "Hiera Hash with defaults and override" b
|
|
||||||
$${1:Variable} = hiera_hash("${2:Lookup}", ${3:Default}, ${4:Override})$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet hiera_include "Hiera Include Function" b
|
|
||||||
hiera_include("${1:Lookup}")$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet lookup "Lookup data from hiera"
|
|
||||||
$${1:varname} = lookup('${2:hiera::key}')$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet trocla "Lookup or generate sensitive information"
|
|
||||||
trocla('${1:lookup_key}', '${2:plain}', ${3:'length: 32'})$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet include "Include Function" b
|
|
||||||
include ${1:classname}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet info "Info Function" b
|
|
||||||
info("${1:message}")$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet inline_template "Inline Template Function" b
|
|
||||||
inline_template("<%= ${1:template} %>")$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet notice "Notice Function" b
|
|
||||||
notice("${1:message}")$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet realize "Realize Function" b
|
|
||||||
realize(${1:Resource}["${2:name}"])$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet regsubst "Regsubst Function" b
|
|
||||||
regsubst($${1:Target}, '${2:regexp}', '${3:replacement}')$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet split "Split Function" b
|
|
||||||
$${1:Variable} = split($${1:Target}, '${2:regexp}')$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet versioncmp "Version Compare Function" b
|
|
||||||
$${1:Variable} = versioncmp('${1:version}', '${2:version}')$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet warning "Warning Function" b
|
|
||||||
warning("${1:message}")$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -1,782 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
###########################################################################
|
|
||||||
# TEXTMATE SNIPPETS #
|
|
||||||
###########################################################################
|
|
||||||
|
|
||||||
#! header
|
|
||||||
snippet #! "#!/usr/bin/env python" b
|
|
||||||
#!/usr/bin/env python
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet #!2 "#!/usr/bin/env python2" b
|
|
||||||
#!/usr/bin/env python2
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet #!3 "#!/usr/bin/env python3" b
|
|
||||||
#!/usr/bin/env python3
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "^# ?[uU][tT][fF]-?8" "# encoding: UTF-8" r
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ifmain "ifmain" b
|
|
||||||
if __name__ == `!p snip.rv = get_quoting_style(snip)`__main__`!p snip.rv = get_quoting_style(snip)`:
|
|
||||||
${1:${VISUAL:main()}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet with "with" b
|
|
||||||
with ${1:expr}`!p snip.rv = " as " if t[2] else ""`${2:var}:
|
|
||||||
${3:${VISUAL:pass}}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet for "for loop" b
|
|
||||||
for ${1:item} in ${2:iterable}:
|
|
||||||
${3:${VISUAL:pass}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
##########
|
|
||||||
# COMMON #
|
|
||||||
##########
|
|
||||||
|
|
||||||
# The smart def and smart class snippets use a global option called
|
|
||||||
# "g:ultisnips_python_style" which, if set to "doxygen" will use doxygen
|
|
||||||
# style comments in docstrings.
|
|
||||||
|
|
||||||
global !p
|
|
||||||
|
|
||||||
NORMAL = 0x1
|
|
||||||
DOXYGEN = 0x2
|
|
||||||
SPHINX = 0x3
|
|
||||||
GOOGLE = 0x4
|
|
||||||
NUMPY = 0x5
|
|
||||||
JEDI = 0x6
|
|
||||||
|
|
||||||
SINGLE_QUOTES = "'"
|
|
||||||
DOUBLE_QUOTES = '"'
|
|
||||||
|
|
||||||
|
|
||||||
class Arg(object):
|
|
||||||
def __init__(self, arg):
|
|
||||||
self.arg = arg
|
|
||||||
name_and_type = arg.split('=')[0].split(':')
|
|
||||||
self.name = name_and_type[0].strip()
|
|
||||||
self.type = name_and_type[1].strip() if len(name_and_type) == 2 else None
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return self.name
|
|
||||||
|
|
||||||
def __unicode__(self):
|
|
||||||
return self.name
|
|
||||||
|
|
||||||
def is_kwarg(self):
|
|
||||||
return '=' in self.arg
|
|
||||||
|
|
||||||
def is_vararg(self):
|
|
||||||
return '*' in self.name
|
|
||||||
|
|
||||||
|
|
||||||
def get_args(arglist):
|
|
||||||
args = []
|
|
||||||
n = len(arglist)
|
|
||||||
i = 0
|
|
||||||
while i < n:
|
|
||||||
l_bracket = 0
|
|
||||||
start = i
|
|
||||||
while i < n and (l_bracket > 0 or arglist[i] != ','):
|
|
||||||
if arglist[i] == '[':
|
|
||||||
l_bracket += 1
|
|
||||||
elif arglist[i] == ']' and l_bracket > 0:
|
|
||||||
l_bracket -= 1
|
|
||||||
i += 1
|
|
||||||
arg = arglist[start:i]
|
|
||||||
if arg:
|
|
||||||
args.append(Arg(arg))
|
|
||||||
i += 1
|
|
||||||
|
|
||||||
args = [arg for arg in args if arg.name != 'self']
|
|
||||||
|
|
||||||
return args
|
|
||||||
|
|
||||||
|
|
||||||
def get_quoting_style(snip):
|
|
||||||
style = snip.opt("g:ultisnips_python_quoting_style", "double")
|
|
||||||
if style == 'single':
|
|
||||||
return SINGLE_QUOTES
|
|
||||||
return DOUBLE_QUOTES
|
|
||||||
|
|
||||||
def triple_quotes(snip):
|
|
||||||
style = snip.opt("g:ultisnips_python_triple_quoting_style")
|
|
||||||
if not style:
|
|
||||||
return get_quoting_style(snip) * 3
|
|
||||||
return (SINGLE_QUOTES if style == 'single' else DOUBLE_QUOTES) * 3
|
|
||||||
|
|
||||||
def triple_quotes_handle_trailing(snip, quoting_style):
|
|
||||||
"""
|
|
||||||
Generate triple quoted strings and handle any trailing quote char,
|
|
||||||
which might be there from some autoclose/autopair plugin,
|
|
||||||
i.e. when expanding ``"|"``.
|
|
||||||
"""
|
|
||||||
if not snip.c:
|
|
||||||
# Do this only once, otherwise the following error would happen:
|
|
||||||
# RuntimeError: The snippets content did not converge: …
|
|
||||||
row, col = vim.current.window.cursor
|
|
||||||
|
|
||||||
# before ultisnip expansion, chars ahead cursor is at row - 1, col
|
|
||||||
# after ultisnip expansion, they are pushed to row + 1, col - 1
|
|
||||||
# when this function is run, it's already after ultisni expansion
|
|
||||||
line = snip.buffer[row + 1]
|
|
||||||
|
|
||||||
# Handle already existing quote chars after the trigger.
|
|
||||||
_ret = quoting_style * 3
|
|
||||||
while True:
|
|
||||||
try:
|
|
||||||
nextc = line[col - 1]
|
|
||||||
except IndexError:
|
|
||||||
break
|
|
||||||
if nextc == quoting_style and len(_ret):
|
|
||||||
_ret = _ret[1:]
|
|
||||||
col = col+1
|
|
||||||
else:
|
|
||||||
break
|
|
||||||
snip.rv = _ret
|
|
||||||
else:
|
|
||||||
snip.rv = snip.c
|
|
||||||
|
|
||||||
def get_style(snip):
|
|
||||||
style = snip.opt("g:ultisnips_python_style", "normal")
|
|
||||||
|
|
||||||
if style == "doxygen": return DOXYGEN
|
|
||||||
elif style == "sphinx": return SPHINX
|
|
||||||
elif style == "google": return GOOGLE
|
|
||||||
elif style == "numpy": return NUMPY
|
|
||||||
elif style == "jedi": return JEDI
|
|
||||||
else: return NORMAL
|
|
||||||
|
|
||||||
|
|
||||||
def format_arg(arg, style):
|
|
||||||
if style == DOXYGEN:
|
|
||||||
return "@param %s TODO" % arg
|
|
||||||
elif style == SPHINX:
|
|
||||||
return ":param %s: TODO" % arg
|
|
||||||
elif style == NORMAL:
|
|
||||||
return ":%s: TODO" % arg
|
|
||||||
elif style == GOOGLE:
|
|
||||||
return "%s (%s): TODO" % (arg, arg.type or "TODO")
|
|
||||||
elif style == JEDI:
|
|
||||||
return ":type %s: TODO" % arg
|
|
||||||
elif style == NUMPY:
|
|
||||||
return "%s : TODO" % arg
|
|
||||||
|
|
||||||
|
|
||||||
def format_return(style):
|
|
||||||
if style == DOXYGEN:
|
|
||||||
return "@return: TODO"
|
|
||||||
elif style in (NORMAL, SPHINX, JEDI):
|
|
||||||
return ":returns: TODO"
|
|
||||||
elif style == GOOGLE:
|
|
||||||
return "Returns: TODO"
|
|
||||||
|
|
||||||
|
|
||||||
def write_docstring_args(args, snip):
|
|
||||||
if not args:
|
|
||||||
snip.rv += ' {0}'.format(triple_quotes(snip))
|
|
||||||
return
|
|
||||||
|
|
||||||
snip.rv += '\n' + snip.mkline('', indent='')
|
|
||||||
|
|
||||||
style = get_style(snip)
|
|
||||||
|
|
||||||
if style == GOOGLE:
|
|
||||||
write_google_docstring_args(args, snip)
|
|
||||||
elif style == NUMPY:
|
|
||||||
write_numpy_docstring_args(args, snip)
|
|
||||||
else:
|
|
||||||
for arg in args:
|
|
||||||
snip += format_arg(arg, style)
|
|
||||||
|
|
||||||
|
|
||||||
def write_google_docstring_args(args, snip):
|
|
||||||
kwargs = [arg for arg in args if arg.is_kwarg()]
|
|
||||||
args = [arg for arg in args if not arg.is_kwarg()]
|
|
||||||
|
|
||||||
if args:
|
|
||||||
snip += "Args:"
|
|
||||||
snip.shift()
|
|
||||||
for arg in args:
|
|
||||||
snip += format_arg(arg, GOOGLE)
|
|
||||||
snip.unshift()
|
|
||||||
snip.rv += '\n' + snip.mkline('', indent='')
|
|
||||||
|
|
||||||
if kwargs:
|
|
||||||
snip += "Kwargs:"
|
|
||||||
snip.shift()
|
|
||||||
for kwarg in kwargs:
|
|
||||||
snip += format_arg(kwarg, GOOGLE)
|
|
||||||
snip.unshift()
|
|
||||||
snip.rv += '\n' + snip.mkline('', indent='')
|
|
||||||
|
|
||||||
|
|
||||||
def write_numpy_docstring_args(args, snip):
|
|
||||||
if args:
|
|
||||||
snip += "Parameters"
|
|
||||||
snip += "----------"
|
|
||||||
|
|
||||||
kwargs = [arg for arg in args if arg.is_kwarg()]
|
|
||||||
args = [arg for arg in args if not arg.is_kwarg()]
|
|
||||||
|
|
||||||
if args:
|
|
||||||
for arg in args:
|
|
||||||
snip += format_arg(arg, NUMPY)
|
|
||||||
if kwargs:
|
|
||||||
for kwarg in kwargs:
|
|
||||||
snip += format_arg(kwarg, NUMPY) + ', optional'
|
|
||||||
snip.rv += '\n' + snip.mkline('', indent='')
|
|
||||||
|
|
||||||
|
|
||||||
def write_init_body(args, parents, snip):
|
|
||||||
parents = [p.strip() for p in parents.split(",")]
|
|
||||||
parents = [p for p in parents if p != 'object']
|
|
||||||
|
|
||||||
for p in parents:
|
|
||||||
snip += p + ".__init__(self)"
|
|
||||||
|
|
||||||
if parents:
|
|
||||||
snip.rv += '\n' + snip.mkline('', indent='')
|
|
||||||
|
|
||||||
for arg in filter(lambda arg: not arg.is_vararg(), args):
|
|
||||||
snip += "self._%s = %s" % (arg, arg)
|
|
||||||
|
|
||||||
|
|
||||||
def write_slots_args(args, snip):
|
|
||||||
quote = get_quoting_style(snip)
|
|
||||||
arg_format = quote + '_%s' + quote
|
|
||||||
args = [arg_format % arg for arg in args]
|
|
||||||
snip += '__slots__ = (%s,)' % ', '.join(args)
|
|
||||||
|
|
||||||
|
|
||||||
def write_function_docstring(t, snip):
|
|
||||||
"""
|
|
||||||
Writes a function docstring with the current style.
|
|
||||||
|
|
||||||
:param t: The values of the placeholders
|
|
||||||
:param snip: UltiSnips.TextObjects.SnippetUtil object instance
|
|
||||||
"""
|
|
||||||
snip.rv = ""
|
|
||||||
snip >> 1
|
|
||||||
|
|
||||||
args = get_args(t[2])
|
|
||||||
if args:
|
|
||||||
write_docstring_args(args, snip)
|
|
||||||
|
|
||||||
style = get_style(snip)
|
|
||||||
|
|
||||||
if style == NUMPY:
|
|
||||||
snip += 'Returns'
|
|
||||||
snip += '-------'
|
|
||||||
snip += 'TODO'
|
|
||||||
else:
|
|
||||||
snip += format_return(style)
|
|
||||||
snip.rv += '\n' + snip.mkline('', indent='')
|
|
||||||
snip += triple_quotes(snip)
|
|
||||||
|
|
||||||
def get_dir_and_file_name(snip):
|
|
||||||
return os.getcwd().split(os.sep)[-1] + '.' + snip.basename
|
|
||||||
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
########################################
|
|
||||||
# Class & Special Method Name Snippets #
|
|
||||||
########################################
|
|
||||||
|
|
||||||
snippet class "class with docstrings" b
|
|
||||||
class ${1:MyClass}(${2:object}):
|
|
||||||
|
|
||||||
`!p snip.rv = triple_quotes(snip)`${3:Docstring for $1. }`!p snip.rv = triple_quotes(snip)`
|
|
||||||
|
|
||||||
def __init__(self$4):
|
|
||||||
`!p snip.rv = triple_quotes(snip)`${5:TODO: to be defined.}`!p
|
|
||||||
snip.rv = ""
|
|
||||||
snip >> 2
|
|
||||||
|
|
||||||
args = get_args(t[4])
|
|
||||||
|
|
||||||
write_docstring_args(args, snip)
|
|
||||||
if args:
|
|
||||||
snip.rv += '\n' + snip.mkline('', indent='')
|
|
||||||
snip += '{0}'.format(triple_quotes(snip))
|
|
||||||
|
|
||||||
write_init_body(args, t[2], snip)
|
|
||||||
`
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet slotclass "class with slots and docstrings" b
|
|
||||||
class ${1:MyClass}(${2:object}):
|
|
||||||
|
|
||||||
`!p snip.rv = triple_quotes(snip)`${3:Docstring for $1. }`!p snip.rv = triple_quotes(snip)`
|
|
||||||
`!p
|
|
||||||
snip >> 1
|
|
||||||
args = get_args(t[4])
|
|
||||||
write_slots_args(args, snip)
|
|
||||||
`
|
|
||||||
|
|
||||||
def __init__(self$4):
|
|
||||||
`!p snip.rv = triple_quotes(snip)`${5:TODO: to be defined.}`!p
|
|
||||||
snip.rv = ""
|
|
||||||
snip >> 2
|
|
||||||
|
|
||||||
args = get_args(t[4])
|
|
||||||
|
|
||||||
write_docstring_args(args, snip)
|
|
||||||
if args:
|
|
||||||
snip.rv += '\n' + snip.mkline('', indent='')
|
|
||||||
snip += triple_quotes(snip)
|
|
||||||
|
|
||||||
write_init_body(args, t[2], snip)
|
|
||||||
`
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet dcl "dataclass" b
|
|
||||||
@dataclass
|
|
||||||
class ${1:MyClass}:
|
|
||||||
`!p snip.rv = triple_quotes(snip)`${2:Docstring for $1. }`!p snip.rv = triple_quotes(snip)`
|
|
||||||
${3:var_1}: ${4:int}
|
|
||||||
${5:var_2}: ${6:float} = ${7:0}
|
|
||||||
|
|
||||||
def ${8:total}(self): -> $6:
|
|
||||||
return ${0:self.$3 * self.$5}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet contain "methods for emulating a container type" b
|
|
||||||
def __len__(self):
|
|
||||||
${1:pass}
|
|
||||||
|
|
||||||
def __getitem__(self, key):
|
|
||||||
${2:pass}
|
|
||||||
|
|
||||||
def __setitem__(self, key, value):
|
|
||||||
${3:pass}
|
|
||||||
|
|
||||||
def __delitem__(self, key):
|
|
||||||
${4:pass}
|
|
||||||
|
|
||||||
def __iter__(self):
|
|
||||||
${5:pass}
|
|
||||||
|
|
||||||
def __reversed__(self):
|
|
||||||
${6:pass}
|
|
||||||
|
|
||||||
def __contains__(self, item):
|
|
||||||
${7:pass}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet context "context manager methods" b
|
|
||||||
def __enter__(self):
|
|
||||||
${1:pass}
|
|
||||||
|
|
||||||
def __exit__(self, exc_type, exc_value, traceback):
|
|
||||||
${2:pass}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet attr "methods for customizing attribute access" b
|
|
||||||
def __getattr__(self, name):
|
|
||||||
${1:pass}
|
|
||||||
|
|
||||||
def __setattr__(self, name, value):
|
|
||||||
${2:pass}
|
|
||||||
|
|
||||||
def __delattr__(self, name):
|
|
||||||
${3:pass}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet desc "methods implementing descriptors" b
|
|
||||||
def __get__(self, instance, owner):
|
|
||||||
${1:pass}
|
|
||||||
|
|
||||||
def __set__(self, instance, value):
|
|
||||||
${2:pass}
|
|
||||||
|
|
||||||
def __delete__(self, instance):
|
|
||||||
${3:pass}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet cmp "methods implementing rich comparison"
|
|
||||||
def __eq__(self, other):
|
|
||||||
${1:pass}
|
|
||||||
|
|
||||||
def __ne__(self, other):
|
|
||||||
${2:pass}
|
|
||||||
|
|
||||||
def __lt__(self, other):
|
|
||||||
${3:pass}
|
|
||||||
|
|
||||||
def __le__(self, other):
|
|
||||||
${4:pass}
|
|
||||||
|
|
||||||
def __gt__(self, other):
|
|
||||||
${5:pass}
|
|
||||||
|
|
||||||
def __ge__(self, other):
|
|
||||||
${6:pass}
|
|
||||||
|
|
||||||
def __cmp__(self, other):
|
|
||||||
${7:pass}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet repr "methods implementing string representation"
|
|
||||||
def __repr__(self):
|
|
||||||
${1:pass}
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
${2:pass}
|
|
||||||
|
|
||||||
def __unicode__(self):
|
|
||||||
${3:pass}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
# note: reflected operands and augmented arithmeitc assignements have been
|
|
||||||
# intentionally ommited to reduce verbosity.
|
|
||||||
snippet numeric "methods for emulating a numeric type" b
|
|
||||||
def __add__(self, other):
|
|
||||||
${1:pass}
|
|
||||||
|
|
||||||
def __sub__(self, other):
|
|
||||||
${2:pass}
|
|
||||||
|
|
||||||
def __mul__(self, other):
|
|
||||||
${3:pass}
|
|
||||||
|
|
||||||
def __div__(self, other):
|
|
||||||
${4:pass}
|
|
||||||
|
|
||||||
def __truediv__(self, other):
|
|
||||||
${5:pass}
|
|
||||||
|
|
||||||
def __floordiv__(self, other):
|
|
||||||
${6:pass}
|
|
||||||
|
|
||||||
|
|
||||||
def __mod__(self, other):
|
|
||||||
${7:pass}
|
|
||||||
|
|
||||||
def __divmod__(self, other):
|
|
||||||
${8:pass}
|
|
||||||
|
|
||||||
def __pow__(self, other):
|
|
||||||
${9:pass}
|
|
||||||
|
|
||||||
|
|
||||||
def __lshift__(self, other):
|
|
||||||
${10:pass}
|
|
||||||
|
|
||||||
def __rshift__(self, other):
|
|
||||||
${11:pass}
|
|
||||||
|
|
||||||
def __and__(self, other):
|
|
||||||
${12:pass}
|
|
||||||
|
|
||||||
def __xor__(self, other):
|
|
||||||
${13:pass}
|
|
||||||
|
|
||||||
def __or__(self, other):
|
|
||||||
${14:pass}
|
|
||||||
|
|
||||||
|
|
||||||
def __neg__(self):
|
|
||||||
${15:pass}
|
|
||||||
|
|
||||||
def __pos__(self):
|
|
||||||
${16:pass}
|
|
||||||
|
|
||||||
def __abs__(self):
|
|
||||||
${17:pass}
|
|
||||||
|
|
||||||
def __invert__(self):
|
|
||||||
${18:pass}
|
|
||||||
|
|
||||||
|
|
||||||
def __complex__(self):
|
|
||||||
${19:pass}
|
|
||||||
|
|
||||||
def __int__(self):
|
|
||||||
${20:pass}
|
|
||||||
|
|
||||||
def __long__(self):
|
|
||||||
${21:pass}
|
|
||||||
|
|
||||||
def __float__(self):
|
|
||||||
${22:pass}
|
|
||||||
|
|
||||||
|
|
||||||
def __oct__(self):
|
|
||||||
${22:pass}
|
|
||||||
|
|
||||||
def __hex__(self):
|
|
||||||
${23:pass}
|
|
||||||
|
|
||||||
|
|
||||||
def __index__(self):
|
|
||||||
${24:pass}
|
|
||||||
|
|
||||||
def __coerce__(self, other):
|
|
||||||
${25:pass}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet deff "function or class method"
|
|
||||||
def ${1:fname}(`!p snip.rv = "self, " if snip.indent else ""`$2):
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet def "function with docstrings" b
|
|
||||||
def ${1:function}(`!p
|
|
||||||
if snip.indent:
|
|
||||||
snip.rv = 'self' + (", " if len(t[2]) else "")`${2:arg1}):
|
|
||||||
`!p snip.rv = triple_quotes(snip)`${4:TODO: Docstring for $1.}`!p
|
|
||||||
write_function_docstring(t, snip) `
|
|
||||||
${5:${VISUAL:pass}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet defc "class method with docstrings" b
|
|
||||||
@classmethod
|
|
||||||
def ${1:function}(`!p
|
|
||||||
if snip.indent:
|
|
||||||
snip.rv = 'cls' + (", " if len(t[2]) else "")`${2:arg1}):
|
|
||||||
`!p snip.rv = triple_quotes(snip)`${4:TODO: Docstring for $1.}`!p
|
|
||||||
write_function_docstring(t, snip) `
|
|
||||||
${5:${VISUAL:pass}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet defs "static method with docstrings" b
|
|
||||||
@staticmethod
|
|
||||||
def ${1:function}(${2:arg1}):
|
|
||||||
`!p snip.rv = triple_quotes(snip)`${4:TODO: Docstring for $1.}`!p
|
|
||||||
write_function_docstring(t, snip) `
|
|
||||||
${5:${VISUAL:pass}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
# doesn't expand when there is a word in front
|
|
||||||
snippet /(^|(?<=\W))\./ "self." r
|
|
||||||
self.
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet from "from module import name" b
|
|
||||||
from ${1:module} import ${2:Stuff}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
##############
|
|
||||||
# PROPERTIES #
|
|
||||||
##############
|
|
||||||
snippet roprop "Read Only Property" b
|
|
||||||
@property
|
|
||||||
def ${1:name}(self):
|
|
||||||
${2:return self._$1}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rwprop "Read write property" b
|
|
||||||
def ${1:name}():
|
|
||||||
`!p snip.rv = triple_quotes(snip) if t[2] else ''
|
|
||||||
`${2:TODO: Docstring for $1.}`!p
|
|
||||||
if t[2]:
|
|
||||||
snip >> 1
|
|
||||||
|
|
||||||
style = get_style(snip)
|
|
||||||
snip.rv += '\n' + snip.mkline('', indent='')
|
|
||||||
snip += format_return(style)
|
|
||||||
snip.rv += '\n' + snip.mkline('', indent='')
|
|
||||||
snip += triple_quotes(snip)
|
|
||||||
else:
|
|
||||||
snip.rv = ""`
|
|
||||||
def fget(self):
|
|
||||||
return self._$1$0
|
|
||||||
|
|
||||||
def fset(self, value):
|
|
||||||
self._$1 = value
|
|
||||||
return locals()
|
|
||||||
|
|
||||||
$1 = property(**$1(), doc=$1.__doc__)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
############################
|
|
||||||
# If / Else / Elif / Match #
|
|
||||||
############################
|
|
||||||
snippet if "If" b
|
|
||||||
if ${1:condition}:
|
|
||||||
${2:${VISUAL:pass}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ife "If / Else" b
|
|
||||||
if ${1:condition}:
|
|
||||||
${2:${VISUAL:pass}}
|
|
||||||
else:
|
|
||||||
${3:pass}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ifee "If / Elif / Else" b
|
|
||||||
if ${1:condition}:
|
|
||||||
${2:${VISUAL:pass}}
|
|
||||||
elif ${3:condition}:
|
|
||||||
${4:pass}
|
|
||||||
else:
|
|
||||||
${5:pass}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet match "Structural pattern matching" b
|
|
||||||
match ${1:expression}:
|
|
||||||
case ${2:pattern_1}:
|
|
||||||
${3:pass}
|
|
||||||
case ${4:pattern_2}:
|
|
||||||
${0:pass}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet matchw "Pattern matching with wildcard" b
|
|
||||||
match ${1:expression}:
|
|
||||||
case ${2:pattern_1}:
|
|
||||||
${3:pass}
|
|
||||||
case _:
|
|
||||||
${0:pass}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
##########################
|
|
||||||
# Try / Except / Finally #
|
|
||||||
##########################
|
|
||||||
snippet try "Try / Except" b
|
|
||||||
try:
|
|
||||||
${1:${VISUAL:pass}}
|
|
||||||
except ${2:Exception} as ${3:e}:
|
|
||||||
${4:raise $3}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet trye "Try / Except / Else" b
|
|
||||||
try:
|
|
||||||
${1:${VISUAL:pass}}
|
|
||||||
except ${2:Exception} as ${3:e}:
|
|
||||||
${4:raise $3}
|
|
||||||
else:
|
|
||||||
${5:pass}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tryf "Try / Except / Finally" b
|
|
||||||
try:
|
|
||||||
${1:${VISUAL:pass}}
|
|
||||||
except ${2:Exception} as ${3:e}:
|
|
||||||
${4:raise $3}
|
|
||||||
finally:
|
|
||||||
${5:pass}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tryef "Try / Except / Else / Finally" b
|
|
||||||
try:
|
|
||||||
${1:${VISUAL:pass}}
|
|
||||||
except${2: ${3:Exception} as ${4:e}}:
|
|
||||||
${5:raise}
|
|
||||||
else:
|
|
||||||
${6:pass}
|
|
||||||
finally:
|
|
||||||
${7:pass}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
######################
|
|
||||||
# Assertions & Tests #
|
|
||||||
######################
|
|
||||||
|
|
||||||
snippet ae "Assert equal" b
|
|
||||||
self.assertEqual(${1:${VISUAL:first}}, ${2:second})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet at "Assert True" b
|
|
||||||
self.assertTrue(${1:${VISUAL:expression}})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet af "Assert False" b
|
|
||||||
self.assertFalse(${1:${VISUAL:expression}})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet aae "Assert almost equal" b
|
|
||||||
self.assertAlmostEqual(${1:${VISUAL:first}}, ${2:second})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ar "Assert raises" b
|
|
||||||
self.assertRaises(${1:exception}, ${2:${VISUAL:func}}${3/.+/, /}${3:arguments})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet an "Assert is None" b
|
|
||||||
self.assertIsNone(${1:${VISUAL:expression}})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ann "Assert is not None" b
|
|
||||||
self.assertIsNotNone(${1:${VISUAL:expression}})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet testcase "pyunit testcase" b
|
|
||||||
class Test${1:Class}(${2:unittest.TestCase}):
|
|
||||||
|
|
||||||
`!p snip.rv = triple_quotes(snip)`${3:Test case docstring.}`!p snip.rv = triple_quotes(snip)`
|
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
${4:pass}
|
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
${5:pass}
|
|
||||||
|
|
||||||
def test_${6:name}(self):
|
|
||||||
${7:${VISUAL:pass}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet " "triple quoted string (double quotes)" b
|
|
||||||
"""
|
|
||||||
${1:${VISUAL:doc}}
|
|
||||||
`!p triple_quotes_handle_trailing(snip, '"')`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ' "triple quoted string (single quotes)" b
|
|
||||||
'''
|
|
||||||
${1:${VISUAL:doc}}
|
|
||||||
`!p triple_quotes_handle_trailing(snip, "'")`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet doc "doc block (triple quotes)"
|
|
||||||
`!p snip.rv = triple_quotes(snip)`
|
|
||||||
${1:${VISUAL:doc}}
|
|
||||||
`!p snip.rv = triple_quotes(snip)`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pmdoc "pocoo style module doc string" b
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
"""
|
|
||||||
`!p snip.rv = get_dir_and_file_name(snip)`
|
|
||||||
`!p snip.rv = '~' * len(get_dir_and_file_name(snip))`
|
|
||||||
|
|
||||||
${1:DESCRIPTION}
|
|
||||||
|
|
||||||
:copyright: (c) `date +%Y` by ${2:YOUR_NAME}.
|
|
||||||
:license: ${3:LICENSE_NAME}, see LICENSE for more details.
|
|
||||||
"""
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -1,191 +0,0 @@
|
||||||
priority -20
|
|
||||||
|
|
||||||
global !p
|
|
||||||
import os
|
|
||||||
from vimsnippets import complete
|
|
||||||
|
|
||||||
FIELD_TYPES = [
|
|
||||||
'character',
|
|
||||||
'data.frame',
|
|
||||||
'integer',
|
|
||||||
'list',
|
|
||||||
'logical',
|
|
||||||
'matrix',
|
|
||||||
'numeric',
|
|
||||||
'vector']
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
snippet #! "#!/usr/bin/env Rscript" b
|
|
||||||
#!/usr/bin/env Rscript
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet setwd "Set workingdir" b
|
|
||||||
setwd("${1:`!p snip.rv = os.getcwd()`}")
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet as "Apply type on variable" w
|
|
||||||
as.$1`!p snip.rv = complete(t[1], FIELD_TYPES)`($2${VISUAL})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet is "Test type on variable" w
|
|
||||||
is.$1`!p snip.rv = complete(t[1], FIELD_TYPES)`($2${VISUAL})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet dl "Download and install a package" b
|
|
||||||
download.file("${1:${VISUAL:url to package}}", destfile = "${2:${1/.*\/(\S*)$/(?1:$1)/ga}}")
|
|
||||||
install.packages("$2", type = "source", repos = NULL)
|
|
||||||
library("${3:${2/^(\w+)_.*$/(?1:$1)/ga}}")
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet lib "Import a library"
|
|
||||||
library('${0:${VISUAL:package}}')
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet req "Require a file"
|
|
||||||
require('${0:${VISUAL:package}}')
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet source "Source a file"
|
|
||||||
source('${0:${VISUAL:file}}')
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet if "If statement"
|
|
||||||
if ($1) {
|
|
||||||
${0:${VISUAL}}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet eif "Else-If statement"
|
|
||||||
else if ($1) {
|
|
||||||
${0:${VISUAL}}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet el "Else statement"
|
|
||||||
else {
|
|
||||||
${0:${VISUAL}}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ife "if .. else"
|
|
||||||
if ($1) {
|
|
||||||
${2:${VISUAL}}
|
|
||||||
} else {
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet wh "while loop"
|
|
||||||
while($1) {
|
|
||||||
${0:${VISUAL}}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet for "for loop"
|
|
||||||
for (${1:item} in ${2:list}) {
|
|
||||||
${0:${VISUAL}}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fun "Function definition"
|
|
||||||
${1:name} <- function ($2) {
|
|
||||||
${0:${VISUAL}}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ret "Return call"
|
|
||||||
return(${0:${VISUAL}})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet df "Data frame"
|
|
||||||
${1:name}[${2:rows}, ${0:cols}]
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet c "c function"
|
|
||||||
c(${0:${VISUAL:items}})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet li "list function"
|
|
||||||
list(${0:${VISUAL:items}})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mat "matrix function"
|
|
||||||
matrix(${1:${VISUAL:data}}, nrow = ${2:rows}, ncol = ${0:cols})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet apply "apply function"
|
|
||||||
apply(${1:${VISUAL:array}}, ${2:margin}, ${0:function})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet lapply "lapply function"
|
|
||||||
lapply(${1:${VISUAL:list}}, ${0:function})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sapply "sapply function"
|
|
||||||
sapply(${1:${VISUAL:list}}, ${0:function})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet vapply "vapply function"
|
|
||||||
vapply(${1:${VISUAL:list}}, ${2:function}, ${0:type})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mapply "mapply function"
|
|
||||||
mapply(${1:${VISUAL:function}}, ${0:...})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tapply "tapply function"
|
|
||||||
tapply(${1:${VISUAL:vector}}, ${2:index}, ${0:function})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rapply "rapply function"
|
|
||||||
rapply(${1:${VISUAL:list}}, ${0:function})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pl "Plot function"
|
|
||||||
plot(${1:${VISUAL:x}}, ${0:y})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ggp "ggplot2 plot"
|
|
||||||
ggplot(${1:${VISUAL:data}}, aes(${0:aesthetics}))
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fis "Fisher test"
|
|
||||||
fisher.test(${1:x}, ${0:y})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet chi "Chi Squared test"
|
|
||||||
chisq.test(${1:x}, ${0:y})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tt "t-test"
|
|
||||||
t.test(${1:x}, ${0:y})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet wil "Wilcox test"
|
|
||||||
wilcox.test(${1:x}, ${0:y})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cor "Correlation test"
|
|
||||||
cor.test(${1:x}, ${0:y})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fte "FTE test"
|
|
||||||
var.test(${1:x}, ${0:y})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet kvt "KV test"
|
|
||||||
kv.test(${1:x}, ${0:y})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
#################################
|
|
||||||
# easily create string vector #
|
|
||||||
#################################
|
|
||||||
# Given individual words separated by spaces
|
|
||||||
# Select words (e.g. shift-v for whole line (such as the line above)
|
|
||||||
# then press <Tab> then type "vec", press <Tab> again to get this:
|
|
||||||
# var <- c("#","Given","individual","words","separated","by","spaces")
|
|
||||||
# var <- c("#","type","out","individual","words","separated","by","spaces")
|
|
||||||
snippet vec
|
|
||||||
${1:var} <- c("${0:${VISUAL:/ /","/g}}")
|
|
||||||
endsnippet
|
|
|
@ -1,878 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
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?} \}}}
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tcbi "Create binary column"
|
|
||||||
t.binary :${1:title}${2:, limit: ${3:2}.megabytes}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tcb "Create boolean column"
|
|
||||||
t.boolean :${1:title}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet clac "Create controller class"
|
|
||||||
class ${1:Model}Controller < ApplicationController
|
|
||||||
before_action :find_${2:model}
|
|
||||||
|
|
||||||
$0
|
|
||||||
|
|
||||||
private
|
|
||||||
def find_$2
|
|
||||||
@$2 = ${3:$1}.find(params[:id]) if params[:id]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tcda "Create date column"
|
|
||||||
t.date :${1:title}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tcdt "Create datetime column"
|
|
||||||
t.datetime :${1:title}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tcd "Create decimal column"
|
|
||||||
t.decimal :${1:title}${2:${3:, precision: ${4:10}}${5:, scale: ${6:2}}}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tcf "Create float column"
|
|
||||||
t.float :${1:title}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet clact "Create functional test class"
|
|
||||||
require 'test_helper'
|
|
||||||
|
|
||||||
class ${1:Model}ControllerTest < ActionController::TestCase
|
|
||||||
test$0
|
|
||||||
end
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tci "Create integer column"
|
|
||||||
t.integer :${1:title}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tcl "Create lock_version column"
|
|
||||||
t.integer :lock_version, null: false, default: 0
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# FIXME: handling literal bracket pair inside of nested tab groups?
|
|
||||||
snippet tcr "Create references column"
|
|
||||||
t.references :${1:taggable}${2:, polymorphic: ${3:{ default: '${4:Photo}' }}}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet resources "Create resources controller class"
|
|
||||||
class ${1:Model}sController < ApplicationController
|
|
||||||
before_action :find_${1/./\l$0/}, only: [:show, :edit, :update, :destroy]
|
|
||||||
|
|
||||||
# GET /${1/./\l$0/}s
|
|
||||||
# GET /${1/./\l$0/}s.json
|
|
||||||
def index
|
|
||||||
@${1/./\l$0/}s = ${1:Model}.all
|
|
||||||
|
|
||||||
respond_to do |wants|
|
|
||||||
wants.html # index.html.erb
|
|
||||||
wants.json { render json: @${1/./\l$0/}s }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# GET /${1/./\l$0/}s/1
|
|
||||||
# GET /${1/./\l$0/}s/1.json
|
|
||||||
def show
|
|
||||||
respond_to do |wants|
|
|
||||||
wants.html # show.html.erb
|
|
||||||
wants.json { render json: @${1/./\l$0/} }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# GET /${1/./\l$0/}s/new
|
|
||||||
# GET /${1/./\l$0/}s/new.json
|
|
||||||
def new
|
|
||||||
@${1/./\l$0/} = ${1:Model}.new
|
|
||||||
|
|
||||||
respond_to do |wants|
|
|
||||||
wants.html # new.html.erb
|
|
||||||
wants.json { render json: @${1/./\l$0/} }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# GET /${1/./\l$0/}s/1/edit
|
|
||||||
def edit
|
|
||||||
end
|
|
||||||
|
|
||||||
# POST /${1/./\l$0/}s
|
|
||||||
# POST /${1/./\l$0/}s.json
|
|
||||||
def create
|
|
||||||
@${1/./\l$0/} = ${1:Model}.new(params[:${1/./\l$0/}])
|
|
||||||
|
|
||||||
respond_to do |wants|
|
|
||||||
if @${1/./\l$0/}.save
|
|
||||||
flash[:notice] = '${1:Model} was successfully created.'
|
|
||||||
wants.html { redirect_to(@${1/./\l$0/}) }
|
|
||||||
wants.json { render json: @${1/./\l$0/}, status: :created, location: @${1/./\l$0/} }
|
|
||||||
else
|
|
||||||
wants.html { render action: "new" }
|
|
||||||
wants.json { render json: @${1/./\l$0/}.errors, status: :unprocessable_entity }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# PUT /${1/./\l$0/}s/1
|
|
||||||
# PUT /${1/./\l$0/}s/1.json
|
|
||||||
def update
|
|
||||||
respond_to do |wants|
|
|
||||||
if @${1/./\l$0/}.update(params[:${1/./\l$0/}])
|
|
||||||
flash[:notice] = '${1:Model} was successfully updated.'
|
|
||||||
wants.html { redirect_to(@${1/./\l$0/}) }
|
|
||||||
wants.json { head :ok }
|
|
||||||
else
|
|
||||||
wants.html { render action: "edit" }
|
|
||||||
wants.json { render json: @${1/./\l$0/}.errors, status: :unprocessable_entity }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# DELETE /${1/./\l$0/}s/1
|
|
||||||
# DELETE /${1/./\l$0/}s/1.json
|
|
||||||
def destroy
|
|
||||||
@${1/./\l$0/}.destroy
|
|
||||||
|
|
||||||
respond_to do |wants|
|
|
||||||
wants.html { redirect_to(${1/./\l$0/}s_url) }
|
|
||||||
wants.json { head :ok }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
def find_${1/./\l$0/}
|
|
||||||
@${1/./\l$0/} = ${1:Model}.find(params[:id])
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tcs "Create string column"
|
|
||||||
t.string :${1:title}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tct "Create text column"
|
|
||||||
t.text :${1:title}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tcti "Create time column"
|
|
||||||
t.time :${1:title}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tcts "Create timestamp column"
|
|
||||||
t.timestamp :${1:title}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tctss "Create timestamps columns"
|
|
||||||
t.timestamps
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mcol "Migration Create Column (mcc)"
|
|
||||||
t.column ${1:title}, :${2:string}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mccc "Migration Create Column Continue (mccc)"
|
|
||||||
t.column ${1:title}, :${2:string}
|
|
||||||
mccc$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mtab "Migration Drop Create Table (mdct)"
|
|
||||||
drop_table :${1:table}${2: [press tab twice to generate create_table]}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mcol "Migration Remove and Add Column (mrac)"
|
|
||||||
remove_column :${1:table}, :${2:column}${3: [press tab twice to generate add_column]}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rdb "RAILS_DEFAULT_LOGGER.debug (rdb)"
|
|
||||||
RAILS_DEFAULT_LOGGER.debug "${1:message}"$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tre "Table column(s) rename"
|
|
||||||
t.rename(:${1:old_column_name}, :${2:new_column_name})
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet art "Test Assert Redirected To (art)"
|
|
||||||
assert_redirected_to ${2:action: "${1:index}"}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet asre "Test Assert Response (are)"
|
|
||||||
assert_response :${1:success}, @response.body$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet aftc "after_create"
|
|
||||||
after_create $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet aftd "after_destroy"
|
|
||||||
after_destroy $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet afts "after_save"
|
|
||||||
after_save $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet aftu "after_update"
|
|
||||||
after_update $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet aftv "after_validation"
|
|
||||||
after_validation $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet aftvoc "after_validation_on_create"
|
|
||||||
after_validation_on_create $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet aftvou "after_validation_on_update"
|
|
||||||
after_validation_on_update $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet asg "assert(var = assigns(:var))"
|
|
||||||
assert(${1:var} = assigns(:$1), "Cannot find @$1")
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet asd "assert_difference"
|
|
||||||
assert_difference "${1:Model}.${2:count}", ${3:1} do
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet asnd "assert_no_difference"
|
|
||||||
assert_no_difference "${1:Model}.${2:count}" do
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet artnpp "assert_redirected_to (nested path plural)"
|
|
||||||
assert_redirected_to ${10:${2:parent}_${3:child}_path(${4:@}${5:$2})}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet artnp "assert_redirected_to (nested path)"
|
|
||||||
assert_redirected_to ${2:${12:parent}_${13:child}_path(${14:@}${15:$12}, ${16:@}${17:$13})}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet artpp "assert_redirected_to (path plural)"
|
|
||||||
assert_redirected_to ${10:${2:model}s_path}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet artp "assert_redirected_to (path)"
|
|
||||||
assert_redirected_to ${2:${12:model}_path(${13:@}${14:$12})}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet asrj "assert_rjs"
|
|
||||||
assert_rjs :${1:replace}, ${2:"${3:dom id}"}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ass "assert_select"
|
|
||||||
assert_select '${1:path}'${2:, ${3:text}: ${4:'${5:inner_html}'}}${6: do
|
|
||||||
$0
|
|
||||||
end}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet befc "before_create"
|
|
||||||
before_create $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet befd "before_destroy"
|
|
||||||
before_destroy $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet befs "before_save"
|
|
||||||
before_save $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet befu "before_update"
|
|
||||||
before_update $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet befv "before_validation"
|
|
||||||
before_validation $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet befvoc "before_validation_on_create"
|
|
||||||
before_validation_on_create $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet befvou "before_validation_on_update"
|
|
||||||
before_validation_on_update
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet bt "belongs_to (bt)"
|
|
||||||
belongs_to :${1:object}${2:, class_name: "${3:${1/[[:alpha:]]+|(_)/(?1::\u$0)/g}}", foreign_key: "${4:$1_id}"}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet crw "cattr_accessor"
|
|
||||||
cattr_accessor :${0:attr_names}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet defcreate "def create - resource"
|
|
||||||
def create
|
|
||||||
@${1:model} = ${2:${1/[[:alpha:]]+|(_)/(?1::\u$0)/g}}.new(params[:$1])
|
|
||||||
$0
|
|
||||||
respond_to do |wants|
|
|
||||||
if @$1.save
|
|
||||||
flash[:notice] = '$2 was successfully created.'
|
|
||||||
wants.html { redirect_to(@$1) }
|
|
||||||
wants.json { render json: @$1, status: :created, location: @$1 }
|
|
||||||
else
|
|
||||||
wants.html { render action: "new" }
|
|
||||||
wants.json { render json: @$1.errors, status: :unprocessable_entity }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet test "test do..end"
|
|
||||||
test "${1:something interesting}" do
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet deftg "def get request"
|
|
||||||
def test_should_get_${1:action}
|
|
||||||
${2:@${3:model} = ${4:$3s}(:${5:fixture_name})
|
|
||||||
}get :$1${6:, id: @$3.to_param}
|
|
||||||
assert_response :success
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet deftp "def post request"
|
|
||||||
def test_should_post_${1:action}
|
|
||||||
${3:@$2 = ${4:$2s}(:${5:fixture_name})
|
|
||||||
}post :$1${6:, id: @$2.to_param}, ${2:model}: { $0 }
|
|
||||||
assert_response :redirect
|
|
||||||
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fina "find(:all)"
|
|
||||||
find(:all${1:, conditions: ['${2:${3:field} = ?}', ${5:true}]})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet finf "find(:first)"
|
|
||||||
find(:first${1:, conditions: ['${2:${3:field} = ?}', ${5:true}]})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fini "find(id)"
|
|
||||||
find(${1:id})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fine "find_each"
|
|
||||||
find_each(${1conditions: {:${2:field}: ${3:true}\}}) do |${4:${TM_CURRENT_WORD/(\w+)\./\L$1/g}}|
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet finb "find_in_batches"
|
|
||||||
find_in_batches(${1conditions: {:${2:field}: ${3:true}\}}) do |${4:${TM_CURRENT_WORD/(\w+)\./\L$1/g}}s|
|
|
||||||
$4s.each do |$4|
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet habtm "has_and_belongs_to_many (habtm)"
|
|
||||||
has_and_belongs_to_many :${1:object}${2:, join_table: "${3:table_name}", foreign_key: "${4:$1_id}"}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet hm "has_many (hm)"
|
|
||||||
has_many :${1:object}s${2:, class_name: "$1", foreign_key: "${4:reference}_id"}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet hmt "has_many (through)"
|
|
||||||
has_many :${1:objects}, through: :${2:join_association}${3:, source: :${4:$2_table_foreign_key_to_$1_table}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet hmd "has_many dependent: :destroy"
|
|
||||||
has_many :${1:object}s${2:, class_name: "$1", foreign_key: "${4:reference}_id"}, dependent: :destroy$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ho "has_one (ho)"
|
|
||||||
has_one :${1:object}${2:, class_name: "${3:${1/[[:alpha:]]+|(_)/(?1::\u$0)/g}}", foreign_key: "${4:$1_id}"}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet logd "logger.debug"
|
|
||||||
${1:Rails.}logger.debug { "${1:message}" }$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet loge "logger.error"
|
|
||||||
logger.error { "${1:message}" }$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet logf "logger.fatal"
|
|
||||||
logger.fatal { "${1:message}" }$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet logi "logger.info"
|
|
||||||
logger.info { "${1:message}" }$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet logw "logger.warn"
|
|
||||||
logger.warn { "${1:message}" }$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mp "map(&:sym_proc)"
|
|
||||||
map(&:${1:id})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mapca "map.catch_all"
|
|
||||||
${1:map}.catch_all "*${2:anything}", controller: "${3:default}", action: "${4:error}"
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet map "map.named_route"
|
|
||||||
${1:map}.${2:connect} '${3::controller/:action/:id}'
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mapr "map.resource"
|
|
||||||
${1:map}.resource :${2:resource}${10: do |${11:$2}|
|
|
||||||
$0
|
|
||||||
end}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet maprs "map.resources"
|
|
||||||
${1:map}.resources :${2:resource}${10: do |${11:$2}|
|
|
||||||
$0
|
|
||||||
end}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mapwo "map.with_options"
|
|
||||||
${1map}.with_options :${2:controller}: '${3:thing}' do |${4:$3}|
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mrw "mattr_accessor"
|
|
||||||
mattr_accessor :${0:attr_names}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ncl "named_scope lambda"
|
|
||||||
named_scope :name, lambda { |${1param}| { :conditions: ${3:['${4:${5:field} = ?}', ${6:$1}]} } }
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet nc "named_scope"
|
|
||||||
named_scope :name${1:, joins: :${2:table}}, conditions: ${3:['${4:${5:field} = ?}', ${6:true}]}
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet dscope "default_scope"
|
|
||||||
default_scope ${1:order(${2:'${3:created_at DESC}'})}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet flash "flash[...]"
|
|
||||||
flash[:${1:notice}] = "${2:Successfully created...}"$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rea "redirect_to (action)"
|
|
||||||
redirect_to action: "${1:index}"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet reai "redirect_to (action, id)"
|
|
||||||
redirect_to action: "${1:show}", id: ${0:@item}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rec "redirect_to (controller)"
|
|
||||||
redirect_to controller: "${1:items}"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet reca "redirect_to (controller, action)"
|
|
||||||
redirect_to controller: "${1:items}", action: "${2:list}"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet recai "redirect_to (controller, action, id)"
|
|
||||||
redirect_to controller: "${1:items}", action: "${2:show}", id: ${0:@item}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet renpp "redirect_to (nested path plural)"
|
|
||||||
redirect_to(${2:${10:parent}_${11:child}_path(${12:@}${13:$10})})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet renp "redirect_to (nested path)"
|
|
||||||
redirect_to(${2:${12:parent}_${13:child}_path(${14:@}${15:$12}, ${16:@}${17:$13})})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet repp "redirect_to (path plural)"
|
|
||||||
redirect_to(${2:${10:model}s_path})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rep "redirect_to (path)"
|
|
||||||
redirect_to(${2:${12:model}_path(${13:@}${14:$12})})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet reb "redirect_to :back"
|
|
||||||
redirect_to :back
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ra "render (action)... (ra)"
|
|
||||||
render action: "${1:action}"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ral "render (action,layout) (ral)"
|
|
||||||
render action: "${1:action}", layout: "${2:layoutname}"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rf "render (file) (rf)"
|
|
||||||
render file: "${1:filepath}"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rfu "render (file,use_full_path) (rfu)"
|
|
||||||
render file: "${1:filepath}", use_full_path: ${2:false}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ri "render (inline) (ri)"
|
|
||||||
render inline: "${1:<%= 'hello' %>}"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ril "render (inline,locals) (ril)"
|
|
||||||
render inline: "${1:<%= 'hello' %>}", locals { ${2::name}: "${3:value}"$4 }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rit "render (inline,type) (rit)"
|
|
||||||
render inline: "${1:<%= 'hello' %>}", type: ${2::rjson}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rl "render (layout) (rl)"
|
|
||||||
render layout: "${1:layoutname}"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rn "render (nothing) (rn)"
|
|
||||||
render nothing: ${1:true}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rns "render (nothing,status) (rns)"
|
|
||||||
render nothing: ${1:true}, status: ${2:401}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rt "render (text) (rt)"
|
|
||||||
render text: "${1:text to render...}"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rtl "render (text,layout) (rtl)"
|
|
||||||
render text: "${1:text to render...}", layout: "${2:layoutname}"
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rtlt "render (text,layout => true) (rtlt)"
|
|
||||||
render text: "${1:text to render...}", layout: ${2:true}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rts "render (text,status) (rts)"
|
|
||||||
render text: "${1:text to render...}", status: ${2:401}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ru "render (update)"
|
|
||||||
render :update do |${2:page}|
|
|
||||||
$2.$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rest "respond_to"
|
|
||||||
respond_to do |wants|
|
|
||||||
wants.${1:html}${2: { $0 }}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# FIXME
|
|
||||||
snippet returning "returning do |variable| ... end"
|
|
||||||
returning ${1:variable} do${2/(^(?<var>\s*[a-z_][a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1: |)/}${2:v}${2/(^(?<var>\s*[a-z_][a-zA-Z0-9_]*\s*)(,\g<var>)*,?\s*$)|.*/(?1:|)/}
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cmm "Create Migration Model Class"
|
|
||||||
class Migration${1/(?:^|_)(\w)/\u$1/g} < ApplicationRecord
|
|
||||||
self.table_name = :${1:model_name}s
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet t. "t.binary (tcbi)"
|
|
||||||
t.binary :${1:title}${2:, limit: ${3:2}.megabytes}
|
|
||||||
t.$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet t. "t.boolean (tcb)"
|
|
||||||
t.boolean :${1:title}
|
|
||||||
t.$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet t. "t.date (tcda)"
|
|
||||||
t.date :${1:title}
|
|
||||||
t.$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet t. "t.datetime (tcdt)"
|
|
||||||
t.datetime :${1:title}
|
|
||||||
t.$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet t. "t.decimal (tcd)"
|
|
||||||
t.decimal :${1:title}${2:${3:, precision: ${4:10}}${5:, scale: ${6:2}}}
|
|
||||||
t.$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet t. "t.float (tcf)"
|
|
||||||
t.float :${1:title}
|
|
||||||
t.$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet t. "t.integer (tci)"
|
|
||||||
t.integer :${1:title}
|
|
||||||
t.$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet t. "t.lock_version (tcl)"
|
|
||||||
t.integer :lock_version, null: false, default: 0
|
|
||||||
t.$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet t. "t.references (tcr)"
|
|
||||||
t.references :${1:taggable}${2:, polymorphic: ${3:{ default: '${4:Photo}' }}}
|
|
||||||
t.$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet t. "t.rename (tre)"
|
|
||||||
t.rename(:${1:old_column_name}, :${2:new_column_name})
|
|
||||||
t.$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet t. "t.string (tcs)"
|
|
||||||
t.string :${1:title}
|
|
||||||
t.$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet t. "t.text (tct)"
|
|
||||||
t.text :${1:title}
|
|
||||||
t.$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet t. "t.time (tcti)"
|
|
||||||
t.time :${1:title}
|
|
||||||
t.$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet t. "t.timestamp (tcts)"
|
|
||||||
t.timestamp :${1:title}
|
|
||||||
t.$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet t. "t.timestamps (tctss)"
|
|
||||||
t.timestamps
|
|
||||||
t.$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet vaoif "validates_acceptance_of if"
|
|
||||||
validates_acceptance_of :${1:terms}${2:${3:, accept: "${4:1}"}${5:, message: "${6:You must accept the terms of service}"}}, if: proc { |obj| ${7:obj.condition?} }}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet vao "validates_acceptance_of"
|
|
||||||
validates :${1:terms}${2:, acceptance: ${3:{ accept: "${4:1}"${5:, message: "${6:You must accept the terms of service}"}}} }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet va "validates_associated (va)"
|
|
||||||
validates_associated :${1:attribute}${2:, on: :${3:create}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet vaif "validates_associated if (vaif)"
|
|
||||||
validates_associated :${1:attribute}${2:, on: :${3:create}, if: proc { |obj| ${5:obj.condition?} }}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet vc "validates_confirmation_of (vc)"
|
|
||||||
validates_confirmation_of :${1:attribute}${2:, on: :${3:create}, message: "${4:should match confirmation}"}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet vcif "validates_confirmation_of if (vcif)"
|
|
||||||
validates_confirmation_of :${1:attribute}${2:, on: :${3:create}, message: "${4:should match confirmation}", if: proc { |obj| ${5:obj.condition?} }}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ve "validates_exclusion_of (ve)"
|
|
||||||
validates_exclusion_of :${1:attribute}${2:, in: ${3:%w( ${4:mov avi} )}, on: :${5:create}, message: "${6:extension %s is not allowed}"}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet veif "validates_exclusion_of if (veif)"
|
|
||||||
validates_exclusion_of :${1:attribute}${2:, in: ${3:%w( ${4:mov avi} )}, on: :${5:create}, message: "${6:extension %s is not allowed}"}, if: proc { |obj| ${7:obj.condition?} }}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet vfif "validates_format_of if"
|
|
||||||
validates_format_of :${1:attribute}, with: /${2:^[${3:\w\d}]+\$}/${4:, on: :${5:create}, message: "${6:is invalid}"}, if: proc { |obj| ${7:obj.condition?} }}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet vf "validates_format_of"
|
|
||||||
validates_format_of :${1:attribute}, with: /${2:^[${3:\w\d}]+\$}/${4:, on: :${5:create}, message: "${6:is invalid}"}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet viif "validates_inclusion_of if"
|
|
||||||
validates_inclusion_of :${1:attribute}${2:, in: ${3:%w( ${4:mov avi} )}, on: :${5:create}, message: "${6:extension %s is not included in the list}"}, if: proc { |obj| ${7:obj.condition?} }}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet vi "validates_inclusion_of"
|
|
||||||
validates_inclusion_of :${1:attribute}${2:, in: ${3:%w( ${4:mov avi} )}, on: :${5:create}, message: "${6:extension %s is not included in the list}"}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet vl "validates_length_of (vl)"
|
|
||||||
validates_length_of :${1:attribute}, within: ${2:3..20}${3:, on: :${4:create}, message: "${5:must be present}"}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet vlif "validates_length_of if"
|
|
||||||
validates_length_of :${1:attribute}, within: ${2:3..20}${3:, on: :${4:create}, message: "${5:must be present}"}, if: proc { |obj| ${6:obj.condition?} }}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet vnif "validates_numericality_of if"
|
|
||||||
validates_numericality_of :${1:attribute}${2:, on: :${3:create}, message: "${4:is not a number}"}, if: proc { |obj| ${5:obj.condition?} }}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet vn "validates_numericality_of"
|
|
||||||
validates_numericality_of :${1:attribute}${2:, on: :${3:create}, message: "${4:is not a number}"}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet vp "validates_presence_of (vp)"
|
|
||||||
validates_presence_of :${1:attribute}${2:, on: :${3:create}, message: "${4:can't be blank}"}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet vpif "validates_presence_of if (vpif) 2"
|
|
||||||
validates_presence_of :${1:attribute}${2:, on: :${3:create}, message: "${4:can't be blank}"}, if: proc { |obj| ${5:obj.condition?} }}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet vu "validates_uniqueness_of (vu)"
|
|
||||||
validates_uniqueness_of :${1:attribute}${2:, on: :${3:create}, message: "${4:must be unique}"}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet vuif "validates_uniqueness_of if (vuif)"
|
|
||||||
validates_uniqueness_of :${1:attribute}${2:, on: :${3:create}, message: "${4:must be unique}", if: proc { |obj| ${6:obj.condition?} }}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet verify "verify -- render"
|
|
||||||
verify only: [:$1], method: :post, render {:status: 500, text: "use HTTP-POST"}
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet verify "verify -- redirect"
|
|
||||||
verify only: [:$1], session: :user, params: :id, redirect_to {:action: '${2:index}'}
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet wants "wants_format"
|
|
||||||
wants.${1:js|json|html}${2: { $0 }}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet xdelete "xhr delete"
|
|
||||||
xhr :delete, :${1:destroy}, id: ${2:1}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet xget "xhr get"
|
|
||||||
xhr :get, :${1:show}${2:, id: ${3:1}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet xpost "xhr post"
|
|
||||||
xhr :post, :${1:create}, ${2:object}: { $3 }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet xput "xhr put"
|
|
||||||
xhr :put, :${1:update}, id: ${2:1}, ${3:object}: { $4 }$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet col "collection routes"
|
|
||||||
collection do
|
|
||||||
${1:get :${2:action}}
|
|
||||||
${3:put :${4:action}}
|
|
||||||
${5:post :${6:action}}
|
|
||||||
${7:delete :${8:action}}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet format "format (respond_with)"
|
|
||||||
format.${1:html|xml|json|js|any} { $0 }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet gem "gem"
|
|
||||||
gem '${1:name}'${2:${3:, "${4:1.0}"}${5:${6:, require: ${7:"${8:$1}"}}${9:, group: :${10:test}}}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet gemg "gem :git"
|
|
||||||
gem '${1:paperclip}', git: "${2:git://github.com/thoughtbot/paperclip.git}"${3:, branch: "${4:rails3}"}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet match "match"
|
|
||||||
match '${1:${2::controller}${3:/${4::action}${5:/${6::id}${7:(.:format)}}}}'${8: '${9:$2}#${10:$4}'${11:, as: :${12:$10}}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet member "member routes"
|
|
||||||
member do
|
|
||||||
${1:get :${2:action}}
|
|
||||||
${3:put :${4:action}}
|
|
||||||
${5:post :${6:action}}
|
|
||||||
${7:delete :${8:action}}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet res "resources"
|
|
||||||
resources :${1:posts}${2: do
|
|
||||||
$3
|
|
||||||
end}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet scope "scope"
|
|
||||||
scope :${1:name}, { ${2:joins(:${3:table}).}where(${4:'${5:$3.${6:field}} = ?', ${7:'${8:value}'}}) }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet scopel "scope lambda"
|
|
||||||
scope :${1:name}, lambda { |${2:param}| ${3:where(${4::${5:field}: ${6:"${7:value}"}})} }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet scopee "scope with extension"
|
|
||||||
scope :${1:name}, { ${2:where(${3::${4:field}: ${5:'${6:value}'}})} } do
|
|
||||||
def ${7:method_name}
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sb "scoped_by"
|
|
||||||
scoped_by_${1:attribute}(${2:id})
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet setup "setup do..end"
|
|
||||||
setup do
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet trans "Translation snippet"
|
|
||||||
I18n.t('`!v substitute(substitute(substitute(@%, substitute(getcwd() . "/", "\/", "\\\\/", "g"), "", ""), "\\(\\.\\(html\\|js\\)\\.\\(haml\\|erb\\)\\|\\(_controller\\)\\?\\.rb\\)$", "", ""), "/", ".", "g")`.${2:${1/[^\w]/_/g}}$3', default: "${1:some_text}"$4)${5:$0}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet route_spec
|
|
||||||
it 'routes to #${1:action}' do
|
|
||||||
${2:get}('/${3:url}').should route_to('`!v substitute(expand('%:t:r'), '_routing_spec$', '', '')`#$1'${4:, ${5:params}})$6
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -1,3 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
extends tex, r
|
|
|
@ -1,355 +0,0 @@
|
||||||
##############################################################################
|
|
||||||
# Robot Framework Snippets for UltiSnips #
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
priority -50
|
|
||||||
|
|
||||||
######################
|
|
||||||
# Built In library #
|
|
||||||
######################
|
|
||||||
snippet cat "Catenate"
|
|
||||||
\${${1:name}}= Catenate SEPARATOR=${2:---} ${3:Hello} ${4:world}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet eval "Evaluate"
|
|
||||||
\${${1:val}}= Evaluate ${2:${x} - 10}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet for "FOR loop" b
|
|
||||||
:FOR ${${1:element}} IN ${2:@{ELEMENTS}}
|
|
||||||
\ ${0:${VISUAL:Start Element}} ${$1}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet nop "No Operation"
|
|
||||||
No Operation
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rfk "Return From Keyword"
|
|
||||||
Return From Keyword ${1:${optional return value}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rfki "Return From Keyword If"
|
|
||||||
Return From Keyword If '\${${1:rc}}' != '${2:abc}' ${3:${optional return value}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rk "Run Keyword"
|
|
||||||
Run Keyword ${1:${kw}} ${2:${args}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rkacof "Run Keyword And Continue On Failure"
|
|
||||||
Run Keyword And Continue On Failure ${1:${kw}} ${2:${args}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rkaee "Run Keyword And Expect Error"
|
|
||||||
Run Keyword And Expect Error ${1:My error} ${2:${kw}} ${3:${args}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rkaie "Run Keyword And Ignore Error"
|
|
||||||
Run Keyword And Ignore Error ${1:${kw}} ${2:${args}}
|
|
||||||
\${${3:result}} \${${4:return_value}}= Run Keyword And Ignore Error ${1:${kw}} ${2:${args}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rkar "Run Keyword And Return"
|
|
||||||
Run Keyword And Return ${1:${kw}} ${2:${args}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rkari "Run Keyword And Return If"
|
|
||||||
Run Keyword And Return If '\${${1:rc}}' != '${2:abc}' ${3:${kw}} ${4:${args}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rkars "Run Keyword And Return Status"
|
|
||||||
\${${3:result}}= Run Keyword And Return Status ${1:${kw}} ${2:${args}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rki "Run Keyword If"
|
|
||||||
Run Keyword If '\${${1:rc}}' != '${2:abc}'
|
|
||||||
... ${3:${VISUAL:Some keyword returning a value}}
|
|
||||||
... ELSE IF '\${${4:str}}' != '${5:def}'
|
|
||||||
... ${6:Another keyword}
|
|
||||||
... ELSE
|
|
||||||
... ${7:Final keyword}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rkiactf "Run Keyword If Any Critical Tests Failed"
|
|
||||||
Run Keyword If Any Critical Tests Failed ${1:${kw}} ${2:${args}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rkiactp "Run Keyword If All Critical Tests Passed"
|
|
||||||
Run Keyword If All Critical Tests Passed ${1:${kw}} ${2:${args}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rkiatf "Run Keyword If Any Tests Failed"
|
|
||||||
Run Keyword If Any Tests Failed ${1:${kw}} ${2:${args}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rkiatp "Run Keyword If All Tests Passed"
|
|
||||||
Run Keyword If All Tests Passed ${1:${kw}} ${2:${args}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rkitf "Run Keyword If Test Failed"
|
|
||||||
Run Keyword If Test Failed ${1:${kw}} ${2:${args}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rkitp "Run Keyword If Test Passed"
|
|
||||||
Run Keyword If Test Passed ${1:${kw}} ${2:${args}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rkito "Run Keyword If Timeout Occurred"
|
|
||||||
Run Keyword If Timeout Occurred ${1:${kw}} ${2:${args}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rks "Run Keywords"
|
|
||||||
Run Keywords
|
|
||||||
... ${1:${VISUAL:Initialize database $\{DB NAME\}}} AND
|
|
||||||
... ${2:Clear logs}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rku "Run Keyword Unless"
|
|
||||||
Run Keyword Unless '\${${1:rc}}' != '${2:abc}' ${3:${kw}} ${4:${args}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sgv "Set Global Variable"
|
|
||||||
Set Global Variable \${${1:name}} ${2:${value}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sbe "Should Be Equal"
|
|
||||||
Should Be Equal "\${${1:var}}" "${2:expected value}" ${3:"optional error msg"} ${4:ignore_case=True}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sleep "Sleep"
|
|
||||||
Sleep ${1:2 minutes 10 seconds}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ssv "Set Suite Variable"
|
|
||||||
Set Suite Variable \${${1:name}} ${2:${value}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet stv "Set Test Variable"
|
|
||||||
Set Test Variable \${${1:name}} ${2:${value}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sv "Set Variable"
|
|
||||||
\${${1:name}}= Set Variable ${2:${value}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet svi "Set Variable If"
|
|
||||||
\${${1:var}}= Set Variable If '\${${2:rc}}' != '${3:abc}'
|
|
||||||
`!p snip.rv = '...' + ' ' * (len(t[1]) + 23)` ${4:${value true}}
|
|
||||||
`!p snip.rv = '...' + ' ' * (len(t[1]) + 23)` ${5:${value false}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet wuks "Wait Until Keyword Succeeds"
|
|
||||||
Wait Until Keyword Succeeds ${1:10x} ${2:2s} ${3:${VISUAL:Some Keyword}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
#####################
|
|
||||||
# Dialogs library #
|
|
||||||
#####################
|
|
||||||
snippet pause "Pause test execution"
|
|
||||||
Import library Dialogs
|
|
||||||
Pause execution
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tpause "Teardown Pause - pause test execution only on failure"
|
|
||||||
[Teardown] Run Keyword If Test Failed Run Keywords
|
|
||||||
... Import library Dialogs AND
|
|
||||||
... Pause execution
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Selenium2Library library #
|
|
||||||
##############################
|
|
||||||
snippet cps "Capture Page Screenshot"
|
|
||||||
Capture Page Screenshot ${1:${optional filename}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet esbd "Element Should Be Disabled"
|
|
||||||
Element Should Be Disabled \${${1:locator}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet esbe "Element Should Be Enabled"
|
|
||||||
Element Should Be Enabled ${${1:locator}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet esbf "Element Should Be Focused"
|
|
||||||
Element Should Be Focused ${${1:locator}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet esbv "Element Should Be Visible"
|
|
||||||
Element Should Be Visible ${${1:locator}} ${2:${optional message}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet esc "Element Should Contain"
|
|
||||||
Element Should Contain ${${1:locator}} ${2:${expected}} ${3:${optional message}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet esnbv "Element Should Not Be Visible"
|
|
||||||
Element Should Not Be Visible ${${1:locator}} ${2:${optional message}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet esnc "Element Should Not Contain"
|
|
||||||
Element Should Not Contain ${${1:locator}} ${2:${expected}} ${3:${optional message}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet etsb "Element Text Should Be"
|
|
||||||
Element Text Should Be ${${1:locator}} ${2:${expected}} ${3:${optional message}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet eaj "Execute Async Javascript"
|
|
||||||
Execute Async Javascript ${1:${code line 1}} ${2:${code line 2}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ej "Execute Javascript"
|
|
||||||
Execute Javascript ${1:${code line 1}} ${2:${code line 2}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet gwp "Get Window Position"
|
|
||||||
\${${1:x}} \${${2:y}}= Get Window Position
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet gws "Get Window Size"
|
|
||||||
\${${1:width}} \${${2:height}}= Get Window Size
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mbw "Maximize Browser Window"
|
|
||||||
Maximize Browser Window
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet md "Mouse Down"
|
|
||||||
Mouse Down ${${1:locator}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mdoi "Mouse Down On Image"
|
|
||||||
Mouse Down On Image ${1:${locator}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mdol "Mouse Down On Link"
|
|
||||||
Mouse Down On Link ${1:${locator}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mout "Mouse Out"
|
|
||||||
Mouse Out ${1:${locator}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mover "Mouse Over"
|
|
||||||
Mouse Over ${1:${locator}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mu "Mouse Up"
|
|
||||||
Mouse Up ${1:${locator}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ob "Open Browser"
|
|
||||||
Open Browser ${1:${url}} ${2:${browser=firefox}} ${3:${alias=None}} ${4:${remote_url=False}} ${5:${desired_capabilities=None}} ${6:${ff_profile_dir=None}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ocm "Open Context Menu"
|
|
||||||
Open Context Menu ${1:${locator}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet psc "Page Should Contain"
|
|
||||||
Page Should Contain ${1:${text}} ${2:loglevel=INFO}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pscb "Page Should Contain Button"
|
|
||||||
Page Should Contain Button ${1:${locator}} ${2:${message=}} ${3:loglevel=INFO}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pscc "Page Should Contain Checkbox"
|
|
||||||
Page Should Contain Checkbox ${1:${locator}} ${2:${message=}} ${3:loglevel=INFO}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet psce "Page Should Contain Element"
|
|
||||||
Page Should Contain Element ${1:${locator}} ${2:${message=}} ${3:loglevel=INFO}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet psci "Page Should Contain Image"
|
|
||||||
Page Should Contain Image ${1:${locator}} ${2:${message=}} ${3:loglevel=INFO}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pscl "Page Should Contain Link"
|
|
||||||
Page Should Contain Link ${1:${locator}} ${2:${message=}} ${3:loglevel=INFO}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pscrb "Page Should Contain Radio Button"
|
|
||||||
Page Should Contain Radio Button ${1:${locator}} ${2:${message=}} ${3:loglevel=INFO}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet psct "Page Should Contain Textfield"
|
|
||||||
Page Should Contain Textfield ${1:${locator}} ${2:${message=}} ${3:loglevel=INFO}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet psnc "Page Should Not Contain"
|
|
||||||
Page Should Not Contain ${1:${text}} ${2:loglevel=INFO}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet psncb "Page Should Not Contain Button"
|
|
||||||
Page Should Not Contain Button ${1:${locator}} ${2:${message=}} ${3:loglevel=INFO}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet psncc "Page Should Not Contain Checkbox"
|
|
||||||
Page Should Not Contain Checkbox ${1:${locator}} ${2:${message=}} ${3:loglevel=INFO}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet psnce "Page Should Not Contain Element"
|
|
||||||
Page Should Not Contain Element ${1:${locator}} ${2:${message=}} ${3:loglevel=INFO}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet psnci "Page Should Not Contain Image"
|
|
||||||
Page Should Not Contain Image ${1:${locator}} ${2:${message=}} ${3:loglevel=INFO}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet psncl "Page Should Not Contain Link"
|
|
||||||
Page Should Not Contain Link ${1:${locator}} ${2:${message=}} ${3:loglevel=INFO}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet psncrb "Page Should Not Contain Radio Button"
|
|
||||||
Page Should Not Contain Radio Button ${1:${locator}} ${2:${message=}} ${3:loglevel=INFO}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet psnct "Page Should Not Contain Textfield"
|
|
||||||
Page Should Not Contain Textfield ${1:${locator}} ${2:${message=}} ${3:loglevel=INFO}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rktrof "Register Keyword To Run On Failure"
|
|
||||||
Register Keyword To Run On Failure ${1:${kw}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet wuec "Wait Until Element Contains"
|
|
||||||
Wait Until Element Contains ${1:${locator}} ${2:${text}} ${3:${timeout=None}} ${4:${error=None}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet wuednc "Wait Until Element Does Not Contain"
|
|
||||||
Wait Until Element Does Not Contain ${1:${locator}} ${2:${text}} ${3:${timeout=None}} ${4:${error=None}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet wueie "Wait Until Element Is Enabled"
|
|
||||||
Wait Until Element Is Enabled ${1:${locator}} ${2:${timeout=None}} ${3:${error=None}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet wueinv "Wait Until Element Is Not Visible"
|
|
||||||
Wait Until Element Is Not Visible ${1:${locator}} ${2:${timeout=None}} ${3:${error=None}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet wueiv "Wait Until Element Is Visible"
|
|
||||||
Wait Until Element Is Visible ${1:${locator}} ${2:${timeout=None}} ${3:${error=None}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet wupc "Wait Until Page Contains"
|
|
||||||
Wait Until Page Contains ${1:${text}} ${2:${timeout=None}} ${3:${error=None}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet wupce "Wait Until Page Contains Element"
|
|
||||||
Wait Until Page Contains Element ${1:${locator}} ${2:${timeout=None}} ${3:${error=None}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet wupdnc "Wait Until Page Does Not Contain"
|
|
||||||
Wait Until Page Does Not Contain ${1:${text}} ${2:${timeout=None}} ${3:${error=None}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet wupdnce "Wait Until Page Does Not Contain Element"
|
|
||||||
Wait Until Page Does Not Contain Element ${1:${locator}} ${2:${timeout=None}} ${3:${error=None}}
|
|
||||||
endsnippet
|
|
||||||
|
|
|
@ -1,311 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
priority -50
|
|
||||||
|
|
||||||
###########################################################################
|
|
||||||
# General Stuff #
|
|
||||||
###########################################################################
|
|
||||||
global !p
|
|
||||||
from collections import Counter
|
|
||||||
from vimsnippets import complete, has_cjk, display_width
|
|
||||||
|
|
||||||
# http://docutils.sourceforge.net/docs/ref/rst/roles.html
|
|
||||||
TEXT_ROLES = ['emphasis', 'literal', 'code', 'math',
|
|
||||||
'pep-reference', 'rfc-reference',
|
|
||||||
'strong', 'subscript', 'superscript',
|
|
||||||
'title-reference', 'raw']
|
|
||||||
TEXT_ROLES_REGEX = r'\.\.\srole::?\s(w+)'
|
|
||||||
|
|
||||||
# http://docutils.sourceforge.net/docs/ref/rst/directives.html#specific-admonitions
|
|
||||||
SPECIFIC_ADMONITIONS = ["attention", "caution", "danger",
|
|
||||||
"error", "hint", "important", "note",
|
|
||||||
"tip", "warning"]
|
|
||||||
# http://docutils.sourceforge.net/docs/ref/rst/directives.html
|
|
||||||
DIRECTIVES = ['code', 'contents', 'admonition', 'table', 'csv-table', 'list-table',
|
|
||||||
'class', 'container', 'sidebar', 'topic', 'title',
|
|
||||||
'role', 'default-role', 'raw']
|
|
||||||
|
|
||||||
# DIRECTIVES_WITHOUT_TITLE means directive arguments equal None
|
|
||||||
DIRECTIVES_WITHOUT_TITLE = ['math', 'meta', 'parsed-literal', 'line-block',
|
|
||||||
'header', 'compound', 'highlights', 'pull-quote',
|
|
||||||
'footer', 'epigraph', 'rubric', 'sectnum']
|
|
||||||
|
|
||||||
INCLUDABLE_DIRECTIVES = ['image', 'figure', 'include']
|
|
||||||
|
|
||||||
# Directives for Subsubsection Definition
|
|
||||||
DIRECTIVES_FOR_SUBSTITUTION = ['replace', 'unicode', 'date']
|
|
||||||
|
|
||||||
# http://www.pygal.org/en/stable/documentation/types/index.html
|
|
||||||
CHART_TYPES = ["Line", "StackedLine", "HorizontalLine", "Bar", "StackedBar", "HorizontalBar", "Histogram", "XY", "DateLine", "TimeLine", "TimeDeltaLine", "DateTimeLine", "Pie", "Radar", "Box", "Dot", "Funnel", "Gauge", "SolidGauge", "Pyramid", "Treemap"]
|
|
||||||
|
|
||||||
def real_filename(filename):
|
|
||||||
"""pealeextension name off if possible
|
|
||||||
# i.e. "foo.bar.png will return "foo.bar"
|
|
||||||
"""
|
|
||||||
return os.path.splitext(filename)[0]
|
|
||||||
|
|
||||||
def check_file_exist(rst_path, relative_path):
|
|
||||||
"""
|
|
||||||
For RST file, it can just include files as relative path.
|
|
||||||
|
|
||||||
:param rst_path: absolute path to rst file
|
|
||||||
:param relative_path: path related to rst file
|
|
||||||
:return: relative file's absolute path if file exist
|
|
||||||
"""
|
|
||||||
abs_path = os.path.join(os.path.dirname(rst_path), relative_path)
|
|
||||||
if os.path.isfile(abs_path):
|
|
||||||
return abs_path
|
|
||||||
|
|
||||||
def make_items(times, leading='+'):
|
|
||||||
"""
|
|
||||||
make lines with leading char multitimes
|
|
||||||
|
|
||||||
:param: times, how many times you need
|
|
||||||
:param: leading, leading character
|
|
||||||
"""
|
|
||||||
times = int(times)
|
|
||||||
if leading == 1:
|
|
||||||
msg = ""
|
|
||||||
for x in range(1, times+1):
|
|
||||||
msg += "%s. Item\n" % x
|
|
||||||
return msg
|
|
||||||
else:
|
|
||||||
return ("%s Item\n" % leading) * times
|
|
||||||
|
|
||||||
|
|
||||||
def look_up_directives(regex, fpath):
|
|
||||||
"""
|
|
||||||
find all directive args in given file
|
|
||||||
:param: regex, the regex that needs to match
|
|
||||||
:param: path, to path to rst file
|
|
||||||
|
|
||||||
:return: list, empty list if nothing match
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
with open(fpath) as source:
|
|
||||||
match = re.findall(regex, source.read())
|
|
||||||
except IOError:
|
|
||||||
match = []
|
|
||||||
return match
|
|
||||||
|
|
||||||
|
|
||||||
def get_popular_code_type():
|
|
||||||
"""
|
|
||||||
find most popular code type in the given rst
|
|
||||||
|
|
||||||
:param path: file to detect
|
|
||||||
|
|
||||||
:return: string, most popular code type in file
|
|
||||||
"""
|
|
||||||
buf = "".join(vim.current.buffer)
|
|
||||||
types = re.findall(r'[:|\.\.\s]code::?\s(\w+)', buf)
|
|
||||||
try:
|
|
||||||
popular_type = Counter(types).most_common()[0][0]
|
|
||||||
except IndexError:
|
|
||||||
popular_type = "lua" # Don't break default
|
|
||||||
return popular_type
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
snippet part "Part" b
|
|
||||||
`!p snip.rv = display_width(t[1])*'#'`
|
|
||||||
${1:${VISUAL:Part name}}
|
|
||||||
`!p snip.rv = display_width(t[1])*'#'`
|
|
||||||
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet chap "Chapter" b
|
|
||||||
`!p snip.rv = display_width(t[1])*'*'`
|
|
||||||
${1:${VISUAL:Chapter name}}
|
|
||||||
`!p snip.rv = display_width(t[1])*'*'`
|
|
||||||
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sec "Section" b
|
|
||||||
${1:${VISUAL:Section name}}
|
|
||||||
`!p snip.rv = display_width(t[1])*'='`
|
|
||||||
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ssec "Subsection" b
|
|
||||||
${1:${VISUAL:Subsection name}}
|
|
||||||
`!p snip.rv = display_width(t[1])*'-'`
|
|
||||||
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sssec "Subsubsection" b
|
|
||||||
${1:${VISUAL:Subsubsection name}}
|
|
||||||
`!p snip.rv = display_width(t[1])*'^'`
|
|
||||||
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet para "Paragraph" b
|
|
||||||
${1:${VISUAL:Paragraph name}}
|
|
||||||
`!p snip.rv = display_width(t[1])*'"'`
|
|
||||||
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet em "Emphasize string" i
|
|
||||||
`!p
|
|
||||||
# dirty but works with CJK character detection
|
|
||||||
if has_cjk(vim.current.line):
|
|
||||||
snip.rv ="\ "`*${1:${VISUAL:Em}}*`!p
|
|
||||||
if has_cjk(vim.current.line):
|
|
||||||
snip.rv ="\ "
|
|
||||||
else:
|
|
||||||
snip.rv = " "
|
|
||||||
`$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet st "Strong string" i
|
|
||||||
`!p
|
|
||||||
if has_cjk(vim.current.line):
|
|
||||||
snip.rv ="\ "`**${1:${VISUAL:Strong}}**`!p
|
|
||||||
if has_cjk(vim.current.line):
|
|
||||||
snip.rv ="\ "
|
|
||||||
else:
|
|
||||||
snip.rv = " "
|
|
||||||
`$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "li(st)? (?P<num>\d+)" "List" br
|
|
||||||
$0
|
|
||||||
`!p
|
|
||||||
# usage: li 4<tab>
|
|
||||||
# which will extand into a unordered list contains 4 items
|
|
||||||
snip.rv = make_items(match.groupdict()['num'])
|
|
||||||
`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "ol(st)? (?P<num>\d+)" "Order List" br
|
|
||||||
$0
|
|
||||||
`!p
|
|
||||||
# usage: ol 4<tab>
|
|
||||||
# which will extand into a ordered list contains 4 items
|
|
||||||
snip.rv = make_items(match.groupdict()['num'], 1)
|
|
||||||
`
|
|
||||||
endsnippet
|
|
||||||
###########################################################################
|
|
||||||
# More Specialized Stuff. #
|
|
||||||
###########################################################################
|
|
||||||
snippet cb "Code Block" b
|
|
||||||
.. code-block:: ${1:`!p snip.rv = get_popular_code_type()`}
|
|
||||||
|
|
||||||
${2:${VISUAL:code}}
|
|
||||||
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# match snippets :
|
|
||||||
# img, inc, fig
|
|
||||||
snippet id "Includable Directives" b
|
|
||||||
`!p
|
|
||||||
real_name=real_filename(os.path.basename(t[2]))
|
|
||||||
di=t[1][:2]
|
|
||||||
|
|
||||||
link=""
|
|
||||||
content=""
|
|
||||||
|
|
||||||
if di == 'im':
|
|
||||||
link = "|{0}|".format(real_name)
|
|
||||||
|
|
||||||
if di == 'fi':
|
|
||||||
content="""
|
|
||||||
:alt: {0}
|
|
||||||
|
|
||||||
{0}""".format(real_name)
|
|
||||||
`
|
|
||||||
..`!p snip.rv = " %s" % link if link else ""` $1`!p
|
|
||||||
snip.rv=complete(t[1], INCLUDABLE_DIRECTIVES)
|
|
||||||
`:: ${2:${VISUAL:file}}`!p
|
|
||||||
if content:
|
|
||||||
snip.rv +=" "+content`
|
|
||||||
`!p
|
|
||||||
# Tip of whether file is exist in comment type
|
|
||||||
if not check_file_exist(path, t[2]):
|
|
||||||
snip.rv='.. FILE {0} does not exist'.format(t[2])
|
|
||||||
else:
|
|
||||||
snip.rv=""
|
|
||||||
`$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet di "Directives" b
|
|
||||||
.. $1`!p snip.rv=complete(t[1], DIRECTIVES)`:: $2
|
|
||||||
|
|
||||||
${3:${VISUAL:Content}}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet dt "Directives without title" b
|
|
||||||
.. $1`!p snip.rv=complete(t[1], DIRECTIVES_WITHOUT_TITLE)`::
|
|
||||||
|
|
||||||
${2:${VISUAL:Content}}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ds "Directives for subscription" b
|
|
||||||
.. |$1| $2`!p snip.rv=complete(t[2], DIRECTIVES_FOR_SUBSTITUTION)`:: ${3:Content}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sa "Specific Admonitions" b
|
|
||||||
.. $1`!p snip.rv =complete(t[1], SPECIFIC_ADMONITIONS)`:: $2
|
|
||||||
|
|
||||||
${3:${VISUAL:Content}}
|
|
||||||
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# it will be trigger at start of line or after a word
|
|
||||||
snippet ro "Text Roles" w
|
|
||||||
\ :$1`!p snip.rv=complete(t[1],
|
|
||||||
TEXT_ROLES+look_up_directives(TEXT_ROLES_REGEX,
|
|
||||||
path))`:\`$2\`\
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet eu "Embedded URI" i
|
|
||||||
`!p
|
|
||||||
if has_cjk(vim.current.line):
|
|
||||||
snip.rv = "\ "`\`${1:${VISUAL:Text}} <${2:URI}>\`_`!p
|
|
||||||
if has_cjk(vim.current.line):
|
|
||||||
snip.rv ="\ "
|
|
||||||
else:
|
|
||||||
snip.rv = ""
|
|
||||||
`$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fnt "Footnote or Citation" i
|
|
||||||
[${1:Label}]_ $0
|
|
||||||
|
|
||||||
.. [$1] ${2:Reference}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Only for Nikola — Static Site Generator
|
|
||||||
snippet chart "Pygal chart for Nikola" b
|
|
||||||
.. chart:: $1`!p snip.rv=complete(t[1], CHART_TYPES)`
|
|
||||||
:title: '${2:Browser usage evolution (in %)}'
|
|
||||||
:x_labels: [${3:"2002", "2003", "2004", "2005", "2006", "2007"}]
|
|
||||||
|
|
||||||
'Firefox', [None, None, 0, 16.6, 25, 31]
|
|
||||||
'Chrome', [None, None, None, None, None, None]
|
|
||||||
'IE', [85.8, 84.6, 84.7, 74.5, 66, 58.6]
|
|
||||||
'Others', [14.2, 15.4, 15.3, 8.9, 9, 10.4]
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
############
|
|
||||||
# Sphinx #
|
|
||||||
############
|
|
||||||
|
|
||||||
snippet sid "SideBar" b
|
|
||||||
.. sidebar:: ${1:SideBar Title}
|
|
||||||
|
|
||||||
${2:${VISUAL:SideBar Content}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim:set list noet sts=0 sw=4 ts=4:
|
|
|
@ -1,341 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
#
|
|
||||||
# Global functions
|
|
||||||
#
|
|
||||||
|
|
||||||
global !p
|
|
||||||
|
|
||||||
def write_instance_vars(arglist, snip):
|
|
||||||
args = str(arglist).split(',')
|
|
||||||
for arg in args:
|
|
||||||
name = arg.strip().replace(':', ' ').split(' ', 1)[0]
|
|
||||||
if name:
|
|
||||||
snip += ' @{} = {}'.format(name, name)
|
|
||||||
else:
|
|
||||||
snip += ''
|
|
||||||
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
#
|
|
||||||
# Snippets
|
|
||||||
#
|
|
||||||
|
|
||||||
snippet #! "#!/usr/bin/env ruby" b
|
|
||||||
#!/usr/bin/env ruby
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "^# ?[uU][tT][fF]-?8" "# encoding: UTF-8" r
|
|
||||||
# encoding: UTF-8
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "\b(de)?f" "def <name>..." r
|
|
||||||
def ${1:function_name}${2:(${3:*args})}
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet defi "def initialize ..."
|
|
||||||
def initialize($1)`!p write_instance_vars(t[1],snip)`$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet defr "def <name> ... rescue ..."
|
|
||||||
def ${1:function_name}${2:(${3:*args})}
|
|
||||||
$4
|
|
||||||
rescue
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet For "(<from>..<to>).each { |<i>| <block> }"
|
|
||||||
(${1:from}..${2:to}).each { |${3:i}| $0 }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.Merge!" ".merge!(<other_hash>) { |<key>,<oldval>,<newval>| <block> }" r
|
|
||||||
`!p snip.rv=match.group(1)`.merge!(${1:other_hash}) { |${2:key},${3:oldval},${4:newval}| ${5:block} }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.merge!" ".merge!(<other_hash>) do |<key>,<oldval>,<newval>| <block> end" r
|
|
||||||
`!p snip.rv=match.group(1)`.merge!(${1:other_hash}) do |${2:key},${3:oldval},${4:newval}|
|
|
||||||
${0:block}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.Del(ete)?_?if" ".delete_if { |<key>,<value>| <block> }" r
|
|
||||||
`!p snip.rv=match.group(1)`.delete_if { |${1:key},${2:value}| $0 }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.del(ete)?_?if" ".delete_if do |<key>,<value>| <block> end" r
|
|
||||||
`!p snip.rv=match.group(1)`.delete_if do |${1:key},${2:value}|
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.Keep_?if" ".keep_if { |<key>,<value>| <block> }" r
|
|
||||||
`!p snip.rv=match.group(1)`.keep_if { |${1:key},${2:value}| $0 }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.keep_?if" ".keep_if do <key>,<value>| <block> end" r
|
|
||||||
`!p snip.rv=match.group(1)`.keep_if do |${1:key},${2:value}|
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.Reject" ".reject { |<key>,<value>| <block> }" r
|
|
||||||
`!p snip.rv=match.group(1)`.reject { |${1:key},${2:value}| $0 }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.reject" ".reject do <key>,<value>| <block> end" r
|
|
||||||
`!p snip.rv=match.group(1)`.reject do |${1:key},${2:value}|
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.Select" ".select { |<item>| <block>}" r
|
|
||||||
`!p snip.rv=match.group(1)`.select { |${1:item}| ${2:block} }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.select" ".select do |<item>| <block> end" r
|
|
||||||
`!p snip.rv=match.group(1)`.select do |${1:item}|
|
|
||||||
${0:block}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.Sort" ".sort { |<a>,<b>| <block> }" r
|
|
||||||
`!p snip.rv=match.group(1)`.sort { |${1:a},${2:b}| $0 }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.sort" ".sort do |<a>,<b>| <block> end" r
|
|
||||||
`!p snip.rv=match.group(1)`.sort do |${1:a},${2:b}|
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.Each_?k(ey)?" ".each_key { |<key>| <block> }" r
|
|
||||||
`!p snip.rv=match.group(1)`.each_key { |${1:key}| $0 }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.each_?k(ey)?" ".each_key do |key| <block> end" r
|
|
||||||
`!p snip.rv=match.group(1)`.each_key do |${1:key}|
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.Each_?val(ue)?" ".each_value { |<value>| <block> }" r
|
|
||||||
`!p snip.rv=match.group(1)`.each_value { |${1:value}| $0 }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.each_?val(ue)?" ".each_value do |<value>| <block> end" r
|
|
||||||
`!p snip.rv=match.group(1)`.each_value do |${1:value}|
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.ea" "<elements>.each do |<element>| <block> end" r
|
|
||||||
`!p snip.rv=match.group(1)`.each { |${1:e}| $0 }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.ead" "<elements>.each do |<element>| <block> end" r
|
|
||||||
`!p snip.rv=match.group(1)`.each do |${1:e}|
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "each_?s(lice)?" "<array>.each_slice(n) do |slice| <block> end" r
|
|
||||||
${1:elements}.each_slice(${2:2}) do |${3:slice}|
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "Each_?s(lice)?" "<array>.each_slice(n) { |slice| <block> }" r
|
|
||||||
${1:elements}.each_slice(${2:2}) { |${3:slice}| $0 }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.Map" ".map { |<element>| <block> }" r
|
|
||||||
`!p snip.rv=match.group(1)`.map { |${1:`!p
|
|
||||||
element_name = match.group(1).lstrip('$@')
|
|
||||||
ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name)
|
|
||||||
try:
|
|
||||||
wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1))
|
|
||||||
snip.rv = wmatch.group(1).lower()
|
|
||||||
except:
|
|
||||||
snip.rv = 'element'
|
|
||||||
`}| $0 }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.map" ".map do |<element>| <block> end" r
|
|
||||||
`!p snip.rv=match.group(1)`.map do |${1:`!p
|
|
||||||
element_name = match.group(1).lstrip('$@')
|
|
||||||
ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name)
|
|
||||||
try:
|
|
||||||
wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1))
|
|
||||||
snip.rv = wmatch.group(1).lower()
|
|
||||||
except:
|
|
||||||
snip.rv = 'element'
|
|
||||||
`}|
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.Rev(erse)?_?each" ".reverse_each { |<element>| <block> }" r
|
|
||||||
`!p snip.rv=match.group(1)`.reverse_each { |${1:`!p
|
|
||||||
element_name = match.group(1).lstrip('$@')
|
|
||||||
ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name)
|
|
||||||
try:
|
|
||||||
wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1))
|
|
||||||
snip.rv = wmatch.group(1).lower()
|
|
||||||
except:
|
|
||||||
snip.rv = 'element'
|
|
||||||
`}| $0 }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.rev(erse)?_?each" ".reverse_each do |<element>| <block> end" r
|
|
||||||
`!p snip.rv=match.group(1)`.reverse_each do |${1:`!p
|
|
||||||
element_name = match.group(1).lstrip('$@')
|
|
||||||
ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name)
|
|
||||||
try:
|
|
||||||
wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1))
|
|
||||||
snip.rv = wmatch.group(1).lower()
|
|
||||||
except:
|
|
||||||
snip.rv = 'element'
|
|
||||||
`}|
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.Each" ".each { |<element>| <block> }" r
|
|
||||||
`!p snip.rv=match.group(1)`.each { |${1:`!p
|
|
||||||
element_name = match.group(1).lstrip('$@')
|
|
||||||
ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name)
|
|
||||||
try:
|
|
||||||
wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1))
|
|
||||||
snip.rv = wmatch.group(1).lower()
|
|
||||||
except:
|
|
||||||
snip.rv = 'element'
|
|
||||||
`}| $0 }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.each" ".each do |<element>| <block> end" r
|
|
||||||
`!p snip.rv=match.group(1)`.each do |${1:`!p
|
|
||||||
element_name = match.group(1).lstrip('$@')
|
|
||||||
ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name)
|
|
||||||
try:
|
|
||||||
wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1))
|
|
||||||
snip.rv = wmatch.group(1).lower()
|
|
||||||
except:
|
|
||||||
snip.rv = 'element'
|
|
||||||
`}|
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.Each_?p(air)?" ".each_pair { |<key>,<value>| <block> }" r
|
|
||||||
`!p snip.rv=match.group(1)`.each_pair { |${1:key},${2:value}| $0 }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.each_?p(air)?" ".each_pair do |<key>,<value>| <block> end" r
|
|
||||||
`!p snip.rv=match.group(1)`.each_pair do |${1:key},${2:value}|
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.sub" ".sub(<expression>) { <block> }" r
|
|
||||||
`!p snip.rv=match.group(1)`.sub(${1:expression}) { ${2:"replace_with"} }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.gsub" ".gsub(<expression>) { <block> }" r
|
|
||||||
`!p snip.rv=match.group(1)`.gsub(${1:expression}) { ${2:"replace_with"} }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.index" ".index { |item| <block> }" r
|
|
||||||
`!p snip.rv=match.group(1)`.index { |${1:item}| ${2:block} }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.Index" ".index do |item| ... end" r
|
|
||||||
`!p snip.rv=match.group(1)`.index do |${1:item}|
|
|
||||||
${0:block}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet until "until <expression> ... end"
|
|
||||||
until ${1:expression}
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet Until "begin ... end until <expression>"
|
|
||||||
begin
|
|
||||||
$0
|
|
||||||
end until ${1:expression}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet while "while <expression> ... end"
|
|
||||||
while ${1:expression}
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet While "begin ... end while <expression>"
|
|
||||||
begin
|
|
||||||
$0
|
|
||||||
end while ${1:expression}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet begin "begin ... rescue ... end"
|
|
||||||
begin
|
|
||||||
$1
|
|
||||||
rescue
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rescue
|
|
||||||
rescue Exception => e
|
|
||||||
puts e.message
|
|
||||||
puts e.backtrace.inspect
|
|
||||||
${0:# Rescue}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "\b(case|sw(itch)?)" "case <variable> when <expression> ... end" r
|
|
||||||
case ${1:variable}
|
|
||||||
when ${2:expression}
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet class "class <class_name> def initialize ... end end"
|
|
||||||
class ${1:`!p snip.rv = snip.basename.title().replace('_', '')`}
|
|
||||||
def initialize(${2:*args})
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet module "module"
|
|
||||||
module ${1:`!p snip.rv = snip.basename.title().replace('_', '')`}
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ###
|
|
||||||
=begin
|
|
||||||
$0
|
|
||||||
=end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet priv "private " m
|
|
||||||
private
|
|
||||||
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet prot "protected" m
|
|
||||||
protected
|
|
||||||
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim: set ts=2 sw=2 expandtab:
|
|
|
@ -1,53 +0,0 @@
|
||||||
#######################################################################
|
|
||||||
# Rust Snippets #
|
|
||||||
#######################################################################
|
|
||||||
|
|
||||||
priority -50
|
|
||||||
|
|
||||||
snippet fn "fn name(?) -> ? {}"
|
|
||||||
fn ${1:function_name}($2)${3/..*/ -> /}$3 {
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pfn "pub fn name(?) -> ? {}"
|
|
||||||
pub fn ${1:function_name}($2)${3/..*/ -> /}$3 {
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet afn "async fn name(?) -> ? {}"
|
|
||||||
async fn ${1:function_name}($2)${3/..*/ -> /}$3 {
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pafn "pub async fn name(?) -> ? {}"
|
|
||||||
pub async fn ${1:function_name}($2)${3/..*/ -> /}$3 {
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pri "print!(..)" b
|
|
||||||
print!("$1"${2/..*/, /}$2);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pln "println!(..)" b
|
|
||||||
println!("$1"${2/..*/, /}$2);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fmt "format!(..)"
|
|
||||||
format!("$1"${2/..*/, /}$2);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet .it ".iter()" i
|
|
||||||
.iter()$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet impl "Struct/Trait implementation" b
|
|
||||||
impl$4 ${1:Type/Trait}${2: for ${3:Type}}${4:<${5:T}>} {
|
|
||||||
${0}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -1,106 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
global !p
|
|
||||||
import vim
|
|
||||||
|
|
||||||
# Tests for the existence of a variable declared by Vim's filetype detection
|
|
||||||
# suggesting the type of shell script of the current file
|
|
||||||
def testShell(scope, shell):
|
|
||||||
return vim.eval("exists('" + scope + ":is_" + shell + "')")
|
|
||||||
|
|
||||||
# Loops over the possible variables, checking for global variables
|
|
||||||
# first since they indicate an override by the user.
|
|
||||||
def getShell():
|
|
||||||
for scope in ["g", "b"]:
|
|
||||||
for shell in ["bash", "posix", "sh", "kornshell"]:
|
|
||||||
if testShell(scope, shell) == "1":
|
|
||||||
if shell == "kornshell":
|
|
||||||
return "ksh"
|
|
||||||
if shell == "posix":
|
|
||||||
return "sh"
|
|
||||||
return shell
|
|
||||||
return "sh"
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
###########################################################################
|
|
||||||
# TextMate Snippets #
|
|
||||||
###########################################################################
|
|
||||||
snippet #! "#!/usr/bin/env (!env)" b
|
|
||||||
`!p snip.rv = '#!/usr/bin/env ' + getShell() + "\n" `
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sbash "safe bash options" b
|
|
||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
IFS=$'\n\t'
|
|
||||||
`!p snip.rv ='\n\n' `
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet temp "Tempfile" b
|
|
||||||
${1:TMPFILE}="$(mktemp -t ${3:--suffix=${4:.SUFFIX}} ${2:`!p
|
|
||||||
snip.rv = re.sub(r'[^a-zA-Z]', '_', snip.fn) or "untitled"
|
|
||||||
`}.XXXXXX)"
|
|
||||||
${5:${6/(.+)/trap "/}${6:rm -f '$${1/.*\s//}'}${6/(.+)/" 0 # EXIT\n/}${7/(.+)/trap "/}${7:rm -f '$${1/.*\s//}'; exit 1}${7/(.+)/" 2 # INT\n/}${8/(.+)/trap "/}${8:rm -f '$${1/.*\s//}'; exit 1}${8/(.+)/" 1 15 # HUP TERM\n/}}
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet /case|sw(itch)?/ "case .. esac (case)" rb
|
|
||||||
case ${1:word} in
|
|
||||||
${2:pattern} )
|
|
||||||
${0:${VISUAL}};;
|
|
||||||
esac
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet elif "elif .. (elif)" b
|
|
||||||
elif ${2:[[ ${1:condition} ]]}; then
|
|
||||||
${0:${VISUAL}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet for "for ... done (for)" b
|
|
||||||
for (( i = 0; i < ${1:10}; i++ )); do
|
|
||||||
${0:${VISUAL}}
|
|
||||||
done
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet forin "for ... in ... done (forin)" b
|
|
||||||
for ${1:i}${2/.+/ in /}${2:words}; do
|
|
||||||
${0:${VISUAL}}
|
|
||||||
done
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet here "here document (here)"
|
|
||||||
<<-${2:'${1:TOKEN}'}
|
|
||||||
$0`echo \\n`${1/['"`](.+)['"`]/$1/}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet /ift(est)?/ "if ... then (if)" rb
|
|
||||||
if ${2:[ ${1:condition} ]}; then
|
|
||||||
${0:${VISUAL}}
|
|
||||||
fi
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet if "if ... then (if)" b
|
|
||||||
if [[ ${1:condition} ]]; then
|
|
||||||
${0:${VISUAL}}
|
|
||||||
fi
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet until "until ... (done)" b
|
|
||||||
until ${2:[[ ${1:condition} ]]}; do
|
|
||||||
${0:${VISUAL}}
|
|
||||||
done
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet /wh(ile)?/ "while ... (done)" rb
|
|
||||||
while ${2:[[ ${1:condition} ]]}; do
|
|
||||||
${0:${VISUAL}}
|
|
||||||
done
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet func "function() {...}" b
|
|
||||||
${1:function} () {
|
|
||||||
${0:${VISUAL}}
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -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
|
|
|
@ -1,21 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
# We use a little hack so that the snippet is expanded
|
|
||||||
# and parsed correctly
|
|
||||||
snippet snip "Ultisnips snippet definition" b
|
|
||||||
`!p snip.rv = "snippet"` ${1:Tab_trigger} "${2:Description}" ${3:options}
|
|
||||||
${0:${VISUAL}}
|
|
||||||
`!p snip.rv = "endsnippet"`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet global "Global snippet" b
|
|
||||||
`!p snip.rv = "global"` !p
|
|
||||||
${0:${VISUAL}}
|
|
||||||
`!p snip.rv = "endglobal"`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet vis "${VISUAL}" i
|
|
||||||
\$\{VISUAL${1:${2:default}${3:/transform/}}\}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -1,63 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
extends html
|
|
||||||
|
|
||||||
snippet ns "Namespace" b
|
|
||||||
{namespace ${1:name}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tmpl "Template" b
|
|
||||||
/**
|
|
||||||
* ${2:TODO(`whoami`): Describe this template.}
|
|
||||||
*/
|
|
||||||
{template .${1:name}}
|
|
||||||
$0
|
|
||||||
{/template}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet msg "Message" b
|
|
||||||
{msg desc="${1:description}"}
|
|
||||||
$0
|
|
||||||
{/msg}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet let "let command" b
|
|
||||||
{let $${1:identifier}: ${2:expression} /}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet if "if .. (if)" b
|
|
||||||
{if ${1:expression}}
|
|
||||||
$0
|
|
||||||
{/if}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ife "if .. else (ife)" b
|
|
||||||
{if ${1:expression}}
|
|
||||||
$2
|
|
||||||
{else}
|
|
||||||
$0
|
|
||||||
{/if}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet eli "else if .. (eli)" b
|
|
||||||
{elif ${1:expression}}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fore "foreach command" b
|
|
||||||
{foreach $${1:var} in ${2:ref}}
|
|
||||||
$0
|
|
||||||
{/foreach}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet for "for command" b
|
|
||||||
{for $${1:var} in range(${2:rangeexpr})}
|
|
||||||
$0
|
|
||||||
{/for}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet call "template call" b
|
|
||||||
{call ${1:tmpl}}
|
|
||||||
$0
|
|
||||||
{/call}
|
|
||||||
endsnippet
|
|
|
@ -1,10 +0,0 @@
|
||||||
snippet for
|
|
||||||
for (${1:1}, ${2:10}) {${3: |i}|}
|
|
||||||
$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
snippet sdef
|
|
||||||
SynthDef(\\${1:synthName}, {${2: |${3:x}|}
|
|
||||||
$0
|
|
||||||
}).add;
|
|
||||||
endsnippet
|
|
|
@ -1 +0,0 @@
|
||||||
extends html, javascript, css
|
|
|
@ -1,52 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
###########################################################################
|
|
||||||
# TEXTMATE SNIPPETS #
|
|
||||||
###########################################################################
|
|
||||||
snippet for "for... (for)" b
|
|
||||||
for {${1:set i 0}} {${2:\$i < \$n}} {${3:incr i}} {
|
|
||||||
$4
|
|
||||||
}
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet foreach "foreach... (foreach)"
|
|
||||||
foreach ${1:var} ${2:\$list} {
|
|
||||||
$3
|
|
||||||
}
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet if "if... (if)" b
|
|
||||||
if {${1:condition}} {
|
|
||||||
$2
|
|
||||||
}
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet proc "proc... (proc)" b
|
|
||||||
proc ${1:name} {${2:args}} \
|
|
||||||
{
|
|
||||||
$3
|
|
||||||
}
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet switch "switch... (switch)" b
|
|
||||||
switch ${1:-exact} -- ${2:\$var} {
|
|
||||||
${3:match} {
|
|
||||||
$4
|
|
||||||
}
|
|
||||||
default {$5}
|
|
||||||
}
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet while "while... (while)" b
|
|
||||||
while {${1:condition}} {
|
|
||||||
$2
|
|
||||||
}
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -1,32 +0,0 @@
|
||||||
# A collection of snippets for use with the beamer class
|
|
||||||
|
|
||||||
|
|
||||||
snippet fmm "Beamer frame environment" bA
|
|
||||||
\begin{frame}
|
|
||||||
\frametitle{${1:title}}
|
|
||||||
$0
|
|
||||||
\end{frame}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet bll "Block environment" bA
|
|
||||||
\begin{block}{${1:title}}
|
|
||||||
$0
|
|
||||||
\end{block}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet cols "Beamer columns environment" bA
|
|
||||||
\begin{columns}
|
|
||||||
$0
|
|
||||||
\end{columns}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet coll "\column{} (for use with beamer)" bA
|
|
||||||
\column{$1}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ps "\pause (for beamer)"
|
|
||||||
\pause
|
|
||||||
endsnippet
|
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
# Delimiters
|
|
||||||
global !p
|
|
||||||
def notmath():
|
|
||||||
return vim.eval('vimtex#syntax#in_mathzone()') != '1'
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
# set priority 2 to override snippets in all.snippets
|
|
||||||
priority 2
|
|
||||||
snippet "(^|[\W])\\\{" "Escaped curly braces \{ ... \}" rA
|
|
||||||
`!p snip.rv = match.group(1)`\\{ ${1:${VISUAL:}} \\}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([^a-zA-Z])l\(" "Left/Right parentheses" rA
|
|
||||||
`!p snip.rv = match.group(1)`\left( ${1:${VISUAL:}} \right)$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([^a-zA-Z])l\[" "Left/Right square brackets" rA
|
|
||||||
`!p snip.rv = match.group(1)`\left[ ${1:${VISUAL:}} \right]$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([^a-zA-Z])l\{" "Left/Right curly braces" rA
|
|
||||||
`!p snip.rv = match.group(1)`\left\\{ ${1:${VISUAL:}} \right\\}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# turns b( into big( big) and
|
|
||||||
# turns B( into Big( Big)
|
|
||||||
snippet "([^a-zA-Z])([bB])\(" "(bB)ig/(bB)ig parentheses" rA
|
|
||||||
`!p snip.rv = match.group(1)`\\`!p snip.rv = match.group(2)`ig( ${1:${VISUAL:}} \\`!p snip.rv = match.group(2)`ig)$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([^a-zA-Z])([bB])\[" "(bB)ig/(bB)ig square brackets" rA
|
|
||||||
`!p snip.rv = match.group(1)`\\`!p snip.rv = match.group(2)`ig[ ${1:${VISUAL:}} \\`!p snip.rv = match.group(2)`ig]$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([^a-zA-Z])([bB])\{" "(bB)ig/(bB)ig curly brackets" rA
|
|
||||||
`!p snip.rv = match.group(1)`\\`!p snip.rv = match.group(2)`ig\\{ ${1:${VISUAL:}} \\`!p snip.rv = match.group(2)`ig\\}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# not math so that " can be used in math to access ',
|
|
||||||
# since ' is used to trigger superscript.
|
|
||||||
context "notmath()"
|
|
||||||
snippet "(^|[^a-zA-Z0-9])``" "LaTeX quotation marks" rA
|
|
||||||
`!p snip.rv = match.group(1)`\`\`${1:${VISUAL:}}''$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "notmath()"
|
|
||||||
snippet "(^|[^a-zA-Z0-9]),," "LaTeX serbian quotation marks" rA
|
|
||||||
`!p snip.rv = match.group(1)`,,${1:${VISUAL:}}''$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "notmath()"
|
|
||||||
snippet "(^|[^\w\$\)\}\\])'" "single quotation marks" rA
|
|
||||||
`!p snip.rv = match.group(1)`'${1:${VISUAL:}}'$0
|
|
||||||
endsnippet
|
|
|
@ -1,154 +0,0 @@
|
||||||
snippet "(^|[^a-zA-Z\\])mm" "Inline math $ $" rA
|
|
||||||
`!p snip.rv = match.group(1)`\$ ${1:${VISUAL:}} \$$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# Various environments
|
|
||||||
|
|
||||||
snippet env "New environment" bA
|
|
||||||
\begin{$1}
|
|
||||||
${0:${VISUAL:}}
|
|
||||||
\end{$1}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# hacky way to stop UltiSnips from mirroring the {$2} tag
|
|
||||||
snippet eenv "New environment" bA
|
|
||||||
\begin{$1}{$2}
|
|
||||||
${0:${VISUAL:}}
|
|
||||||
\end{$1}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet onv "New environment" bA
|
|
||||||
\begin{$1}[$2]
|
|
||||||
${0:${VISUAL:}}
|
|
||||||
\end{$1}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet nn "Display math $$ $$" bA
|
|
||||||
\\[
|
|
||||||
${1:${VISUAL:}}
|
|
||||||
\\]
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fgg "Figure with label" bA
|
|
||||||
\begin{figure}${1:[$2]}
|
|
||||||
\centering
|
|
||||||
\includegraphics${3:[$4]}{$5}
|
|
||||||
${6:\caption{$7}
|
|
||||||
\label{$8}}
|
|
||||||
\end{figure}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# snippet nn "Equation environment with suppressed numbering" bA
|
|
||||||
# \begin{equation*}
|
|
||||||
# $1
|
|
||||||
# \end{equation*}
|
|
||||||
# $0
|
|
||||||
# endsnippet
|
|
||||||
|
|
||||||
snippet all "Align environment with suppressed numbering" bA
|
|
||||||
\begin{align*}
|
|
||||||
$1
|
|
||||||
\end{align*}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet itt "Itemize environment" bA
|
|
||||||
\begin{itemize}
|
|
||||||
|
|
||||||
\item $0
|
|
||||||
|
|
||||||
\end{itemize}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rit "Reversed itemize environment, used to split up an existing itemize environment" b
|
|
||||||
\end{itemize}
|
|
||||||
|
|
||||||
$0
|
|
||||||
\begin{itemize}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet enn "Enumerate environment" bA
|
|
||||||
\begin{enumerate}
|
|
||||||
|
|
||||||
\item $0
|
|
||||||
|
|
||||||
\end{enumerate}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tc "tcolorbox environment" bA
|
|
||||||
\begin{tcolorbox}
|
|
||||||
$1
|
|
||||||
\end{tcolorbox}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet pm "Parentheses matrix pmatrix" bA
|
|
||||||
\begin{pmatrix}
|
|
||||||
$1
|
|
||||||
\end{pmatrix}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mq "\mqty() (matrix for inline math)" A
|
|
||||||
\mqty(${1:${VISUAL:}})$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet case "Cases environment" bA
|
|
||||||
\begin{cases}
|
|
||||||
$1
|
|
||||||
\end{cases}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet arr "Array environment" b
|
|
||||||
\begin{array}{${1:cc}}
|
|
||||||
$2
|
|
||||||
\end{array}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet abb "Abstract environment" bA
|
|
||||||
\begin{abstract}
|
|
||||||
${0:${VISUAL:}}
|
|
||||||
\end{abstract}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet qu "Quote environment" b
|
|
||||||
\begin{quote}
|
|
||||||
${1:${VISUAL:}}
|
|
||||||
\end{quote}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet VV "Verbatim environment" bA
|
|
||||||
\begin{verbatim}
|
|
||||||
${1:${VISUAL:}}
|
|
||||||
\end{verbatim}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mint "Minted environment" b
|
|
||||||
\begin{minted}{$1}
|
|
||||||
$0
|
|
||||||
\end{minted}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ccc "Center environment" bA
|
|
||||||
\begin{center}
|
|
||||||
${0:${VISUAL:}}
|
|
||||||
\end{center}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fshr "Flush right environment" bA
|
|
||||||
\begin{flushright}
|
|
||||||
${0:${VISUAL:}}
|
|
||||||
\end{flushright}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet fshl "Flush left environment" bA
|
|
||||||
\begin{flushleft}
|
|
||||||
${0:${VISUAL:}}
|
|
||||||
\end{flushleft}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet title "mytitlepage environment for FMF documents" bA
|
|
||||||
\begin{mytitlepage}{${1:title}}{${2:date}}
|
|
||||||
${0:${VISUAL:}}
|
|
||||||
\end{mytitlepage}
|
|
||||||
endsnippet
|
|
|
@ -1,55 +0,0 @@
|
||||||
# Font styles
|
|
||||||
|
|
||||||
snippet "(^|[^a-zA-Z\\])tt" "\texttt{} (typewriter)" rA
|
|
||||||
`!p snip.rv = match.group(1)`\texttt{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(^|[^a-zA-Z])tii" "\textit{} " rA
|
|
||||||
`!p snip.rv = match.group(1)`\textit{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(^|[^a-zA-Z])tbb" "\textbf{} " rA
|
|
||||||
`!p snip.rv = match.group(1)`\textbf{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(^|[^a-zA-Z])tss" "\textsc{} " rA
|
|
||||||
`!p snip.rv = match.group(1)`\textsc{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(^|[^a-zA-Z])ee" "\emph{} " rA
|
|
||||||
`!p snip.rv = match.group(1)`\emph{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(^|[^a-zA-Z])ul" "\underline{} (underline)" r
|
|
||||||
`!p snip.rv = match.group(1)`\underline{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(^|[^a-zA-Z])txx" "\text{} (math environment)" rA
|
|
||||||
`!p snip.rv = match.group(1)`\text{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(^|[^a-zA-Z])rmm" "\mathrm{} (math roman font)" rA
|
|
||||||
`!p snip.rv = match.group(1)`\mathrm{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(^|[^a-zA-Z])mcc" "\mathcal" rA
|
|
||||||
`!p snip.rv = match.group(1)`\mathcal{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(^|[^a-zA-Z])msf" "\mathsf" rA
|
|
||||||
`!p snip.rv = match.group(1)`\mathsf{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(^|[^a-zA-Z])mbb" "\mathbb" rA
|
|
||||||
`!p snip.rv = match.group(1)`\mathbb{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(^|[^a-zA-Z])mbf" "\mathbf" rA
|
|
||||||
`!p snip.rv = match.group(1)`\mathbf{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(^|[^a-zA-Z\\])tm" "\music{} (for music theory documents)" rA
|
|
||||||
`!p snip.rv = match.group(1)`\music{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
|
@ -1,150 +0,0 @@
|
||||||
# Greek letters
|
|
||||||
|
|
||||||
snippet ;N "\nabla" iA
|
|
||||||
\nabla
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;a "\alpha" iA
|
|
||||||
\alpha
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;b "\beta" iA
|
|
||||||
\beta
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;g "\gamma" iA
|
|
||||||
\gamma
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;G "\Gamma" iA
|
|
||||||
\Gamma
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;d "\delta" iA
|
|
||||||
\delta
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;D "\Delta" iA
|
|
||||||
\Delta
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;e "\epsilon" iA
|
|
||||||
\epsilon
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;ve "\varepsilon" iA
|
|
||||||
\varepsilon
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;z "\zeta" iA
|
|
||||||
\zeta
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# ;e is taken for \epsilon. I use ;h because capital \eta is H
|
|
||||||
snippet ;h "\eta" iA
|
|
||||||
\eta
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# ;t and ;T are more appropriate but are taken by tau
|
|
||||||
# I've used ;o and ;O since theta has an oval/circular shape
|
|
||||||
# o and O techanically go with omnicron, but I don't use omnicron in math or physics
|
|
||||||
snippet ;o "\theta" iA
|
|
||||||
\theta
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;vo "\vartheta" iA
|
|
||||||
\vartheta
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;O "\Theta" iA
|
|
||||||
\Theta
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;k "\kappa" iA
|
|
||||||
\kappa
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;l "\lambda" iA
|
|
||||||
\lambda
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;L "\Lambda" iA
|
|
||||||
\Lambda
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;m "\mu" iA
|
|
||||||
\mu
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;n "\nu" iA
|
|
||||||
\nu
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;x "\xi" iA
|
|
||||||
\xi
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;X "\Xi" iA
|
|
||||||
\Xi
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# p/P are taken by psi, so I've used 'i' instead, the second letter in pi
|
|
||||||
# technically i corresponds to iota, but I don't use iota in math or physics
|
|
||||||
snippet ;i "\pi" iA
|
|
||||||
\pi
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;I "\Pi" iA
|
|
||||||
\Pi
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;r "\rho" iA
|
|
||||||
\rho
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;s "\sigma" iA
|
|
||||||
\sigma
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;S "\Sigma" iA
|
|
||||||
\Sigma
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;t "\tau" iA
|
|
||||||
\tau
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# I use f and not p since p is taken for psi
|
|
||||||
snippet ;f "\phi" iA
|
|
||||||
\phi
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;vf "\varphi" iA
|
|
||||||
\varphi
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;F "\Phi" iA
|
|
||||||
\Phi
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;c "\chi" iA
|
|
||||||
\chi
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;p "\psi" iA
|
|
||||||
\psi
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;P "\Psi" iA
|
|
||||||
\Psi
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# o/O would be more appropriate, but I've used o/O for theta
|
|
||||||
# lowercase omega looks like a 'w', so its all good
|
|
||||||
snippet ;w "\omega" iA
|
|
||||||
\omega
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ;W "\Omega" iA
|
|
||||||
\Omega
|
|
||||||
endsnippet
|
|
|
@ -1,362 +0,0 @@
|
||||||
global !p
|
|
||||||
def math():
|
|
||||||
return vim.eval('vimtex#syntax#in_mathzone()') == '1'
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
priority 2
|
|
||||||
# BEGIN SUPERSCRIPTS AND SUBSCRIPTS
|
|
||||||
# ------------------------------------------------ #
|
|
||||||
context "math()"
|
|
||||||
snippet "([\w]|[\}\)\]\|'])"" "Superscript" rA
|
|
||||||
`!p snip.rv = match.group(1)`^{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "([a-zA-Z]|[\}\)\]\|']):" "Subscript" rA
|
|
||||||
`!p snip.rv = match.group(1)`_{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "([\w]|[\}\)\]\|'])sd" "Text subscript" rA
|
|
||||||
`!p snip.rv = match.group(1)`_{\mathrm{${1:${VISUAL:}}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "([\w]|[\}\)\]\|'])'([\w]{1})" "Place the first \w character after the quotation mark in a subscript" rA
|
|
||||||
`!p snip.rv = match.group(1) + "^{" + match.group(2) + "}"`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "([\w]|[\}\)\]\|']);([\w]{1})" "Place the first \w character after the : in a subscript" rA
|
|
||||||
`!p snip.rv = match.group(1) + "_{" + match.group(2) + "}"`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "([\w]{1})__" "e.g. expand x__ into x_{1}, x_{2}, x_{3}" rA
|
|
||||||
`!p snip.rv = match.group(1) + "_{1}, " + match.group(1) + "_{2}, " + match.group(1) + "_{3}"`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([a-zA-Z]|[\}\)\]\|'])00" "Automatic 0 subscript" rA
|
|
||||||
`!p snip.rv = match.group(1)`_{0}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "([^a-zA-Z])ee" "e^{} supercript" rA
|
|
||||||
`!p snip.rv = match.group(1)`e^{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "([\w]|[\}\)\]\|'])([-+]{2})" "Automatic +/- subscript" rA
|
|
||||||
`!p snip.rv = match.group(1) + "_{" + match.group(2)[0] + "}"`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([\w]|[\}\)\]\|'])\*\*" "Automatic * superscript" rA
|
|
||||||
`!p snip.rv = match.group(1)`^{*}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([\w]|[\}\)\]\|'])TT" "Automatic transposed superscript" rA
|
|
||||||
`!p snip.rv = match.group(1)`^{\top}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "([\w]|[\}\)\]\|'])CC" "Automatic complement superscript" rA
|
|
||||||
`!p snip.rv = match.group(1)`^{\complement}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# context "math()"
|
|
||||||
# snippet "([\w]|[\}\)\]\|'])\"" "Access prime with quotation mark, since prime is used for superscript." rA
|
|
||||||
# `!p snip.rv = match.group(1)`'
|
|
||||||
# endsnippet
|
|
||||||
# ----------------------------------------- #
|
|
||||||
# END SUPERSCRIPTS AND SUBSCRIPTS
|
|
||||||
|
|
||||||
|
|
||||||
# BEGIN SEMANTIC COMMANDS (vec, tilde, etc...)
|
|
||||||
# --------------------------------------------- #
|
|
||||||
snippet "(^|[^a-zA-Z])ff" "\frac{}{}" rA
|
|
||||||
`!p snip.rv = match.group(1)`\frac{${1:${VISUAL:}}}{$2}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(^|[^a-zA-Z])tf" "\tfrac{}{}" rA
|
|
||||||
`!p snip.rv = match.group(1)`\tfrac{${1:${VISUAL:}}}{$2}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "([^a-zA-Z\\])sa" "\sqrt (with optional arg)" rA
|
|
||||||
`!p snip.rv = match.group(1)`\sqrt[${1}]{${2:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "([^a-zA-Z\\])sq" "\sqrt (square root)" rA
|
|
||||||
`!p snip.rv = match.group(1)`\sqrt{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "([\W_])vv" "\vec" rA
|
|
||||||
`!p snip.rv = match.group(1)`\vec{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "([\W_])uv" "\uvec" rA
|
|
||||||
`!p snip.rv = match.group(1)`\uvec{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([\W_])mt" "\mat{} (for matrices)" rA
|
|
||||||
`!p snip.rv = match.group(1)`\mat{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([\W_])tn" "\tensor{}" rA
|
|
||||||
`!p snip.rv = match.group(1)`\tensor{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([\W_])wt" "\widetilde" rA
|
|
||||||
`!p snip.rv = match.group(1)`\widetilde{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([\W_\\])hh" "\hat" rA
|
|
||||||
`!p snip.rv = match.group(1)`\hat{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([\W_\\])bb" "\bar" rA
|
|
||||||
`!p snip.rv = match.group(1)`\bar{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "ss" "Line segment (assumes a user-defined macro)" A
|
|
||||||
`!p snip.rv = match.group(1)`\linesegment{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([^a-zA-Z\\])d" "\dot" r
|
|
||||||
`!p snip.rv = match.group(1)`\dot{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([^a-zA-Z\\])dd" "\ddot" r
|
|
||||||
`!p snip.rv = match.group(1)`\ddot{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([^a-zA-Z\\])pV" "\pdv{}" rA
|
|
||||||
`!p snip.rv = match.group(1)`\pdv{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([^a-zA-Z\\])pvv" "\pdv{}{}" rA
|
|
||||||
`!p snip.rv = match.group(1)`\pdv{$1}{$2}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([^a-zA-Z\\])ppv" "\pdv[]{}{}" rA
|
|
||||||
`!p snip.rv = match.group(1)`\pdv[$1]{$2}{$3}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([^a-zA-Z\\])dV" "\dv{}" rA
|
|
||||||
`!p snip.rv = match.group(1)`\dv{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([^a-zA-Z\\])([dD])vv" "\dv{}{} or \Dv{}{}" rA
|
|
||||||
`!p snip.rv = match.group(1)`\\`!p snip.rv = match.group(2)`v{$1}{$2}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([^a-zA-Z\\])ddv" "\dv[]{}{}" rA
|
|
||||||
`!p snip.rv = match.group(1)`\dv[$1]{$2}{$3}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "([^a-zA-Z\\])aa" "\abs{}" rA
|
|
||||||
`!p snip.rv = match.group(1)`\abs{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "([^a-zA-Z\\])norm" "\norm{}" rA
|
|
||||||
`!p snip.rv = match.group(1)`\norm{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "([^a-zA-Z\\])ev" "\ev{}" rA
|
|
||||||
`!p snip.rv = match.group(1)`\ev{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "([^a-zA-Z\\])ang" "ang{} (Angle)" rA
|
|
||||||
`!p snip.rv = match.group(1)`\ang{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet ann "\annotate{}{} (custom command for annotated stackrel)" A
|
|
||||||
\annotate{${1:above}}{${2:below}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "([\W_\\])srr" "\stackrel{}{}" rA
|
|
||||||
`!p snip.rv = match.group(1)`\stackrel{${1:above}}{${2:${VISUAL:below}}}$0
|
|
||||||
endsnippet
|
|
||||||
# --------------------------------------------- #
|
|
||||||
# END SEMANTIC COMMANDS (vec, tilde, etc...)
|
|
||||||
|
|
||||||
|
|
||||||
# BEGIN INTEGRALS
|
|
||||||
# --------------------------------------------- #
|
|
||||||
snippet "([^\w\\])intt" "Integral with upper and lower limit" rA
|
|
||||||
`!p snip.rv = match.group(1)`\int_{$1}^{$2} $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([^\w\\])innt" "Integral with symmetric upper and lower limit" rA
|
|
||||||
`!p snip.rv = match.group(1)`\int_{-$1}^{$1} $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([^\w\\])int3" "\iiint" rA
|
|
||||||
`!p snip.rv = match.group(1)`\iiint
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([^\w\\])int2" "\iint" rA
|
|
||||||
`!p snip.rv = match.group(1)`\iint
|
|
||||||
endsnippet
|
|
||||||
# END INTEGRALS
|
|
||||||
# --------------------------------------------- #
|
|
||||||
|
|
||||||
|
|
||||||
# BEGIN SUMS
|
|
||||||
# --------------------------------------------- #
|
|
||||||
context "math()"
|
|
||||||
snippet "([^\w\\])sM" "Sum with only lower limit" rA
|
|
||||||
`!p snip.rv = match.group(1)`\sum_{$1}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "([^\w\\])smm" "Sum with upper and lower limit" rA
|
|
||||||
`!p snip.rv = match.group(1)`\sum_{$1}^{$2}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([^\w\\])smf" "Sum from negative to positive infinity" rA
|
|
||||||
`!p snip.rv = match.group(1)`\sum_{$1-\infty}^{\infty} $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "([^\w\\])lsM" "Inline math sum with only lower limit" rA
|
|
||||||
`!p snip.rv = match.group(1)`\sum \limits_{$1}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "([^\w\\])lsmm" "Inline math sum with upper and lower limit" rA
|
|
||||||
`!p snip.rv = match.group(1)`\sum \limits_{$1}^{$2}$0
|
|
||||||
endsnippet
|
|
||||||
# --------------------------------------------- #
|
|
||||||
# END SUMS
|
|
||||||
|
|
||||||
# BEGIN LIMITS
|
|
||||||
# --------------------------------------------- #
|
|
||||||
context "math()"
|
|
||||||
snippet "([^\w\\])lM" "\limits{} with only lower limit" rA
|
|
||||||
`!p snip.rv = match.group(1)`\limits_{$1}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "([^\w\\])lmm" "\limits{}{} with upper and lower limit" rA
|
|
||||||
`!p snip.rv = match.group(1)`\limits_{$1}{$2}$0
|
|
||||||
endsnippet
|
|
||||||
# --------------------------------------------- #
|
|
||||||
# END LIMITS
|
|
||||||
|
|
||||||
|
|
||||||
# BEGIN STATIC TEXT
|
|
||||||
# ------------------------------------- #
|
|
||||||
context "math()"
|
|
||||||
snippet and "static snippet: qquad-spaced 'and' in equation" A
|
|
||||||
\qquad \text{and} \qquad $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet where "static snippet: quad-spaced 'where' in equation" A
|
|
||||||
\quad \text{where } \, $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet else "\text{otherwise}" A
|
|
||||||
\text{otherwise}
|
|
||||||
endsnippet
|
|
||||||
# ------------------------------------- #
|
|
||||||
# END STATIC TEXT
|
|
||||||
|
|
||||||
|
|
||||||
# BEGIN STATIC MATH SNIPPETS
|
|
||||||
# ------------------------------------- #
|
|
||||||
snippet "([\W_])inff" "\infty" rA
|
|
||||||
`!p snip.rv = match.group(1)`\infty
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "([\W_])intf" "Integral from negative to positive infinity" rA
|
|
||||||
`!p snip.rv = match.group(1)`\int_{-\infty}^{\infty}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet >> "\implies" Ai
|
|
||||||
\implies
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet lra "\leftrightarrow" A
|
|
||||||
\leftrightarrow
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "([^a-zA-Z0-9\\])df" "\diff" rA
|
|
||||||
`!p snip.rv = match.group(1)`\diff
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([^a-zA-Z0-9\\])gd" "\grad" r
|
|
||||||
`!p snip.rv = match.group(1)`\grad
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([^a-zA-Z0-9\\])lap" "\laplacian" r
|
|
||||||
`!p snip.rv = match.group(1)`\laplacian
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([^a-zA-Z0-9\\])cll" "\curl" rA
|
|
||||||
`!p snip.rv = match.group(1)`\curl
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([lcvd]|)dd" "(lcvd)dots (various dots commands in one regex)" rA
|
|
||||||
\\`!p snip.rv = match.group(1)`dots
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ,. "\cdot" iA
|
|
||||||
\cdot
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet xx "\cross" A
|
|
||||||
\times
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([^a-zA-Z0-9\\])pt" "\propto" rA
|
|
||||||
`!p snip.rv = match.group(1)`\propto
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([^a-zA-Z0-9\\])px" "\approx" rA
|
|
||||||
`!p snip.rv = match.group(1)`\approx
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([^a-zA-Z0-9\\])eqq" "\equiv" rA
|
|
||||||
`!p snip.rv = match.group(1)`\equiv
|
|
||||||
endsnippet
|
|
||||||
# ------------------------------------- #
|
|
||||||
# END STATIC MATH SNIPPETS
|
|
||||||
|
|
||||||
|
|
||||||
# BEGIN MISC
|
|
||||||
# --------------------------------------------- #
|
|
||||||
snippet "(^|[^a-zA-Z])sgg" "\subgrad{} (for cleaner gradient, mostly for ML backprop)" rA
|
|
||||||
`!p snip.rv = match.group(1)`\subgrad{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(^|[^a-zA-Z])spp" "\supgrad{} (for cleaner gradient, mostly for ML backprop)" rA
|
|
||||||
`!p snip.rv = match.group(1)`\supgrad{${1:${VISUAL:}}}{$2}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# turns b| into \big |
|
|
||||||
# turns B| into \Big |
|
|
||||||
snippet "([\W])([bB])\|" "(bB)ig |_{evaluation}" rA
|
|
||||||
`!p snip.rv = match.group(1)`\\`!p snip.rv = match.group(2)`ig|_{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet qm "\questionmath{} (for coloring math commands to distinguish from colored question text)"
|
|
||||||
\questionmath{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
# --------------------------------------------- #
|
|
||||||
# END MISC
|
|
|
@ -1,37 +0,0 @@
|
||||||
global !p
|
|
||||||
def math():
|
|
||||||
return vim.eval('vimtex#syntax#in_mathzone()') == '1'
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
|
|
||||||
# Dirac braket notation commands
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "([\W_])ket" "\ket{}" rA
|
|
||||||
`!p snip.rv = match.group(1)`\ket{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "([\W_])bra" "\bra{}" rA
|
|
||||||
`!p snip.rv = match.group(1)`\bra{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "([\W_])bk" "\braket{}{}" rA
|
|
||||||
`!p snip.rv = match.group(1)`\braket\{$1\}\{$2\}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "([\W_])mel" "\mel{}{}{} (matrix element)" rA
|
|
||||||
`!p snip.rv = match.group(1)`\mel{$1}{$2}{$3}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# static snippets
|
|
||||||
snippet "([^a-zA-Z0-9\\])hbar" "\hbar" rA
|
|
||||||
`!p snip.rv = match.group(1)`\hbar
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
context "math()"
|
|
||||||
snippet "([^a-zA-Z0-9\\])dag" "\dagger" rA
|
|
||||||
`!p snip.rv = match.group(1)`\dagger
|
|
||||||
endsnippet
|
|
|
@ -1,13 +0,0 @@
|
||||||
snippet lll "Conditional language compilation" bA
|
|
||||||
\ifserbian
|
|
||||||
$0
|
|
||||||
\else
|
|
||||||
${VISUAL}
|
|
||||||
\fi
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet llo "Conditional language compilation (serbian only)" bA
|
|
||||||
\ifserbian
|
|
||||||
$0
|
|
||||||
\fi
|
|
||||||
endsnippet
|
|
|
@ -1,40 +0,0 @@
|
||||||
global !p
|
|
||||||
def math():
|
|
||||||
return vim.eval('vimtex#syntax#in_mathzone()') == '1'
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
snippet -- "Commented line % ----------------- %" bA
|
|
||||||
% --------------------------------------------- %
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "([\W_])LL" "& (alignment character, which is a pain to reach)" rA
|
|
||||||
`!p snip.rv = match.group(1)`&
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rule "horizontal rule" b
|
|
||||||
\rule{\textwidth}{0.5pt}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet hl "\hline with vertical spacing for tables"
|
|
||||||
\hline {\rule{0pt}{2.5ex}} \hspace{-7pt}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet hff "\hfill" iA
|
|
||||||
\hfill
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tbs "\textbackslash" iA
|
|
||||||
\textbackslash
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ii "Item for enumerated environments \item" bA
|
|
||||||
\item
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(^|[^a-zA-Z0-9\\])q" "\quad" r
|
|
||||||
`!p snip.rv = match.group(1)`\quad
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(^|[^a-zA-Z0-9\\])qq" "\qquad" rA
|
|
||||||
`!p snip.rv = match.group(1)`\qquad
|
|
||||||
endsnippet
|
|
|
@ -1,132 +0,0 @@
|
||||||
# Various ``system-style'' commands.
|
|
||||||
|
|
||||||
# BEGIN PREAMBLE SNIPPETS
|
|
||||||
# --------------------------------------------- #
|
|
||||||
snippet pack "\usepackage{}" b
|
|
||||||
\usepackage{$1}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet packk "\usepackage[]{}" b
|
|
||||||
\usepackage[$2]{$1}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet nc "\newcommand{}{}" b
|
|
||||||
\newcommand{$1}{$2}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rnc "\renewcommand{}{}" b
|
|
||||||
\renewcommand{$1}{$2}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet inn "\input{} intended for use in FMF documents" bA
|
|
||||||
\input{${1:~/dotfiles/config/latex/templates/}$2}$0
|
|
||||||
endsnippet
|
|
||||||
# END PREAMBLE SNIPPETS
|
|
||||||
|
|
||||||
|
|
||||||
# BEGIN SECTIONING SNIPPETS
|
|
||||||
# --------------------------------------------- #
|
|
||||||
snippet s "New section" b
|
|
||||||
\section{$1}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ss "New subsection" b
|
|
||||||
\subsection{$1}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sss "New subsubsection" bA
|
|
||||||
\subsubsection{$1}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ns "\newsec{} (for equation sheet sections)" bA
|
|
||||||
\newsec{$1}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet toc "\tableofcontents" b
|
|
||||||
\tableofcontents
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet np "\newpage" b
|
|
||||||
\newpage
|
|
||||||
endsnippet
|
|
||||||
# --------------------------------------------- #
|
|
||||||
# END SECTIONING SNIPPETS
|
|
||||||
|
|
||||||
snippet "(^|[\W_])vv" "inline verabtim" rA
|
|
||||||
`!p snip.rv = match.group(1)`\verb|${1:${VISUAL:}}|
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(^|[\W_])TODOO" "TODO mark" rA
|
|
||||||
`!p snip.rv = match.group(1)`\TODO{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ftt "Footnote" A
|
|
||||||
\footnote{${1:${VISUAL:}}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# BEGIN REFERENCING SNIPPETS
|
|
||||||
# --------------------------------------------- #
|
|
||||||
snippet "([\W_])lbl" "\label{} (for creating cross-references and hyperlinks)" rA
|
|
||||||
`!p snip.rv = match.group(1)`\label{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# snippet "([^a-zA-Z\s])RR" "\ref{}" rA
|
|
||||||
# `!p snip.rv = match.group(1)`~\ref{${1:${VISUAL:}}}$0
|
|
||||||
# endsnippet
|
|
||||||
|
|
||||||
# one or more white space characters followed by RR
|
|
||||||
snippet "[\s]+RR" "\ref{}" rA
|
|
||||||
~\ref{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(^|[\W_])REF" "TODO: reference" rA
|
|
||||||
`!p snip.rv = match.group(1)`\TODO{reference}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(^|[\W_])EE" "\eqref{}" rA
|
|
||||||
`!p snip.rv = match.group(1)`\eqref{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
# --------------------------------------------- #
|
|
||||||
# END REFERENCING SNIPPETS
|
|
||||||
|
|
||||||
|
|
||||||
# BEGIN HYPERLINK SNIPPETS
|
|
||||||
# --------------------------------------------- #
|
|
||||||
snippet url "\myurl{url}" i
|
|
||||||
\url{${1:${VISUAL:url}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet hr "\href{url}{display name} (for url links)"
|
|
||||||
\href{${1:url}}{${2:display name}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet hrr "\hyperref[label]{display name} (for referencing labeled sections)" A
|
|
||||||
\hyperref[${1:label}]{${2:${VISUAL:display name}}}$0
|
|
||||||
endsnippet
|
|
||||||
# --------------------------------------------- #
|
|
||||||
# END HYPERLINK SNIPPETS
|
|
||||||
|
|
||||||
|
|
||||||
# BEGIN SPACING SNIPPETS
|
|
||||||
# --------------------------------------------- #
|
|
||||||
snippet "([vhm])s" "(vhm)space (various spacing commands in one regex)" r
|
|
||||||
\\`!p snip.rv = match.group(1)`space{$1}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "vs([1-9])" "vspace with predefined spacing" rA
|
|
||||||
\\vspace{0.`!p snip.rv = match.group(1)`ex}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet hpp "\hphantom{}" iA
|
|
||||||
\hphantom{${1:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet prr "\hfill-like fuctionality in math environments. Used in equation sheets" A
|
|
||||||
& \pushright{$1}\\\\$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tls "\textls[]{}" i
|
|
||||||
\textls[$1]{${2:${VISUAL:}}}$0
|
|
||||||
endsnippet
|
|
||||||
# --------------------------------------------- #
|
|
||||||
# END SPACING SNIPPETS
|
|
|
@ -1,255 +0,0 @@
|
||||||
snippet template "Basic template for math/physics documents" b
|
|
||||||
\documentclass[11pt, a4paper]{article}
|
|
||||||
\usepackage[T1]{fontenc}
|
|
||||||
\usepackage{geometry}
|
|
||||||
\usepackage{amsmath, amssymb, bm}
|
|
||||||
\usepackage{physics, siunitx}
|
|
||||||
\usepackage{hyperref}
|
|
||||||
|
|
||||||
\geometry{margin=3.5cm}
|
|
||||||
\sisetup{separate-uncertainty=true, exponent-product=\cdot, range-units=single}
|
|
||||||
\hypersetup{colorlinks=true, linkcolor=blue, urlcolor=cyan}
|
|
||||||
\setlength{\parindent}{0pt}
|
|
||||||
|
|
||||||
\newcommand{\diff}{\mathop{}\!\mathrm{d}}
|
|
||||||
\newcommand{\TODO}[1]{{\textbf{TODO:} {\color{red} #1}}}
|
|
||||||
|
|
||||||
\begin{document}
|
|
||||||
$0
|
|
||||||
\end{document}
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# --------------------------------------------
|
|
||||||
|
|
||||||
snippet paper "Simple document template for student paper" b
|
|
||||||
\documentclass[a4paper]{article}
|
|
||||||
|
|
||||||
\usepackage[T2A]{fontenc}
|
|
||||||
\usepackage[utf8]{inputenc}
|
|
||||||
\usepackage[serbian]{babel}
|
|
||||||
\usepackage{wrapfig}
|
|
||||||
\usepackage{textcase}
|
|
||||||
\usepackage{comment}
|
|
||||||
\usepackage{tocloft}
|
|
||||||
\usepackage{fancyhdr}
|
|
||||||
\usepackage{setspace}
|
|
||||||
\usepackage{float}
|
|
||||||
\usepackage{multirow}
|
|
||||||
\usepackage{array}
|
|
||||||
\usepackage[backend=biber]{biblatex}
|
|
||||||
|
|
||||||
\author{${1:Petar Kapri\v s}}
|
|
||||||
\title{$2}
|
|
||||||
\newcommand{\mentor}{$3}
|
|
||||||
\newcommand{\institute}{${4:Univerzitet u Novom Sadu\\
|
|
||||||
Prirodno-matemati\v cki fakultet\\
|
|
||||||
Departman za matematiku i informatiku}}
|
|
||||||
|
|
||||||
\pagestyle{fancy}
|
|
||||||
\makeatletter
|
|
||||||
\lhead{\tiny{\@title}}
|
|
||||||
\rhead{\tiny{\@author}}
|
|
||||||
|
|
||||||
\begin{document}
|
|
||||||
\begin{titlepage}
|
|
||||||
\centering
|
|
||||||
{\Large
|
|
||||||
\institute
|
|
||||||
}
|
|
||||||
|
|
||||||
\vspace*{5cm}
|
|
||||||
{\LARGE
|
|
||||||
\vspace*{0.5cm}
|
|
||||||
\MakeUppercase{\textbf{\@title}}
|
|
||||||
}
|
|
||||||
|
|
||||||
\vspace*{8.9cm}
|
|
||||||
|
|
||||||
{\LARGE
|
|
||||||
Mentor:
|
|
||||||
\hfill
|
|
||||||
Student:
|
|
||||||
|
|
||||||
\vspace*{0.3cm}
|
|
||||||
\mentor
|
|
||||||
\hfill
|
|
||||||
{\@author}
|
|
||||||
}
|
|
||||||
|
|
||||||
\vspace*{\fill}
|
|
||||||
{\large {\@date}}
|
|
||||||
\makeatother
|
|
||||||
\end{titlepage}
|
|
||||||
|
|
||||||
\newpage
|
|
||||||
\tableofcontents
|
|
||||||
\newpage
|
|
||||||
|
|
||||||
$0
|
|
||||||
\end{document}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# --------------------------------------------
|
|
||||||
snippet simple "Basic document template without math packages" b
|
|
||||||
\documentclass[11pt, a4paper]{article}
|
|
||||||
\usepackage[T1]{fontenc}
|
|
||||||
\usepackage{geometry}
|
|
||||||
\usepackage{hyperref}
|
|
||||||
|
|
||||||
\geometry{margin=3.5cm}
|
|
||||||
\hypersetup{colorlinks=true, linkcolor=blue, urlcolor=cyan}
|
|
||||||
|
|
||||||
\begin{document}
|
|
||||||
$0
|
|
||||||
\end{document}
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# --------------------------------------------
|
|
||||||
snippet eqn "Template for equation sheets" b
|
|
||||||
\documentclass[10pt, a4paper]{article}
|
|
||||||
\usepackage[T1]{fontenc}
|
|
||||||
\usepackage{geometry, multicol}
|
|
||||||
\usepackage{microtype, suffix}
|
|
||||||
\usepackage[shortlabels]{enumitem}
|
|
||||||
\usepackage{amsmath, amssymb, bm}
|
|
||||||
\usepackage{physics, siunitx}
|
|
||||||
\usepackage{hyperref}
|
|
||||||
|
|
||||||
\geometry{margin=1.0cm}
|
|
||||||
\sisetup{separate-uncertainty=true, exponent-product=\cdot, range-units=single}
|
|
||||||
\hypersetup{colorlinks=true, linkcolor=blue, urlcolor=cyan}
|
|
||||||
|
|
||||||
\newcommand{\newsec}[1]{\vspace{2mm}\textbf{#1}\\\\}
|
|
||||||
\WithSuffix\newcommand\newsec*[1]{\textbf{#1}\\\\}
|
|
||||||
|
|
||||||
\pagenumbering{gobble}
|
|
||||||
\pagestyle{empty}
|
|
||||||
\setcounter{secnumdepth}{0}
|
|
||||||
\setlength{\parindent}{0pt}
|
|
||||||
\setlist{itemsep=-1.0pt, topsep=2pt}
|
|
||||||
|
|
||||||
% Redefine section commands to use less space
|
|
||||||
% Redefine section commands to use less space
|
|
||||||
\makeatletter
|
|
||||||
\renewcommand{\section}{\@startsection{section}{1}{0mm}%
|
|
||||||
{-2.0ex}% % skip above section name
|
|
||||||
{1.0ex}% % skip below section name
|
|
||||||
{\normalfont\Large\bfseries}}
|
|
||||||
|
|
||||||
\renewcommand{\subsection}{\@startsection{subsection}{2}{0mm}%
|
|
||||||
{-1.5ex}% % skip above section name
|
|
||||||
{0.75ex}% % skip below section name
|
|
||||||
{\normalfont\large\bfseries}}
|
|
||||||
|
|
||||||
\renewcommand{\subsubsection}{\@startsection{subsubsection}{2}{0mm}%
|
|
||||||
{-1.5ex}% % skip above section name
|
|
||||||
{0.75ex}% % skip below section name
|
|
||||||
{\normalfont\large\bfseries}}
|
|
||||||
\makeatother
|
|
||||||
|
|
||||||
\newcommand{\diff}{\mathop{}\!\mathrm{d}}
|
|
||||||
|
|
||||||
\begin{document}
|
|
||||||
\begin{multicols}{2}
|
|
||||||
$0
|
|
||||||
\end{multicols}
|
|
||||||
\end{document}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# --------------------------------------------
|
|
||||||
|
|
||||||
snippet tlim "Custom \tlim and \tsum commands for equation sheets" b
|
|
||||||
\newcommand{\tsum}[1]{\raisebox{0.1ex}{\scalebox{0.8}{$\displaystyle \sum_{#1}$}}}
|
|
||||||
\newcommand{\tsumm}[2]{\raisebox{0.1ex}{\scalebox{0.8}{$\displaystyle \sum_{#1}^{#2}$}}}
|
|
||||||
\newcommand{\tlim}[1]{\scalebox{0.8}{$\displaystyle \lim_{#1}\,$}}
|
|
||||||
\newcommand{\tmax}[1]{\scalebox{0.8}{$\displaystyle \max_{#1}\,$}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# ---------------------------------------------
|
|
||||||
|
|
||||||
snippet vccommands "Vector calculus commands" b
|
|
||||||
\renewcommand{\vec}[1]{\bm{#1}}
|
|
||||||
\newcommand{\uvec}[1]{\mathop{} \!\hat{\mathbf{#1}}}
|
|
||||||
\newcommand{\mat}[1]{\mathbf{#1}}
|
|
||||||
\newcommand{\tensor}[1]{\mathsf{#1}}
|
|
||||||
|
|
||||||
\renewcommand{\div}{\nabla \cdot}
|
|
||||||
\renewcommand{\curl}{\nabla \cross}
|
|
||||||
\renewcommand{\grad}{\nabla}
|
|
||||||
\renewcommand{\laplacian}{\nabla^{2}}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# --------------------------------------------
|
|
||||||
|
|
||||||
snippet figurepack "Packages for Latex figures and floats" b
|
|
||||||
\usepackage{graphicx}
|
|
||||||
\graphicspath{{"${1:graphicspath}"}}
|
|
||||||
\usepackage[section]{placeins}
|
|
||||||
\usepackage{subcaption}
|
|
||||||
\usepackage[export]{adjustbox}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# --------------------------------------------
|
|
||||||
|
|
||||||
snippet minted "Packages for minted" b
|
|
||||||
\newcommand{\tqs}{\textquotesingle}
|
|
||||||
\newcommand{\ttilde}{{\raise.17ex\hbox{$\scriptstyle\sim$}}}
|
|
||||||
|
|
||||||
\usepackage{minted, tcolorbox, etoolbox}
|
|
||||||
\tcbuselibrary{minted,skins}
|
|
||||||
\BeforeBeginEnvironment{minted}{\begin{tcolorbox}}
|
|
||||||
\AfterEndEnvironment{minted}{\end{tcolorbox}}
|
|
||||||
\setminted[${1:language}]{tabsize=2, breaklines}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# ---------------------------------------------
|
|
||||||
|
|
||||||
snippet bib "Bibliography" b
|
|
||||||
\begin{thebibliography}{}
|
|
||||||
|
|
||||||
\setlength{\itemsep}{.2\itemsep} \setlength{\parsep}{.5\parsep}
|
|
||||||
$0
|
|
||||||
|
|
||||||
\end{thebibliography}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# ---------------------------------------------
|
|
||||||
|
|
||||||
snippet doc "Simple beggining document template" b
|
|
||||||
\documentclass[a4paper]{article}
|
|
||||||
$1
|
|
||||||
\begin{document}
|
|
||||||
$0
|
|
||||||
\end{document}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet header "Description" b
|
|
||||||
% Header configuration
|
|
||||||
%--------------------------------------------%
|
|
||||||
\usepackage{fancyhdr, extramarks}
|
|
||||||
\pagestyle{fancy}
|
|
||||||
|
|
||||||
\fancyhf{}
|
|
||||||
\fancyhead[L]{\textit{\firstrightmark}}
|
|
||||||
\fancyfoot[C]{\centering \thepage}
|
|
||||||
|
|
||||||
\renewcommand{\sectionmark}[1]{
|
|
||||||
\markboth{\thesection. \ #1}
|
|
||||||
{\noexpand\firstsubsectiontitle}
|
|
||||||
\global\firstsubsectionmarktrue}
|
|
||||||
\renewcommand{\subsectionmark}[1]{
|
|
||||||
\markright{\thesubsection. \, #1}
|
|
||||||
\iffirstsubsectionmark
|
|
||||||
\edef\firstsubsectiontitle{\thesubsection. \, #1}
|
|
||||||
\fi
|
|
||||||
\global\firstsubsectionmarkfalse}
|
|
||||||
\newif\iffirstsubsectionmark
|
|
||||||
\def\firstsubsectiontitle{}
|
|
||||||
%--------------------------------------------%
|
|
||||||
% End header configuration
|
|
||||||
endsnippet
|
|
|
@ -1,12 +0,0 @@
|
||||||
snippet tp "TikZ picture environment" bA
|
|
||||||
\begin{tikzpicture}
|
|
||||||
$1
|
|
||||||
\end{tikzpicture}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet dx "\pgfmathsetmacro for tikz pictures" bA
|
|
||||||
\pgfmathsetmacro{\dx}{${1:1}}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
extends javascript
|
|
||||||
|
|
||||||
snippet int "interface"
|
|
||||||
interface ${1} {
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
snippet nspc "namespace"
|
|
||||||
namespace ${1} {
|
|
||||||
}
|
|
||||||
endsnippet
|
|
||||||
priority -49
|
|
||||||
snippet fun "function (named)" b
|
|
||||||
function ${1:function_name} (${2:argument}: ${3:argument_type}) {
|
|
||||||
${VISUAL}$0
|
|
||||||
}
|
|
||||||
endsnippet
|
|
|
@ -1,12 +0,0 @@
|
||||||
priority -50
|
|
||||||
extends javascript_react
|
|
||||||
extends typescript
|
|
||||||
|
|
||||||
priority -49
|
|
||||||
snippet rfc "react functional component"
|
|
||||||
import React, { FC } from "react"
|
|
||||||
|
|
||||||
interface ${1:function_name}Props {${4:props_types}}
|
|
||||||
|
|
||||||
export const ${1:function_name}: FC<${1:function_name}Props> = (${2:props}) => ${3:function_body}
|
|
||||||
endsnippet
|
|
|
@ -1,24 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
###########################################################################
|
|
||||||
# SnipMate Snippets #
|
|
||||||
###########################################################################
|
|
||||||
snippet gvar "Global / configuration variable" b
|
|
||||||
if !exists("g:${1:MyUltraImportantVar}")
|
|
||||||
let g:$1 = ${2:"${3:<tab>}"}
|
|
||||||
endif
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet guard "script reload guard" b
|
|
||||||
if exists('${1:did_`!p snip.rv = snip.fn.replace('.','_')`}') || &cp${2: || version < 700}
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
let $1 = 1$3
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet f "function" b
|
|
||||||
fun ${1:function_name}($2)
|
|
||||||
${3:" code}
|
|
||||||
endf
|
|
||||||
endsnippet
|
|
||||||
# vim:ft=snippets:
|
|
|
@ -1 +0,0 @@
|
||||||
extends html, javascript, css
|
|
|
@ -1,3 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
extends html
|
|
|
@ -1,16 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
snippet xml "XML declaration" b
|
|
||||||
<?xml version="1.0"?>
|
|
||||||
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet t "Simple tag" b
|
|
||||||
<${1:tag}>
|
|
||||||
${2:${VISUAL}}
|
|
||||||
</${1/([\w:._-]+).*/$1/}>
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ti "Inline tag" b
|
|
||||||
<${1:tag}>${2:${VISUAL}}</${1/([\w:._-]+).*/$1/}>
|
|
||||||
endsnippet
|
|
|
@ -1,12 +0,0 @@
|
||||||
priority -50
|
|
||||||
|
|
||||||
extends sh
|
|
||||||
|
|
||||||
priority -49
|
|
||||||
|
|
||||||
snippet #! "#!/usr/bin/env zsh" b
|
|
||||||
#!/usr/bin/env zsh
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
# vim:ft=snippets:
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue