mirror of
https://github.com/amix/vimrc
synced 2025-07-18 09:35:00 +08:00
merge
This commit is contained in:
8
sources_non_forked/vim-snippets/.travis.yml
Normal file
8
sources_non_forked/vim-snippets/.travis.yml
Normal file
@ -0,0 +1,8 @@
|
||||
language: c
|
||||
sudo: false
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
|
||||
script:
|
||||
- ./tests.sh
|
383
sources_non_forked/vim-snippets/AUTHORS
Normal file
383
sources_non_forked/vim-snippets/AUTHORS
Normal file
@ -0,0 +1,383 @@
|
||||
Authors
|
||||
===============================================================================
|
||||
|
||||
Generated with "git log --oneline --pretty="%an" | sort | uniq > AUTHORS
|
||||
|
||||
Aaron Broder
|
||||
Adnan Zafar
|
||||
afolmert
|
||||
aisensiy
|
||||
Alexander Ross
|
||||
Alexandre de Oliveira
|
||||
Alexey Shevchenko
|
||||
Alex Tan
|
||||
Allen.M
|
||||
Alvin Chan
|
||||
ALX-Liu-Xiao
|
||||
Andrea Giardini
|
||||
Andreas Krennmair
|
||||
Andreas Steinel
|
||||
Andrei Cristian Petcu
|
||||
Andrej Radovic
|
||||
Andre Walker
|
||||
Andrey Paskal
|
||||
Andy Waite
|
||||
Angel Alonso
|
||||
Ángel Alonso
|
||||
Anne Douwe Bouma
|
||||
Anthony Wilson
|
||||
Arvind
|
||||
ashfinal
|
||||
Audrius Kažukauskas
|
||||
Austin Wood
|
||||
Aydar Khabibullin
|
||||
babybeasimple
|
||||
Benjamin Nørgaard
|
||||
Bernhard Graf
|
||||
Bill Casarin
|
||||
binaryplease
|
||||
Björn
|
||||
Björn-Egil Dahlberg
|
||||
BlackEagle
|
||||
Boone Severson
|
||||
bounceme
|
||||
Bradlee Speice
|
||||
Brandon Dulaney
|
||||
Brandon Hilkert
|
||||
Brian Hogan
|
||||
Brian van Burken
|
||||
Bruno Sutic
|
||||
Camilo Payan
|
||||
carme
|
||||
Cézar Antáres
|
||||
Chad Paradis
|
||||
Chen Zhongzheng
|
||||
Ches Martin
|
||||
ChickenNuggers
|
||||
Chipairon
|
||||
Chris Dueck
|
||||
Chris Nicola
|
||||
Chris Sims
|
||||
Christian
|
||||
Christian Höltje
|
||||
Christian Neumüller
|
||||
Christopher Joslyn
|
||||
chrisyue
|
||||
Ciro Santilli
|
||||
Ciro Santilli 六四事件 法轮功
|
||||
Claudio Maradonna
|
||||
Connor Atherton
|
||||
Cooper LeBrun
|
||||
Corentin Peuvrel
|
||||
Craig Paterson
|
||||
Craig P Jolicoeur
|
||||
crazymaster
|
||||
daa84
|
||||
Daeyun Shin
|
||||
Dale Roberts
|
||||
Daniel Hahler
|
||||
Dan Loewenherz
|
||||
Danny Navarro
|
||||
daoo
|
||||
Darrell Hamilton
|
||||
David Arvelo
|
||||
David Barnett
|
||||
David C. Bishop
|
||||
David Deryl Downey - AKA Deryl R. Doucette
|
||||
David Rodríguez de Dios
|
||||
David Sanson
|
||||
dengyaolong
|
||||
Derek Morey
|
||||
dhilipsiva
|
||||
djdt
|
||||
Dmitry Dementev
|
||||
Donny Yang
|
||||
DSIW
|
||||
dzikie drożdże
|
||||
Eduardo Gurgel
|
||||
Eli Gundry
|
||||
emzap79
|
||||
Enric Lluelles
|
||||
Enrico Maria De Angelis
|
||||
Erich Heine
|
||||
Erik Westrup
|
||||
Ernest
|
||||
Eugene Kalinin
|
||||
Eustaquio Rangel
|
||||
Eustáquio Rangel
|
||||
Fatih Arslan
|
||||
Felix Jung
|
||||
Filipe Giusti
|
||||
Florent Lévigne
|
||||
Florian Sattler
|
||||
frans
|
||||
Fuad Saud
|
||||
Gabriel Chavez
|
||||
Gaël Chamoulaud
|
||||
Gea-Suan Lin
|
||||
George Guimarães
|
||||
George Lee
|
||||
Georgios Samaras
|
||||
Gert
|
||||
gfixler
|
||||
Gilad Peleg
|
||||
gk
|
||||
goonnow
|
||||
Gueunet Charles
|
||||
Gui Lin
|
||||
guneysus
|
||||
Gustavo Chain
|
||||
Gustavo Ferreira
|
||||
Hans-Guenter
|
||||
Harald Wartig
|
||||
Henrik Kjelsberg
|
||||
HIRAKI Satoru
|
||||
Holger Rapp
|
||||
Honza
|
||||
Honza Pokorny
|
||||
hulufei
|
||||
Igor Goldvekht
|
||||
Ilker Cetinkaya
|
||||
indi
|
||||
Indra Susila
|
||||
Ionică Bizău
|
||||
Iuri Fernandes
|
||||
Jack Stalnaker
|
||||
Jacobo de Vera
|
||||
Jacques Kvam
|
||||
jake romer
|
||||
Jakub Stasiak
|
||||
James Turley
|
||||
Jan Mollowitz
|
||||
Jason S. Jones
|
||||
Jean Jordaan
|
||||
Jeffrey Tratner
|
||||
Jens Hoepken
|
||||
jiangyc0
|
||||
Jim Deville
|
||||
Jinzhu
|
||||
Joey Curtin
|
||||
Johannes Wienke
|
||||
jonasac
|
||||
Jonas Bygdén
|
||||
Jonathan Martin
|
||||
Jorge García
|
||||
Jorge López Pérez
|
||||
Joseph Lin
|
||||
Josh Bode
|
||||
Josh Davis
|
||||
Josh Matthews
|
||||
Josh Vandergrift
|
||||
Josh Wainwright
|
||||
JuanPablo
|
||||
Julian Bennecker
|
||||
Julien Deniau
|
||||
Julien Pivard
|
||||
Julien Stechele
|
||||
Julien STECHELE
|
||||
Kalinin Eugene
|
||||
kenshin54
|
||||
Kentaro Imai
|
||||
Kevin Koltz
|
||||
Kevin Lui
|
||||
Kevin Mees
|
||||
Kevin Murray
|
||||
Kevin Schaul
|
||||
Konstantin
|
||||
Konstantin Gorodinskiy
|
||||
Laas Toom
|
||||
Laurent Georget
|
||||
laxtiz
|
||||
Leandro Moreira
|
||||
Leonardo B
|
||||
Leonidez Acosta
|
||||
linduxed
|
||||
Li Xin
|
||||
Louis
|
||||
Louis Pilfold
|
||||
Lucas Hoffmann
|
||||
Luis Carlos Cruz
|
||||
Luis Carlos Cruz Carballo
|
||||
Luiz Gonzaga dos Santos Filho
|
||||
majjoha
|
||||
mangege
|
||||
Marc Camuzat
|
||||
Marcelo D Montu
|
||||
Marcelo Jacobus
|
||||
Marcin Kulik
|
||||
Marcus Kammer
|
||||
Marc Weber
|
||||
Mario de Frutos
|
||||
Markus Benning
|
||||
marocchino
|
||||
Martin Atukunda
|
||||
Martin Heuschober
|
||||
Martxel Lasa
|
||||
Matěj Cepl
|
||||
Mathew Attlee
|
||||
Mathieu Comandon
|
||||
Matthew Barry
|
||||
Matthias Viehweger
|
||||
Mattia Tezzele
|
||||
Matt Rasband
|
||||
Matt Stevens
|
||||
Mauro Porras P
|
||||
Maximiliano Robaina
|
||||
Mayeu (Cast)
|
||||
Meng Zhuo
|
||||
Michael Gehring
|
||||
Michael Hinrichs
|
||||
Michael Rutter
|
||||
Michael Thessel
|
||||
Michi Huber
|
||||
Mickey
|
||||
midchildan
|
||||
Mike Foley
|
||||
Mike Smullin
|
||||
Miki Tebeka
|
||||
Minjong Chung
|
||||
M. Maxwell Watson
|
||||
mMontu
|
||||
mockturtl
|
||||
m-pilia
|
||||
Muhammad Hallaj Subery
|
||||
mwcz
|
||||
Namit
|
||||
Nan Cloudio Jiang
|
||||
Nan Zheng
|
||||
Nate Mara
|
||||
netei
|
||||
Ngo The Trung
|
||||
Nguyen Le
|
||||
Nick Janetakis
|
||||
Nicklasos
|
||||
Nick Papanastasiou
|
||||
Nicolas G. Querol
|
||||
Nico Suhl
|
||||
No Ducks
|
||||
Norman Messtorff
|
||||
obaoba
|
||||
oddlydrawn
|
||||
Oleg Voronkovich
|
||||
Ole Hansen
|
||||
Oliver Andrich
|
||||
Ondrej Slinták
|
||||
onemanstartup
|
||||
opennota
|
||||
Paco Esteban
|
||||
Panagiotis Mavrogiorgos
|
||||
Paolo Cretaro
|
||||
Pascal
|
||||
Paulo Romeira
|
||||
Pawel Jankowski
|
||||
phcerdan
|
||||
Philippe Mongeau
|
||||
Philipp Jovanovic
|
||||
Piotr Jawniak
|
||||
Piotr Yordanov
|
||||
Pirogov Evgenij
|
||||
Pompeu
|
||||
Povilas Balzaravicius Pawka
|
||||
Procras
|
||||
protream
|
||||
pydave
|
||||
r4d2
|
||||
Radosław Szymczyszyn
|
||||
Ralph-Wang
|
||||
Raül Torralba
|
||||
raydeal
|
||||
rcolombo
|
||||
Rekky
|
||||
René
|
||||
Rene Vergara
|
||||
Renzo Poddighe
|
||||
Reyes Yang
|
||||
ricardogcolombo
|
||||
Ricardo Jesus
|
||||
Rich Layte
|
||||
Roberto Miranda
|
||||
robin
|
||||
Robin Grindrod
|
||||
Rok Garbas
|
||||
Roland Sommer
|
||||
Rory McNamara
|
||||
rsw0x
|
||||
rtorralba
|
||||
Ruben Vereecken
|
||||
Ryan Bright
|
||||
Ryan Pineo
|
||||
Ryan Wang
|
||||
Sam Shepherd
|
||||
Santiago Gallego
|
||||
sasidhar-d
|
||||
Sathors
|
||||
Sebastian Röder
|
||||
Sebastian Wiesner
|
||||
Sergey Lebedev
|
||||
Sergey Zasenko
|
||||
Serhiy Oplakanets
|
||||
SevereOverfl0w
|
||||
Simeon F. Willbanks
|
||||
Simeon Willbanks
|
||||
Simon Désaulniers
|
||||
sirex
|
||||
skv
|
||||
Sokovikov
|
||||
Srijan Choudhary
|
||||
Steeve
|
||||
stefan
|
||||
Stephen Tudor
|
||||
Stephen Woods
|
||||
Steve Brown
|
||||
Steven Humphrey
|
||||
Steven Oliver
|
||||
Stuart Grimshaw
|
||||
Sudar
|
||||
¨switch87¨
|
||||
Tevin Zhang
|
||||
theocrite
|
||||
Thiago de Arruda
|
||||
Thomas Duerr
|
||||
Thomas Szymanski
|
||||
tinyladi
|
||||
Tobias Witt
|
||||
Tobie Warburton
|
||||
Tomasz Wisniewski
|
||||
Tom Vincent
|
||||
Tony
|
||||
Tony Narlock
|
||||
toogley
|
||||
Torbjørn Vatn
|
||||
tormaroe
|
||||
ToruIwashita
|
||||
Travis Holton
|
||||
Trevor Sullivan
|
||||
troydm
|
||||
tUrG0n
|
||||
twabiko
|
||||
Tyler Ball
|
||||
tyronepost
|
||||
Tyrone Post
|
||||
Vadim Khohlov
|
||||
Vincent Hsu
|
||||
Vladimir Rybas
|
||||
Vladislav Khvostov
|
||||
Vorzard
|
||||
Vzaa
|
||||
Waldecir Santos
|
||||
Wildsky Fann
|
||||
William Ma
|
||||
William Travis Holton
|
||||
X4fyr
|
||||
xz.zhang
|
||||
Yamamoto Yuji
|
||||
Yannick Brehon
|
||||
yerv000
|
||||
Yike Lu
|
||||
yuhuanbo
|
||||
Yu Huanbo
|
||||
Yves Lange
|
||||
yvhn
|
||||
zauguin
|
||||
Zaven Muradyan
|
||||
ZPH
|
@ -1,6 +1,8 @@
|
||||
snipMate & UltiSnip Snippets
|
||||
============================
|
||||
|
||||
[](https://travis-ci.org/honza/vim-snippets)
|
||||
|
||||
This repository contains snippets files for various programming languages.
|
||||
|
||||
It is community-maintained and many people have contributed snippet files and
|
||||
@ -58,6 +60,26 @@ improved by Adnan Zafar. So maybe time is not ready to make a final decision yet
|
||||
|
||||
[github issue/discussion](https://github.com/honza/vim-snippets/issues/363)
|
||||
|
||||
Vendor Snippets
|
||||
---------------
|
||||
|
||||
Additional library and framework snippets are available for UltiSnips users in
|
||||
the `UltiSnips/` directory. These files are removed from the default language
|
||||
namespaces to prevent them from all being loaded automatically. If there is a
|
||||
separate library, framework, or package you would like to support open a pull
|
||||
request!
|
||||
|
||||
Additional snippets can be added to the current buffer with the
|
||||
`:UltiSnipsAddFiletypes` command followed by the snippet name without the
|
||||
"snippets" ending. For example, to add the JavaScript Jasmine snippets, run:
|
||||
`:UltiSnipsAddFiletypes javascript-jasmine`. To have this snippet loaded
|
||||
everytime a JavaScript file is opened or created you can add the command to your
|
||||
-`.vim/ftplugin/javascript.vim` file. Another way is to add
|
||||
`autocmd FileType js UltiSnipsAddFiletypes javascript-jasmine` in your `.vimrc`.
|
||||
|
||||
|
||||
For more see the UltiSnips docs (`:help UltiSnips`).
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
@ -109,14 +131,14 @@ Don't add useless placeholder default texts like:
|
||||
|
||||
```
|
||||
if (${1:condition}){
|
||||
${2:some code here}
|
||||
${0:some code here}
|
||||
}
|
||||
```
|
||||
instead use:
|
||||
|
||||
```
|
||||
if (${1}){
|
||||
${2}
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
```
|
||||
|
||||
@ -126,6 +148,8 @@ get vim-dev plugin which has function completion
|
||||
|
||||
Thus for conditions (while, if ..) and block bodies just use ${N} - Thanks
|
||||
|
||||
When the snippet can be used to wrap existing code leverage `${VISUAL}`
|
||||
|
||||
Open questions:
|
||||
What about one line if ee then .. else .. vs if \n .. then \n ... \n else \n .. ?
|
||||
Which additional policies to add?
|
||||
@ -149,6 +173,7 @@ so that all users can benefit from them. People can list their snippet reposito
|
||||
* https://github.com/sudar/vim-arduino-snippets (snippets for Arduino files)
|
||||
* https://github.com/zedr/zope-snipmate-bundle.git (snippets for Python, TAL and ZCML)
|
||||
* https://github.com/bonsaiben/bootstrap-snippets (snippets for Twitter Bootstrap markup, in HTML and Haml)
|
||||
* https://github.com/sniphpets (advanced snippets for PHP, Symfony 2/3, Doctrine and etc.)
|
||||
|
||||
Installation using VAM: https://github.com/MarcWeber/vim-addon-manager
|
||||
|
||||
@ -205,15 +230,16 @@ to maintain snippets for a language, please get in touch.
|
||||
Notes: People are interested in snippets - and their interest may wane again.
|
||||
This list is kept up-to-date on a best effort basis.
|
||||
|
||||
* Python - [honza](http://github.com/honza)
|
||||
* Javascript - [honza](http://github.com/honza)
|
||||
* HTML Django - [honza](http://github.com/honza)
|
||||
* Markdown - [honza](http://github.com/honza)
|
||||
* Ruby - [taq](http://github.com/taq)
|
||||
* PHP - [chrisyue](http://github.com/chrisyue)
|
||||
* Scala - [gorodinskiy](https://github.com/gorodinskiy)
|
||||
* Elixir - [lpil](https://github.com/lpil), [iurifq](https://github.com/iurifq)
|
||||
* Falcon - [steveno](https://github.com/steveno)
|
||||
* Elixir - [iurifq](https://github.com/iurifq)
|
||||
* HTML Django - [honza](http://github.com/honza)
|
||||
* Javascript - [honza](http://github.com/honza)
|
||||
* Markdown - [honza](http://github.com/honza)
|
||||
* PHP - [chrisyue](http://github.com/chrisyue)
|
||||
* Python - [honza](http://github.com/honza)
|
||||
* Ruby - [taq](http://github.com/taq)
|
||||
* Scala - [gorodinskiy](https://github.com/gorodinskiy)
|
||||
* Supercollider - [lpil](https://github.com/lpil)
|
||||
|
||||
License
|
||||
-------
|
||||
|
@ -5,16 +5,14 @@ global !p
|
||||
def ada_case(word):
|
||||
out = word[0].upper()
|
||||
for i in range(1, len(word)):
|
||||
if word[i - 1] == '_':
|
||||
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
|
||||
|
||||
def get_year():
|
||||
import time
|
||||
return time.strftime("%Y")
|
||||
|
||||
endglobal
|
||||
|
||||
snippet wi "with"
|
||||
@ -281,44 +279,4 @@ snippet newline "Ada.Text_IO.New_Line"
|
||||
Ada.Text_IO.New_Line(${1:1});$0
|
||||
endsnippet
|
||||
|
||||
snippet gpl "GPL license header"
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU ${1}General Public License as published by
|
||||
-- the Free Software Foundation; either version ${2:3} 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 $1General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU $1General Public License
|
||||
-- along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- Copyright (C) ${3:Author}, ${4:`!p snip.rv = get_year()`}
|
||||
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet gplf "GPL file license header"
|
||||
-- This file is part of ${1:Program-Name}.
|
||||
--
|
||||
-- $1 is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU ${2}General Public License as published by
|
||||
-- the Free Software Foundation, either version ${3:3} of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- $1 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 $2General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU $2General Public License
|
||||
-- along with $1. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- Copyright (C) ${4:Author}, ${5:`!p snip.rv = get_year()`}
|
||||
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
||||
|
@ -10,104 +10,47 @@ priority -60
|
||||
# NICE BOXES #
|
||||
##############
|
||||
global !p
|
||||
import string, vim
|
||||
|
||||
""" Maps a filetype to comment format used for boxes.
|
||||
Automatically filled during usage"""
|
||||
_commentDict = { }
|
||||
|
||||
def _parse_comments(s):
|
||||
""" Parses vim's comments option to extract comment format """
|
||||
i = iter(s.split(","))
|
||||
|
||||
rv = []
|
||||
try:
|
||||
while True:
|
||||
# get the flags and text of a comment part
|
||||
flags, text = next(i).split(':', 1)
|
||||
|
||||
if len(flags) == 0:
|
||||
rv.append((text, text, text, ""))
|
||||
# parse 3-part comment, but ignore those with O flag
|
||||
elif flags[0] == 's' and 'O' not in flags:
|
||||
ctriple = []
|
||||
indent = ""
|
||||
|
||||
if flags[-1] in string.digits:
|
||||
indent = " " * int(flags[-1])
|
||||
ctriple.append(text)
|
||||
|
||||
flags,text = next(i).split(':', 1)
|
||||
assert(flags[0] == 'm')
|
||||
ctriple.append(text)
|
||||
|
||||
flags,text = next(i).split(':', 1)
|
||||
assert(flags[0] == 'e')
|
||||
ctriple.append(text)
|
||||
ctriple.append(indent)
|
||||
|
||||
rv.append(ctriple)
|
||||
elif flags[0] == 'b':
|
||||
if len(text) == 1:
|
||||
rv.insert(0, (text,text,text, ""))
|
||||
except StopIteration:
|
||||
return rv
|
||||
|
||||
def _get_comment_format():
|
||||
""" Returns a 4-element tuple representing the comment format for
|
||||
the current file. """
|
||||
return _parse_comments(vim.eval("&comments"))[0]
|
||||
|
||||
|
||||
def make_box(twidth, bwidth=None):
|
||||
b, m, e, i = _get_comment_format()
|
||||
bwidth_inner = bwidth - 3 - max(len(b), len(i + e)) if bwidth else twidth + 2
|
||||
sline = b + m + bwidth_inner * m[0] + 2 * m[0]
|
||||
nspaces = (bwidth_inner - twidth) // 2
|
||||
mlines = i + m + " " + " " * nspaces
|
||||
mlinee = " " + " "*(bwidth_inner - twidth - nspaces) + m
|
||||
eline = i + m + bwidth_inner * m[0] + 2 * m[0] + e
|
||||
return sline, mlines, mlinee, eline
|
||||
|
||||
def foldmarker():
|
||||
"Return a tuple of (open fold marker, close fold marker)"
|
||||
return vim.eval("&foldmarker").split(",")
|
||||
|
||||
from vimsnippets import foldmarker, make_box, get_comment_format
|
||||
endglobal
|
||||
|
||||
snippet box "A nice box with the current comment symbol" b
|
||||
`!p
|
||||
box = make_box(len(t[1]))
|
||||
snip.rv = box[0] + '\n' + box[1]
|
||||
`${1:content}`!p
|
||||
snip.rv = box[0]
|
||||
snip += box[1]
|
||||
`${1:${VISUAL:content}}`!p
|
||||
box = make_box(len(t[1]))
|
||||
snip.rv = box[2] + '\n' + box[3]`
|
||||
snip.rv = box[2]
|
||||
snip += box[3]`
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet bbox "A nice box over the full width" b
|
||||
`!p
|
||||
width = int(vim.eval("&textwidth")) or 71
|
||||
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] + '\n' + box[1]
|
||||
`${1:content}`!p
|
||||
snip.rv = box[0]
|
||||
snip += box[1]
|
||||
`${1:${VISUAL:content}}`!p
|
||||
box = make_box(len(t[1]), width)
|
||||
snip.rv = box[2] + '\n' + box[3]`
|
||||
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]`
|
||||
`!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]`
|
||||
`!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]`
|
||||
`!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]`
|
||||
`!p snip.rv = get_comment_format()[0]` `!p snip.rv = foldmarker()[1]` $1 `!p snip.rv = get_comment_format()[2]`
|
||||
endsnippet
|
||||
|
||||
##########################
|
||||
@ -130,4 +73,31 @@ 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("%F")`
|
||||
endsnippet
|
||||
|
||||
snippet ddate "Month DD, YYYY" w
|
||||
`!v strftime("%b %d, %Y")`
|
||||
endsnippet
|
||||
|
||||
snippet diso "ISO format datetime" w
|
||||
`!v strftime("%F %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
|
||||
|
||||
# vim:ft=snippets:
|
||||
|
@ -5,29 +5,21 @@
|
||||
priority -50
|
||||
|
||||
snippet def "#define ..."
|
||||
#define ${1}
|
||||
#define $1
|
||||
endsnippet
|
||||
|
||||
snippet ifndef "#ifndef ... #define ... #endif"
|
||||
snippet #ifndef "#ifndef ... #define ... #endif"
|
||||
#ifndef ${1/([A-Za-z0-9_]+).*/$1/}
|
||||
#define ${1:SYMBOL} ${2:value}
|
||||
#endif
|
||||
#endif /* ifndef $1 */
|
||||
endsnippet
|
||||
|
||||
snippet #if "#if #endif" b
|
||||
#if ${1:0}
|
||||
${VISUAL}${0}
|
||||
${VISUAL}$0
|
||||
#endif
|
||||
endsnippet
|
||||
|
||||
snippet inc "#include local header (inc)"
|
||||
#include "${1:`!p snip.rv = snip.basename + '.h'`}"
|
||||
endsnippet
|
||||
|
||||
snippet Inc "#include <> (Inc)"
|
||||
#include <${1:.h}>
|
||||
endsnippet
|
||||
|
||||
snippet mark "#pragma mark (mark)"
|
||||
#if 0
|
||||
${1:#pragma mark -
|
||||
@ -40,29 +32,23 @@ endsnippet
|
||||
snippet main "main() (main)"
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
${VISUAL}${0}
|
||||
${VISUAL}$0
|
||||
return 0;
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet for "for loop (for)"
|
||||
for (${2:i} = 0; $2 < ${1:count}; ${3:++$2})
|
||||
{
|
||||
${VISUAL}${0}
|
||||
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}
|
||||
for (${4:int} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet enum "Enumeration"
|
||||
enum ${1:name} { $0 };
|
||||
endsnippet
|
||||
|
||||
snippet once "Include header once only guard"
|
||||
#ifndef ${1:`!p
|
||||
if not snip.c:
|
||||
@ -74,58 +60,18 @@ else:
|
||||
snip.rv = snip.c`}
|
||||
#define $1
|
||||
|
||||
${VISUAL}${0}
|
||||
${VISUAL}$0
|
||||
|
||||
#endif /* end of include guard: $1 */
|
||||
endsnippet
|
||||
|
||||
snippet td "Typedef"
|
||||
typedef ${1:int} ${2:MyCustomType};
|
||||
endsnippet
|
||||
|
||||
snippet wh "while loop"
|
||||
while(${1:/* condition */}) {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet do "do...while loop (do)"
|
||||
do {
|
||||
${VISUAL}${0}
|
||||
} while(${1:/* condition */});
|
||||
endsnippet
|
||||
|
||||
snippet fprintf "fprintf ..."
|
||||
fprintf(${1:stderr}, "${2:%s}\n"${2/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$3${2/([^%]|%%)*(%.)?.*/(?2:\);)/}
|
||||
endsnippet
|
||||
|
||||
snippet if "if .. (if)"
|
||||
if (${1:/* condition */})
|
||||
{
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet el "else .. (else)"
|
||||
else {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet eli "else if .. (eli)"
|
||||
else if (${1:/* condition */}) {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ife "if .. else (ife)"
|
||||
if (${1:/* condition */})
|
||||
{
|
||||
${2}
|
||||
}
|
||||
else
|
||||
{
|
||||
${3:/* else */}
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -134,21 +80,20 @@ printf("${1:%s}\n"${1/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$2${1/([^%]|%%)*(%.)?.*/(?2
|
||||
endsnippet
|
||||
|
||||
snippet st "struct"
|
||||
struct ${1:`!p snip.rv = (snip.basename or "name") + "_t"`}
|
||||
{
|
||||
struct ${1:`!p snip.rv = (snip.basename or "name") + "_t"`} {
|
||||
${0:/* data */}
|
||||
};
|
||||
endsnippet
|
||||
|
||||
snippet fun "function" b
|
||||
${1:void} ${2:function_name}(${3})
|
||||
${1:void} ${2:function_name}($3)
|
||||
{
|
||||
${VISUAL}${0}
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet fund "function declaration" b
|
||||
${1:void} ${2:function_name}(${3});
|
||||
${1:void} ${2:function_name}($3);
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
||||
|
@ -0,0 +1,80 @@
|
||||
#
|
||||
# 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
|
@ -94,3 +94,7 @@ endsnippet
|
||||
snippet log "Log" b
|
||||
console.log ${1:"${2:msg}"}
|
||||
endsnippet
|
||||
|
||||
snippet kv "Key:value for object" b
|
||||
${1:key}:${2:value}
|
||||
endsnippet
|
||||
|
@ -4,6 +4,28 @@ 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 #
|
||||
@ -27,7 +49,7 @@ endsnippet
|
||||
snippet ns "namespace .. (namespace)"
|
||||
namespace${1/.+/ /m}${1:`!p snip.rv = snip.basename or "name"`}
|
||||
{
|
||||
${VISUAL}${0}
|
||||
${VISUAL}$0
|
||||
}${1/.+/ \/* /m}$1${1/.+/ *\/ /m}
|
||||
endsnippet
|
||||
|
||||
@ -54,4 +76,35 @@ 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
|
||||
# vim:ft=snippets:
|
||||
|
13
sources_non_forked/vim-snippets/UltiSnips/crystal.snippets
Normal file
13
sources_non_forked/vim-snippets/UltiSnips/crystal.snippets
Normal file
@ -0,0 +1,13 @@
|
||||
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
|
@ -16,7 +16,7 @@ namespace ${1:MyNamespace}
|
||||
endsnippet
|
||||
|
||||
snippet class "class" w
|
||||
class ${1:MyClass}
|
||||
${1:public} class ${2:MyClass}
|
||||
{
|
||||
$0
|
||||
}
|
||||
@ -259,7 +259,7 @@ finally
|
||||
endsnippet
|
||||
|
||||
snippet throw "throw"
|
||||
throw new ${1}Exception("${2}");
|
||||
throw new $1Exception("$2");
|
||||
endsnippet
|
||||
|
||||
|
||||
@ -288,6 +288,10 @@ 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
|
||||
@ -300,9 +304,9 @@ MessageBox.Show("${1:message}");
|
||||
endsnippet
|
||||
|
||||
|
||||
##################
|
||||
# full methods #
|
||||
##################
|
||||
#############
|
||||
# methods #
|
||||
#############
|
||||
|
||||
snippet equals "Equals method" b
|
||||
public override bool Equals(object obj)
|
||||
@ -316,13 +320,53 @@ public override bool Equals(object obj)
|
||||
}
|
||||
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 comment" b
|
||||
snippet /// "XML summary comment" b
|
||||
/// <summary>
|
||||
/// $1
|
||||
/// $0
|
||||
/// </summary>
|
||||
endsnippet
|
||||
|
||||
snippet <p "XML pramameter comment" b
|
||||
<param name="${1}">${2}</param>
|
||||
endsnippet
|
||||
|
||||
snippet <ex "XML exception comment" b
|
||||
<exception cref="${1:System.Exception}">${2}</exception>
|
||||
endsnippet
|
||||
|
||||
snippet <r "XML returns comment" b
|
||||
<returns>$0</returns>
|
||||
endsnippet
|
||||
|
||||
snippet <c "XML code comment" b
|
||||
<code>$0</code>
|
||||
endsnippet
|
||||
|
@ -1,11 +1,5 @@
|
||||
priority -50
|
||||
|
||||
snippet . "selector { }"
|
||||
$1 {
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet p "padding"
|
||||
padding: ${1:0};$0
|
||||
endsnippet
|
||||
|
5
sources_non_forked/vim-snippets/UltiSnips/cuda.snippets
Normal file
5
sources_non_forked/vim-snippets/UltiSnips/cuda.snippets
Normal file
@ -0,0 +1,5 @@
|
||||
priority -50
|
||||
|
||||
extends cpp
|
||||
|
||||
# vim:ft=snippets:
|
@ -23,7 +23,7 @@ mixin ${1:/*mixed_in*/} ${2:/*name*/};
|
||||
endsnippet
|
||||
|
||||
snippet new "new (new)"
|
||||
new ${1}(${2});
|
||||
new $1($2);
|
||||
endsnippet
|
||||
|
||||
snippet scpn "@safe const pure nothrow (scpn)"
|
||||
@ -98,7 +98,7 @@ endsnippet
|
||||
|
||||
snippet enf "enforce (enf)" b
|
||||
enforce(${1:/*condition*/},
|
||||
new ${2}Exception(${3:/*args*/}));
|
||||
new $2Exception(${3:/*args*/}));
|
||||
endsnippet
|
||||
|
||||
# Branches
|
||||
@ -106,14 +106,14 @@ endsnippet
|
||||
snippet if "if .. (if)"
|
||||
if(${1:/*condition*/})
|
||||
{
|
||||
${VISUAL}${0}
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ife "if .. else (ife)" b
|
||||
if(${1:/*condition*/})
|
||||
{
|
||||
${2}
|
||||
$2
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -124,14 +124,14 @@ endsnippet
|
||||
snippet el "else (el)" b
|
||||
else
|
||||
{
|
||||
${VISUAL}${1}
|
||||
${VISUAL}$1
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet elif "else if (elif)" b
|
||||
else if(${1:/*condition*/})
|
||||
{
|
||||
${VISUAL}${0}
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -139,10 +139,10 @@ snippet sw "switch (sw)"
|
||||
switch(${1:/*var*/})
|
||||
{
|
||||
case ${2:/*value*/}:
|
||||
${3}
|
||||
$3
|
||||
break;
|
||||
case ${4:/*value*/}:
|
||||
${5}
|
||||
$5
|
||||
break;
|
||||
${7:/*more cases*/}
|
||||
default:
|
||||
@ -154,10 +154,10 @@ snippet fsw "final switch (fsw)"
|
||||
final switch(${1:/*var*/})
|
||||
{
|
||||
case ${2:/*value*/}:
|
||||
${3}
|
||||
$3
|
||||
break;
|
||||
case ${4:/*value*/}:
|
||||
${5}
|
||||
$5
|
||||
break;
|
||||
${7:/*more cases*/}
|
||||
}
|
||||
@ -165,7 +165,7 @@ endsnippet
|
||||
|
||||
snippet case "case (case)" b
|
||||
case ${1:/*value*/}:
|
||||
${2}
|
||||
$2
|
||||
break;
|
||||
endsnippet
|
||||
|
||||
@ -178,42 +178,42 @@ endsnippet
|
||||
snippet do "do while (do)" b
|
||||
do
|
||||
{
|
||||
${VISUAL}${2}
|
||||
${VISUAL}$2
|
||||
} while(${1:/*condition*/});
|
||||
endsnippet
|
||||
|
||||
snippet wh "while (wh)" b
|
||||
while(${1:/*condition*/})
|
||||
{
|
||||
${VISUAL}${2}
|
||||
${VISUAL}$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet for "for (for)" b
|
||||
for (${4:size_t} ${2:i} = 0; $2 < ${1:count}; ${3:++$2})
|
||||
{
|
||||
${VISUAL}${0}
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet forever "forever (forever)" b
|
||||
for(;;)
|
||||
{
|
||||
${VISUAL}${0}
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet fore "foreach (fore)"
|
||||
foreach(${1:/*elem*/}; ${2:/*range*/})
|
||||
{
|
||||
${VISUAL}${3}
|
||||
${VISUAL}$3
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet forif "foreach if (forif)" b
|
||||
foreach(${1:/*elem*/}; ${2:/*range*/}) if(${3:/*condition*/})
|
||||
{
|
||||
${VISUAL}${4}
|
||||
${VISUAL}$4
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -222,7 +222,7 @@ snippet in "in contract (in)" b
|
||||
in
|
||||
{
|
||||
assert(${1:/*condition*/}, "${2:error message}");
|
||||
${3}
|
||||
$3
|
||||
}
|
||||
body
|
||||
endsnippet
|
||||
@ -231,7 +231,7 @@ snippet out "out contract (out)" b
|
||||
out${1:(result)}
|
||||
{
|
||||
assert(${2:/*condition*/}, "${3:error message}");
|
||||
${4}
|
||||
$4
|
||||
}
|
||||
body
|
||||
endsnippet
|
||||
@ -240,7 +240,7 @@ snippet inv "invariant (inv)" b
|
||||
invariant()
|
||||
{
|
||||
assert(${1:/*condition*/}, "${2:error message}");
|
||||
${3}
|
||||
$3
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -249,21 +249,21 @@ endsnippet
|
||||
snippet fun "function definition (fun)"
|
||||
${1:void} ${2:/*function name*/}(${3:/*args*/}) ${4:@safe pure nothrow}
|
||||
{
|
||||
${VISUAL}${5}
|
||||
${VISUAL}$5
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet void "void function definition (void)"
|
||||
void ${1:/*function name*/}(${2:/*args*/}) ${3:@safe pure nothrow}
|
||||
{
|
||||
${VISUAL}${4}
|
||||
${VISUAL}$4
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet this "ctor (this)" w
|
||||
this(${1:/*args*/})
|
||||
{
|
||||
${VISUAL}${2}
|
||||
${VISUAL}$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -295,16 +295,16 @@ endsnippet
|
||||
snippet scope "scope (scope)" b
|
||||
scope(${1:exit})
|
||||
{
|
||||
${VISUAL}${2}
|
||||
${VISUAL}$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
# With
|
||||
|
||||
snippet with "with (with)"
|
||||
with(${1})
|
||||
with($1)
|
||||
{
|
||||
${VISUAL}${2}
|
||||
${VISUAL}$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -315,7 +315,7 @@ try
|
||||
{
|
||||
${VISUAL}${1:/*code to try*/}
|
||||
}
|
||||
catch(${2}Exception e)
|
||||
catch($2Exception e)
|
||||
{
|
||||
${3:/*handle exception*/}
|
||||
}
|
||||
@ -326,7 +326,7 @@ try
|
||||
{
|
||||
${VISUAL}${1:/*code to try*/}
|
||||
}
|
||||
catch(${2}Exception e)
|
||||
catch($2Exception e)
|
||||
{
|
||||
${3:/*handle exception*/}
|
||||
}
|
||||
@ -337,14 +337,14 @@ finally
|
||||
endsnippet
|
||||
|
||||
snippet catch "catch (catch)" b
|
||||
catch(${1}Exception e)
|
||||
catch($1Exception e)
|
||||
{
|
||||
${2:/*handle exception*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet thr "throw (thr)"
|
||||
throw new ${1}Exception("${2}");
|
||||
throw new $1Exception("$2");
|
||||
endsnippet
|
||||
|
||||
|
||||
@ -353,35 +353,35 @@ endsnippet
|
||||
snippet struct "struct (struct)"
|
||||
struct ${1:`!p snip.rv = (snip.basename or "name")`}
|
||||
{
|
||||
${2}
|
||||
$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet union "union (union)"
|
||||
union ${1:`!p snip.rv = (snip.basename or "name")`}
|
||||
{
|
||||
${2}
|
||||
$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet class "class (class)"
|
||||
class ${1:`!p snip.rv = (snip.basename or "name")`}
|
||||
{
|
||||
${2}
|
||||
$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet inter "interface (inter)"
|
||||
interface ${1:`!p snip.rv = (snip.basename or "name")`}
|
||||
{
|
||||
${2}
|
||||
$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet enum "enum (enum)"
|
||||
enum ${1:`!p snip.rv = (snip.basename or "name")`}
|
||||
{
|
||||
${2}
|
||||
$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -390,7 +390,7 @@ endsnippet
|
||||
|
||||
snippet exc "exception declaration (exc)" b
|
||||
/// ${3:/*documentation*/}
|
||||
class ${1}Exception : ${2}Exception
|
||||
class $1Exception : $2Exception
|
||||
{
|
||||
public this(string msg, string file = __FILE__, int line = __LINE__)
|
||||
{
|
||||
@ -405,14 +405,14 @@ endsnippet
|
||||
snippet version "version (version)" b
|
||||
version(${1:/*version name*/})
|
||||
{
|
||||
${VISUAL}${2}
|
||||
${VISUAL}$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet debug "debug" b
|
||||
debug
|
||||
{
|
||||
${VISUAL}${1}
|
||||
${VISUAL}$1
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -422,7 +422,7 @@ endsnippet
|
||||
snippet temp "template (temp)" b
|
||||
template ${2:/*name*/}(${1:/*args*/})
|
||||
{
|
||||
${3}
|
||||
$3
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -440,7 +440,7 @@ endsnippet
|
||||
snippet unittest "unittest (unittest)" b
|
||||
unittest
|
||||
{
|
||||
${1}
|
||||
$1
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -450,21 +450,21 @@ endsnippet
|
||||
snippet opDis "opDispatch (opDis)" b
|
||||
${1:/*return type*/} opDispatch(string s)()
|
||||
{
|
||||
${2};
|
||||
$2;
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet op= "opAssign (op=)" b
|
||||
void opAssign(${1} rhs) ${2:@safe pure nothrow}
|
||||
void opAssign($1 rhs) ${2:@safe pure nothrow}
|
||||
{
|
||||
${2}
|
||||
$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet opCmp "opCmp (opCmp)" b
|
||||
int opCmp(${1} rhs) @safe const pure nothrow
|
||||
int opCmp($1 rhs) @safe const pure nothrow
|
||||
{
|
||||
${2}
|
||||
$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -484,7 +484,7 @@ endsnippet
|
||||
snippet toString "toString (toString)" b
|
||||
string toString() @safe const pure nothrow
|
||||
{
|
||||
${1}
|
||||
$1
|
||||
}
|
||||
endsnippet
|
||||
|
||||
@ -493,7 +493,7 @@ endsnippet
|
||||
|
||||
|
||||
snippet todo "TODO (todo)"
|
||||
// TODO: ${1}
|
||||
// TODO: $1
|
||||
endsnippet
|
||||
|
||||
|
||||
@ -509,16 +509,16 @@ snippet fdoc "function ddoc block (fdoc)" b
|
||||
/// ${1:description}
|
||||
///
|
||||
/// ${2:Params: ${3:param} = ${4:param description}
|
||||
/// ${5}}
|
||||
/// $5}
|
||||
///
|
||||
/// ${6:Returns: ${7:return value}}
|
||||
///
|
||||
/// ${8:Throws: ${9}Exception ${10}}
|
||||
/// ${8:Throws: $9Exception $10}
|
||||
endsnippet
|
||||
|
||||
snippet Par "Params (Par)"
|
||||
Params: ${1:param} = ${2:param description}
|
||||
/// ${3}
|
||||
/// $3
|
||||
endsnippet
|
||||
|
||||
snippet Ret "Returns (Ret)"
|
||||
@ -526,7 +526,7 @@ Returns: ${1:return value/s}
|
||||
endsnippet
|
||||
|
||||
snippet Thr "Throws (Thr)"
|
||||
Throws: ${1}Exception ${2}
|
||||
Throws: $1Exception $2
|
||||
endsnippet
|
||||
|
||||
snippet Example "Examples (Example)"
|
||||
@ -556,7 +556,7 @@ snippet gpl "GPL (gpl)" b
|
||||
//
|
||||
// Copyright (C) ${1:Author}, `!v strftime("%Y")`
|
||||
|
||||
${2}
|
||||
$2
|
||||
endsnippet
|
||||
|
||||
snippet boost "Boost (boost)" b
|
||||
@ -565,7 +565,7 @@ snippet boost "Boost (boost)" b
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
${2}
|
||||
$2
|
||||
endsnippet
|
||||
|
||||
|
||||
@ -577,8 +577,8 @@ snippet module "New module (module)" b
|
||||
// (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')`;
|
||||
module $2.`!v vim_snippets#Filename('$1', 'name')`;
|
||||
|
||||
|
||||
${3}
|
||||
$3
|
||||
endsnippet
|
||||
|
@ -1,238 +1,361 @@
|
||||
priority -50
|
||||
|
||||
# Generic Tags
|
||||
snippet %
|
||||
{% ${1} %}${2}
|
||||
# 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 %%
|
||||
{% ${1:tag_name} %}
|
||||
${2}
|
||||
{% end$1 %}
|
||||
snippet modelform "ModelForm" b
|
||||
class ${1:MODELNAME}Form(forms.ModelForm):
|
||||
|
||||
class Meta:
|
||||
model = $1
|
||||
endsnippet
|
||||
|
||||
snippet {
|
||||
{{ ${1} }}${2}
|
||||
snippet fbool "BooleanField" b
|
||||
${1:FIELDNAME} = forms.BooleanField($2)
|
||||
endsnippet
|
||||
|
||||
# Template Tags
|
||||
|
||||
snippet autoescape
|
||||
{% autoescape ${1:off} %}
|
||||
${2}
|
||||
{% endautoescape %}
|
||||
snippet fchar "CharField" b
|
||||
${1:FIELDNAME} = forms.CharField($2)
|
||||
endsnippet
|
||||
|
||||
snippet block
|
||||
{% block ${1} %}
|
||||
${2}
|
||||
{% endblock $1 %}
|
||||
snippet fchoice "ChoiceField" b
|
||||
${1:FIELDNAME} = forms.ChoiceField($2)
|
||||
endsnippet
|
||||
|
||||
snippet #
|
||||
{# ${1:comment} #}
|
||||
snippet fcombo "ComboField" b
|
||||
${1:FIELDNAME} = forms.ComboField($2)
|
||||
endsnippet
|
||||
|
||||
snippet comment
|
||||
{% comment %}
|
||||
${1}
|
||||
{% endcomment %}
|
||||
snippet fdate "DateField" b
|
||||
${1:FIELDNAME} = forms.DateField($2)
|
||||
endsnippet
|
||||
|
||||
snippet cycle
|
||||
{% cycle ${1:val1} ${2:val2} ${3:as ${4}} %}
|
||||
snippet fdatetime "DateTimeField" b
|
||||
${1:FIELDNAME} = forms.DateTimeField($2)
|
||||
endsnippet
|
||||
|
||||
snippet debug
|
||||
{% debug %}
|
||||
snippet fdecimal "DecimalField" b
|
||||
${1:FIELDNAME} = forms.DecimalField($2)
|
||||
endsnippet
|
||||
|
||||
snippet extends
|
||||
{% extends "${1:base.html}" %}
|
||||
snippet fmail "EmailField" b
|
||||
${1:FIELDNAME} = forms.EmailField($2)
|
||||
endsnippet
|
||||
|
||||
snippet filter
|
||||
{% filter ${1} %}
|
||||
${2}
|
||||
{% endfilter %}
|
||||
snippet ffile "FileField" b
|
||||
${1:FIELDNAME} = forms.FileField($2)
|
||||
endsnippet
|
||||
|
||||
snippet firstof
|
||||
{% firstof ${1} %}
|
||||
snippet ffilepath "FilePathField" b
|
||||
${1:FIELDNAME} = forms.FilePathField($2)
|
||||
endsnippet
|
||||
|
||||
snippet for
|
||||
{% for ${1} in ${2} %}
|
||||
${3}
|
||||
{% endfor %}
|
||||
snippet ffloat "FloatField" b
|
||||
${1:FIELDNAME} = forms.FloatField($2)
|
||||
endsnippet
|
||||
|
||||
snippet empty
|
||||
{% empty %}
|
||||
${1}
|
||||
snippet fip "IPAddressField" b
|
||||
${1:FIELDNAME} = forms.IPAddressField($2)
|
||||
endsnippet
|
||||
|
||||
snippet if
|
||||
{% if ${1} %}
|
||||
${2}
|
||||
{% endif %}
|
||||
snippet fimg "ImageField" b
|
||||
${1:FIELDNAME} = forms.ImageField($2)
|
||||
endsnippet
|
||||
|
||||
snippet else
|
||||
{% else %}
|
||||
${1}
|
||||
snippet fint "IntegerField" b
|
||||
${1:FIELDNAME} = forms.IntegerField($2)
|
||||
endsnippet
|
||||
|
||||
snippet ifchanged
|
||||
{% ifchanged %}${1}{% endifchanged %}
|
||||
snippet fmochoice "ModelChoiceField" b
|
||||
${1:FIELDNAME} = forms.ModelChoiceField($2)
|
||||
endsnippet
|
||||
|
||||
snippet ifequal
|
||||
{% ifequal ${1} ${2} %}
|
||||
${3}
|
||||
{% endifequal %}
|
||||
snippet fmomuchoice "ModelMultipleChoiceField" b
|
||||
${1:FIELDNAME} = forms.ModelMultipleChoiceField($2)
|
||||
endsnippet
|
||||
|
||||
snippet ifnotequal
|
||||
{% ifnotequal ${1} ${2} %}
|
||||
${3}
|
||||
{% endifnotequal %}
|
||||
snippet fmuval "MultiValueField" b
|
||||
${1:FIELDNAME} = forms.MultiValueField($2)
|
||||
endsnippet
|
||||
|
||||
snippet include
|
||||
{% include "${1}" %}
|
||||
snippet fmuchoice "MultipleChoiceField" b
|
||||
${1:FIELDNAME} = forms.MultipleChoiceField($2)
|
||||
endsnippet
|
||||
|
||||
snippet load
|
||||
{% load ${1} %}
|
||||
snippet fnullbool "NullBooleanField" b
|
||||
${1:FIELDNAME} = forms.NullBooleanField($2)
|
||||
endsnippet
|
||||
|
||||
snippet now
|
||||
{% now "${1:jS F Y H:i}" %}
|
||||
snippet freg "RegexField" b
|
||||
${1:FIELDNAME} = forms.RegexField($2)
|
||||
endsnippet
|
||||
|
||||
snippet regroup
|
||||
{% regroup ${1} by ${2} as ${3} %}
|
||||
snippet fslug "SlugField" b
|
||||
${1:FIELDNAME} = forms.SlugField($2)
|
||||
endsnippet
|
||||
|
||||
snippet spaceless
|
||||
{% spaceless %}${1}{% endspaceless %}
|
||||
snippet fsdatetime "SplitDateTimeField" b
|
||||
${1:FIELDNAME} = forms.SplitDateTimeField($2)
|
||||
endsnippet
|
||||
|
||||
snippet ssi
|
||||
{% ssi ${1} %}
|
||||
snippet ftime "TimeField" b
|
||||
${1:FIELDNAME} = forms.TimeField($2)
|
||||
endsnippet
|
||||
|
||||
snippet trans
|
||||
{% trans "${1:string}" %}
|
||||
snippet ftchoice "TypedChoiceField" b
|
||||
${1:FIELDNAME} = forms.TypedChoiceField($2)
|
||||
endsnippet
|
||||
|
||||
snippet url
|
||||
{% url ${1} as ${2} %}
|
||||
snippet ftmuchoice "TypedMultipleChoiceField" b
|
||||
${1:FIELDNAME} = forms.TypedMultipleChoiceField($2)
|
||||
endsnippet
|
||||
|
||||
snippet widthratio
|
||||
{% widthratio ${1:this_value} ${2:max_value} ${3:100} %}
|
||||
snippet furl "URLField" b
|
||||
${1:FIELDNAME} = forms.URLField($2)
|
||||
endsnippet
|
||||
|
||||
snippet with
|
||||
{% with ${1} as ${2} %}
|
||||
# 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
|
||||
|
||||
# Template Filters
|
||||
snippet modelfull "Model" b
|
||||
class ${1:MODELNAME}(models.Model):
|
||||
${2:# TODO: Define fields here}
|
||||
|
||||
# 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.
|
||||
class Meta:
|
||||
verbose_name = "$1"
|
||||
verbose_name_plural = "$1s"
|
||||
|
||||
# Note: Template tags that take no arguments are not implemented.
|
||||
def __str__(self):
|
||||
return super($1, self).__str__()
|
||||
|
||||
def save(self):
|
||||
return super($1, self).save()
|
||||
|
||||
@models.permalink
|
||||
def get_absolute_url(self):
|
||||
return ('')
|
||||
|
||||
${3:# TODO: Define custom methods here}
|
||||
|
||||
snippet add
|
||||
add:"${1}"
|
||||
endsnippet
|
||||
|
||||
snippet center
|
||||
center:"${1}"
|
||||
snippet mauto "AutoField" b
|
||||
${1:FIELDNAME} = models.AutoField($2)
|
||||
endsnippet
|
||||
|
||||
snippet cut
|
||||
cut:"${1}"
|
||||
snippet mbigint "BigIntegerField" b
|
||||
${1:FIELDNAME} = models.BigIntegerField($2)
|
||||
endsnippet
|
||||
|
||||
snippet date
|
||||
date:"${1}"
|
||||
snippet mbool "BooleanField" b
|
||||
${1:FIELDNAME} = models.BooleanField($2)
|
||||
endsnippet
|
||||
|
||||
snippet default
|
||||
default:"${1}"
|
||||
snippet mchar "CharField" b
|
||||
${1:FIELDNAME} = models.CharField($2, max_length=${3:50})
|
||||
endsnippet
|
||||
|
||||
snippet defaultifnone
|
||||
default_if_none:"${1}"
|
||||
snippet mcoseint "CommaSeparatedIntegerField" b
|
||||
${1:FIELDNAME} = models.CommaSeparatedIntegerField($2)
|
||||
endsnippet
|
||||
|
||||
snippet dictsort
|
||||
dictsort:"${1}"
|
||||
snippet mdate "DateField" b
|
||||
${1:FIELDNAME} = models.DateField($2)
|
||||
endsnippet
|
||||
|
||||
snippet dictsortrev
|
||||
dictsortreversed:"${1}"
|
||||
snippet mdatetime "DateTimeField" b
|
||||
${1:FIELDNAME} = models.DateTimeField($2)
|
||||
endsnippet
|
||||
|
||||
snippet divisibleby
|
||||
divisibleby:"${1}"
|
||||
snippet mdecimal "DecimalField" b
|
||||
${1:FIELDNAME} = models.DecimalField(max_digits=${2:10}, decimal_places=${3:2})
|
||||
endsnippet
|
||||
|
||||
snippet floatformat
|
||||
floatformat:"${1}"
|
||||
snippet memail "EmailField" b
|
||||
${1:FIELDNAME} = models.EmailField($2)
|
||||
endsnippet
|
||||
|
||||
snippet getdigit
|
||||
get_digit:"${1}"
|
||||
snippet mfile "FileField" b
|
||||
${1:FIELDNAME} = models.FileField($2)
|
||||
endsnippet
|
||||
|
||||
snippet join
|
||||
join:"${1}"
|
||||
snippet mfilepath "FilePathField" b
|
||||
${1:FIELDNAME} = models.FilePathField($2)
|
||||
endsnippet
|
||||
|
||||
snippet lengthis
|
||||
length_is:"${1}"
|
||||
snippet mfloat "FloatField" b
|
||||
${1:FIELDNAME} = models.FloatField($2)
|
||||
endsnippet
|
||||
|
||||
snippet pluralize
|
||||
pluralize:"${1}"
|
||||
snippet fk "ForeignKey" b
|
||||
${1:FIELDNAME} = models.ForeignKey($2)
|
||||
endsnippet
|
||||
|
||||
snippet removetags
|
||||
removetags:"${1}"
|
||||
snippet mip "IPAddressField" b
|
||||
${1:FIELDNAME} = models.IPAddressField($2)
|
||||
endsnippet
|
||||
|
||||
snippet slice
|
||||
slice:"${1}"
|
||||
snippet mimg "ImageField" b
|
||||
${1:FIELDNAME} = models.ImageField($2)
|
||||
endsnippet
|
||||
|
||||
snippet stringformat
|
||||
stringformat:"${1}"
|
||||
snippet mint "IntegerField" b
|
||||
${1:FIELDNAME} = models.IntegerField($2)
|
||||
endsnippet
|
||||
|
||||
snippet time
|
||||
time:"${1}"
|
||||
snippet m2m "ManyToManyField" b
|
||||
${1:FIELDNAME} = models.ManyToManyField($2)
|
||||
endsnippet
|
||||
|
||||
snippet truncatewords
|
||||
truncatewords:${1}
|
||||
snippet mnullbool "NullBooleanField" b
|
||||
${1:FIELDNAME} = models.NullBooleanField($2)
|
||||
endsnippet
|
||||
|
||||
snippet truncatewordshtml
|
||||
truncatewords_html:${1}
|
||||
snippet o2o "OneToOneField" b
|
||||
${1:FIELDNAME} = models.OneToOneField($2)
|
||||
endsnippet
|
||||
|
||||
snippet urlizetrunc
|
||||
urlizetrunc:${1}
|
||||
snippet mphone "PhoneNumberField" b
|
||||
${1:FIELDNAME} = models.PhoneNumberField($2)
|
||||
endsnippet
|
||||
|
||||
snippet wordwrap
|
||||
wordwrap:${1}
|
||||
snippet mposint "PositiveIntegerField" b
|
||||
${1:FIELDNAME} = models.PositiveIntegerField($2)
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
||||
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:MODEL_NAME}
|
||||
template_name = "${2:TEMPLATE_NAME}"
|
||||
endsnippet
|
||||
|
||||
snippet deleteview "Generic Delete View" b
|
||||
class ${1:MODEL_NAME}DeleteView(DeleteView):
|
||||
model = ${1:MODEL_NAME}
|
||||
template_name = "${2:TEMPLATE_NAME}"
|
||||
endsnippet
|
||||
|
||||
snippet detailview "Generic Detail View" b
|
||||
class ${1:MODEL_NAME}DetailView(DetailView):
|
||||
model = ${1:MODEL_NAME}
|
||||
template_name = "${2:TEMPLATE_NAME}"
|
||||
endsnippet
|
||||
|
||||
snippet listview "Generic List View" b
|
||||
class ${1:MODEL_NAME}ListView(ListView):
|
||||
model = ${1:MODEL_NAME}
|
||||
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:MODEL_NAME}
|
||||
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
|
||||
|
39
sources_non_forked/vim-snippets/UltiSnips/eelixir.snippets
Normal file
39
sources_non_forked/vim-snippets/UltiSnips/eelixir.snippets
Normal file
@ -0,0 +1,39 @@
|
||||
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
|
@ -1,168 +0,0 @@
|
||||
priority -50
|
||||
|
||||
snippet do
|
||||
do
|
||||
${1}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet if "if .. do .. end"
|
||||
if ${1:condition} do
|
||||
${2:expression}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet if "if .. do: .."
|
||||
if ${1:condition}, do: ${2:expression}
|
||||
endsnippet
|
||||
|
||||
snippet ife "if .. do .. else .. end"
|
||||
if ${1:condition} do
|
||||
${2:expression}
|
||||
else
|
||||
${3:expression}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet ife "if .. do: .. else:"
|
||||
if ${1:condition}, do: ${2}, else: ${3}
|
||||
endsnippet
|
||||
|
||||
snippet unless "unless .. do .. end"
|
||||
unless ${1} do
|
||||
${2}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet unless "unless .. do: .."
|
||||
unless ${1:condition}, do: ${2}
|
||||
endsnippet
|
||||
|
||||
snippet unlesse "unless .. do .. else .. end"
|
||||
unless ${1:condition} do
|
||||
${2}
|
||||
else
|
||||
${3}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet unlesse "unless .. do: .. else:"
|
||||
unless ${1:condition}, do: ${2}, else: ${3}
|
||||
endsnippet
|
||||
|
||||
snippet cond
|
||||
"cond do"
|
||||
${1} ->
|
||||
${2}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet case
|
||||
case ${1} do
|
||||
${2} ->
|
||||
${3}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet def
|
||||
def ${1:name} do
|
||||
${2}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet defin "def function(n), do: n"
|
||||
def ${1:name}, do: ${2}
|
||||
endsnippet
|
||||
|
||||
snippet defg
|
||||
def ${1:name} when ${2:guard-condition} do
|
||||
${3}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet defim
|
||||
defimpl ${1:protocol_name}, for: ${2:data_type} do
|
||||
${3}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet defma
|
||||
defmacro ${1:name} do
|
||||
${2}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet defmo
|
||||
defmodule ${1:module_name} do
|
||||
${2}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet defp
|
||||
defp ${1:name} do
|
||||
${2}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet defpr
|
||||
defprotocol ${1:name}, [${2:function}]
|
||||
endsnippet
|
||||
|
||||
snippet defr
|
||||
defrecord ${1:record_name}, ${2:fields}
|
||||
endsnippet
|
||||
|
||||
snippet doc
|
||||
@doc """
|
||||
${1}
|
||||
"""
|
||||
endsnippet
|
||||
|
||||
snippet fn
|
||||
fn(${1:args}) -> ${2} end
|
||||
endsnippet
|
||||
|
||||
snippet fun
|
||||
function do
|
||||
${1}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet mdoc
|
||||
@moduledoc """
|
||||
${1}
|
||||
"""
|
||||
endsnippet
|
||||
|
||||
snippet rec
|
||||
receive do
|
||||
${1} ->
|
||||
${2}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet req
|
||||
require ${1:module_name}
|
||||
endsnippet
|
||||
|
||||
snippet imp
|
||||
import ${1:module_name}
|
||||
endsnippet
|
||||
|
||||
snippet ali "alias old-module to shorthand"
|
||||
alias ${1:module_name}
|
||||
endsnippet
|
||||
|
||||
snippet test
|
||||
test "${1:test_name}" do
|
||||
${2}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet try "try .. rescue .. end"
|
||||
try do
|
||||
${1}
|
||||
rescue
|
||||
${2} -> ${3}
|
||||
end
|
||||
endsnippet
|
@ -5,12 +5,12 @@
|
||||
priority -50
|
||||
|
||||
snippet pat "Case:Receive:Try Clause"
|
||||
${1:pattern}${2: when ${3:guard}} ->;
|
||||
${1:pattern}${2: when ${3:guard}} ->
|
||||
${4:body}
|
||||
endsnippet
|
||||
|
||||
snippet beh "Behaviour Directive"
|
||||
-behaviour (${1:behaviour}).
|
||||
snippet beh "Behaviour Directive" b
|
||||
-behaviour(${1:behaviour}).
|
||||
endsnippet
|
||||
|
||||
snippet case "Case Expression"
|
||||
@ -20,12 +20,12 @@ case ${1:expression} of
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet def "Define Directive"
|
||||
-define (${1:macro}${2: (${3:param})}, ${4:body}).
|
||||
snippet def "Define Directive" b
|
||||
-define(${1:macro}${2: (${3:param})}, ${4:body}).
|
||||
endsnippet
|
||||
|
||||
snippet exp "Export Directive"
|
||||
-export ([${1:function}/${2:arity}]).
|
||||
snippet exp "Export Directive" b
|
||||
-export([${1:function}/${2:arity}]).
|
||||
endsnippet
|
||||
|
||||
snippet fun "Fun Expression"
|
||||
@ -36,7 +36,7 @@ end
|
||||
endsnippet
|
||||
|
||||
snippet fu "Function"
|
||||
${1:function} (${2:param})${3: when ${4:guard}} ->
|
||||
${1:function}(${2:param})${3: when ${4:guard}} ->
|
||||
${5:body}
|
||||
endsnippet
|
||||
|
||||
@ -47,24 +47,24 @@ if
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet ifdef "Ifdef Directive"
|
||||
-ifdef (${1:macro}).
|
||||
snippet ifdef "Ifdef Directive" b
|
||||
-ifdef(${1:macro}).
|
||||
endsnippet
|
||||
|
||||
snippet ifndef "Ifndef Directive"
|
||||
-ifndef (${1:macro}).
|
||||
snippet ifndef "Ifndef Directive" b
|
||||
-ifndef(${1:macro}).
|
||||
endsnippet
|
||||
|
||||
snippet imp "Import Directive"
|
||||
-import (${1:module}, [${2:function}/${3:arity}]).
|
||||
snippet imp "Import Directive" b
|
||||
-import(${1:module}, [${2:function}/${3:arity}]).
|
||||
endsnippet
|
||||
|
||||
snippet inc "Include Directive"
|
||||
-include ("${1:file}").
|
||||
snippet inc "Include Directive" b
|
||||
-include("${1:file}").
|
||||
endsnippet
|
||||
|
||||
snippet mod "Module Directive"
|
||||
-module (${1:`!p snip.rv = snip.basename or "module"`}).
|
||||
snippet mod "Module Directive" b
|
||||
-module(${1:`!p snip.rv = snip.basename or "module"`}).
|
||||
endsnippet
|
||||
|
||||
snippet rcv "Receive Expression"
|
||||
@ -77,8 +77,8 @@ ${6:after
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet rec "Record Directive"
|
||||
-record (${1:record}, {${2:field}${3: = ${4:value}}}).
|
||||
snippet rec "Record Directive" b
|
||||
-record(${1:record}, {${2:field}${3: = ${4:value}}}).
|
||||
endsnippet
|
||||
|
||||
snippet try "Try Expression"
|
||||
@ -93,8 +93,16 @@ ${13:after
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet undef "Undef Directive"
|
||||
-undef (${1:macro}).
|
||||
snippet undef "Undef Directive" b
|
||||
-undef(${1:macro}).
|
||||
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:
|
||||
|
@ -27,12 +27,12 @@ def textmate_var(var, snip):
|
||||
endglobal
|
||||
|
||||
|
||||
snippet % "<% ${0} %>"
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`${0}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)`
|
||||
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} %>"
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`${0}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
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
|
||||
|
||||
###########################################################################
|
||||
@ -43,112 +43,59 @@ 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"
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`form_tag(${1::action => "${5:update}"}${6:, {:${8:class} => "${9:form}"\}}) do`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
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 end "end (ERB)"
|
||||
<% end -%>
|
||||
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 for "for loop (ERB)"
|
||||
<% if !${1:list}.blank? %>
|
||||
<% for ${2:item} in ${1} %>
|
||||
$3
|
||||
<% end %>
|
||||
<% else %>
|
||||
$4
|
||||
<% end %>
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet ffcb "form_for check_box"
|
||||
`!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 ffff "form_for file_field 2"
|
||||
`!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 ffhf "form_for hidden_field 2"
|
||||
`!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 ffl "form_for label 2"
|
||||
`!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 ffpf "form_for password_field 2"
|
||||
`!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 ffrb "form_for radio_box 2"
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.radio_box :${1:attribute}, :${2:tag_value}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet ffs "form_for submit 2"
|
||||
`!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 ffta "form_for text_area 2"
|
||||
`!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 fftf "form_for text_field 2"
|
||||
`!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 fields "fields_for"
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`fields_for :${1:model}, @${2:$1} do |$1|`!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_fields_for (nff)"
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
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_box"
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.radio_box :${1:attribute}, :${2:tag_value}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
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)`
|
||||
@ -156,17 +103,17 @@ snippet ffe "form_for with errors"
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet ff "form_for"
|
||||
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"
|
||||
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"
|
||||
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
|
||||
|
||||
@ -174,47 +121,51 @@ 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"
|
||||
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 lia "link_to (action)"
|
||||
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)"
|
||||
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)"
|
||||
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)"
|
||||
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)"
|
||||
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)"
|
||||
`!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)`
|
||||
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)"
|
||||
`!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)`
|
||||
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)"
|
||||
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)"
|
||||
`!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)`
|
||||
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"
|
||||
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
|
||||
|
||||
@ -266,11 +217,11 @@ snippet rps "render (partial,status) (rps)"
|
||||
render :partial => "${1:item}", :status => ${2:500}
|
||||
endsnippet
|
||||
|
||||
snippet slt "stylesheet_link_tag"
|
||||
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"
|
||||
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
|
||||
|
||||
@ -279,10 +230,6 @@ snippet else "else (ERB)"
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet if "if (ERB)"
|
||||
<% if ${1:condition} %>$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
|
||||
|
@ -45,25 +45,6 @@ type ${1:Interface} interface {
|
||||
}
|
||||
endsnippet
|
||||
|
||||
# statements
|
||||
snippet for "For loop" b
|
||||
for ${1:condition}${1/(.+)/ /}{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet fori "Integer for loop" b
|
||||
for ${1:i} := 0; $1 < ${2:N}; $1++ {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet forr "For range loop" b
|
||||
for ${2:name} := range ${1:collection} {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet if "If statement" b
|
||||
if ${1:condition}${1/(.+)/ /}{
|
||||
${0:${VISUAL}}
|
||||
@ -72,26 +53,10 @@ endsnippet
|
||||
|
||||
snippet switch "Switch statement" b
|
||||
switch ${1:expression}${1/(.+)/ /}{
|
||||
case${0}
|
||||
case$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet select "Select statement" b
|
||||
select {
|
||||
case${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet case "Case clause" b
|
||||
case ${1:condition}:
|
||||
${0:${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
snippet default "Default clause" b
|
||||
default:
|
||||
${0:${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
# functions
|
||||
snippet /^main/ "Main function" r
|
||||
func main() {
|
||||
@ -111,6 +76,12 @@ func ${1:name}(${2:params})${3/(.+)/ /}${3:type} {
|
||||
}
|
||||
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}
|
||||
@ -135,3 +106,10 @@ snippet json "JSON field"
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
||||
|
||||
# error handling
|
||||
snippet err "Basic error handling" b
|
||||
if err != nil {
|
||||
log.${1:Fatal}(err)
|
||||
}
|
||||
endsnippet
|
||||
|
@ -1,68 +0,0 @@
|
||||
priority -50
|
||||
|
||||
snippet if "if ... then ... else ..."
|
||||
if ${1:condition}
|
||||
then ${2:expression}
|
||||
else ${3:expression}
|
||||
endsnippet
|
||||
|
||||
snippet case "case ... of ..."
|
||||
case ${1:expression} of
|
||||
${2:pattern} -> ${3:expression}
|
||||
${4:pattern} -> ${5:expression}
|
||||
endsnippet
|
||||
|
||||
snippet :: "Type signature"
|
||||
${1:name} :: ${2:Type} -> ${3:Type}
|
||||
endsnippet
|
||||
|
||||
snippet => "Type constraint"
|
||||
(${1:Class} ${2:a}) => $2
|
||||
endsnippet
|
||||
|
||||
snippet def "Function definition"
|
||||
${1:name} :: ${2:Type} -> ${3:Type}
|
||||
endsnippet
|
||||
|
||||
snippet def[] "Function definition for list patterns"
|
||||
${1:name} :: [${2:Type}] -> ${3:Type}
|
||||
$1 [] = ${4:undefined}
|
||||
$1 ${5:(x:xs)} = ${6:undefined}
|
||||
endsnippet
|
||||
|
||||
snippet = "Function clause"
|
||||
${1:name} ${2:pattern} = ${3:undefined}
|
||||
endsnippet
|
||||
|
||||
snippet 2= "Function clause"
|
||||
${1:name} ${2:pattern} = ${3:undefined}
|
||||
$1 ${4:pattern} = ${5:undefined}
|
||||
endsnippet
|
||||
|
||||
snippet 3= "Function clause"
|
||||
${1:name} ${2:pattern} = ${3:undefined}
|
||||
$1 ${4:pattern} = ${5:undefined}
|
||||
$1 ${6:pattern} = ${7:undefined}
|
||||
endsnippet
|
||||
|
||||
snippet | "Guard"
|
||||
| ${1:predicate} = ${2:undefined}
|
||||
endsnippet
|
||||
|
||||
snippet \ "Lambda expression"
|
||||
\\${1:pattern} -> ${2:expression}
|
||||
endsnippet
|
||||
|
||||
snippet [|] "List comprehension"
|
||||
[${3:foo }$1 | ${1:x} <- ${2:xs} ]
|
||||
endsnippet
|
||||
|
||||
snippet let "let ... in ..."
|
||||
let ${1:name} = ${2:expression}
|
||||
in ${3:expression}
|
||||
endsnippet
|
||||
|
||||
snippet wh "where x = expression"
|
||||
where
|
||||
${1:name} = ${2:expression}
|
||||
endsnippet
|
@ -12,33 +12,6 @@ def x(snip):
|
||||
snip.rv = ""
|
||||
endglobal
|
||||
|
||||
############
|
||||
# Doctypes #
|
||||
############
|
||||
snippet doctype "DocType XHTML 1.0 Strict" b
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet doctype "DocType XHTML 1.0 Transitional" b
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet doctype "DocType XHTML 1.1" b
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
||||
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet doctype "HTML - 4.0 Transitional (doctype)" b
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet doctype "HTML - 5.0 (doctype)" b
|
||||
<!DOCTYPE html>
|
||||
|
||||
@ -83,100 +56,62 @@ snippet left "Left (left)"
|
||||
←
|
||||
endsnippet
|
||||
|
||||
snippet option "Option (option)"
|
||||
⌥
|
||||
endsnippet
|
||||
|
||||
#######################
|
||||
# Conditional inserts #
|
||||
#######################
|
||||
snippet ! "IE Conditional Comment: Internet Explorer 5_0 only"
|
||||
<!--[if IE 5.0]>${1:IE Conditional Comment: Internet Explorer 5.0 only }<![endif]-->$0
|
||||
endsnippet
|
||||
|
||||
snippet ! "IE Conditional Comment: Internet Explorer 5_5 only"
|
||||
<!--[if IE 5.5000]>${1:IE Conditional Comment: Internet Explorer 5.5 only }<![endif]-->$0
|
||||
endsnippet
|
||||
|
||||
snippet ! "IE Conditional Comment: Internet Explorer 5_x"
|
||||
<!--[if lt IE 6]>${1:IE Conditional Comment: Internet Explorer 5.x }<![endif]-->$0
|
||||
endsnippet
|
||||
|
||||
snippet ! "IE Conditional Comment: Internet Explorer 6 and below"
|
||||
<!--[if lte IE 6]>${1:IE Conditional Comment: Internet Explorer 6 and below }<![endif]-->$0
|
||||
endsnippet
|
||||
|
||||
snippet ! "IE Conditional Comment: Internet Explorer 6 only"
|
||||
<!--[if IE 6]>${1:IE Conditional Comment: Internet Explorer 6 only }<![endif]-->$0
|
||||
endsnippet
|
||||
|
||||
snippet ! "IE Conditional Comment: Internet Explorer 7+"
|
||||
<!--[if gte IE 7]>${1:IE Conditional Comment: Internet Explorer 7 and above }<![endif]-->$0
|
||||
endsnippet
|
||||
|
||||
snippet ! "IE Conditional Comment: Internet Explorer"
|
||||
<!--[if IE]>${1: IE Conditional Comment: Internet Explorer }<![endif]-->$0
|
||||
endsnippet
|
||||
|
||||
snippet ! "IE Conditional Comment: NOT Internet Explorer"
|
||||
<!--[if !IE]><!-->${1: IE Conditional Comment: NOT Internet Explorer }<!-- <![endif]-->$0
|
||||
endsnippet
|
||||
|
||||
#############
|
||||
# HTML TAGS #
|
||||
#############
|
||||
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 "XHTML <input>" w
|
||||
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 opt "Option" w
|
||||
snippet option "Option" w
|
||||
<option${1: value="${2:option}"}>${3:$2}</option>
|
||||
endsnippet
|
||||
|
||||
snippet select "Select Box" w
|
||||
<select name="${1:some_name}" id="${2:$1}"${3:${4: multiple}${5: onchange="${6:}"}${7: size="${8:1}"}}>
|
||||
<option${9: value="${10:option1}"}>${11:$10}</option>
|
||||
<option${12: value="${13:option2}"}>${14:$13}</option>${15:}
|
||||
$0
|
||||
${0:${VISUAL}}
|
||||
</select>
|
||||
endsnippet
|
||||
|
||||
|
||||
snippet textarea "XHTML <textarea>" w
|
||||
snippet textarea "HTML <textarea>" w
|
||||
<textarea name="${1:Name}" rows="${2:8}" cols="${3:40}">$0</textarea>
|
||||
endsnippet
|
||||
|
||||
snippet mailto "XHTML <a mailto: >" w
|
||||
snippet mailto "HTML <a mailto: >" w
|
||||
<a href="mailto:${1:joe@example.com}?subject=${2:feedback}">${3:email me}</a>
|
||||
endsnippet
|
||||
|
||||
snippet base "XHTML <base>" w
|
||||
snippet base "HTML <base>" w
|
||||
<base href="$1"${2: target="$3"}`!p x(snip)`>
|
||||
endsnippet
|
||||
|
||||
snippet body "XHTML <body>"
|
||||
<body id="${1:`!p
|
||||
snip.rv = snip.fn and 'Hallo' or 'Nothin'
|
||||
`}"${2: onload="$3"}>
|
||||
$0
|
||||
snippet body "<body>"
|
||||
<body>
|
||||
${0:${VISUAL}}
|
||||
</body>
|
||||
endsnippet
|
||||
|
||||
snippet div "<div>" w
|
||||
<div>
|
||||
${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
|
||||
${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
|
||||
${0:${VISUAL}}
|
||||
</div>
|
||||
endsnippet
|
||||
|
||||
@ -184,21 +119,39 @@ snippet form "XHTML <form>" w
|
||||
<form action="${1:`!p
|
||||
snip.rv = (snip.basename or 'unnamed') + '_submit'
|
||||
`}" method="${2:get}" accept-charset="utf-8">
|
||||
$0
|
||||
|
||||
<p><input type="submit" value="Continue →"`!p x(snip)`></p>
|
||||
${0:${VISUAL}}
|
||||
</form>
|
||||
endsnippet
|
||||
|
||||
snippet h1 "XHTML <h1>" w
|
||||
<h1 id="${1/[\w\d]+|( )/(?1:_:\L$0\E)/g}">${1}</h1>
|
||||
<h1>${0:${VISUAL}}</h1>
|
||||
endsnippet
|
||||
|
||||
snippet h2 "XHTML <h2>" w
|
||||
<h2>${0:${VISUAL}}</h2>
|
||||
endsnippet
|
||||
|
||||
snippet h3 "XHTML <h3>" w
|
||||
<h3>${0:${VISUAL}}</h3>
|
||||
endsnippet
|
||||
|
||||
snippet h4 "XHTML <h4>" w
|
||||
<h4>${0:${VISUAL}}</h4>
|
||||
endsnippet
|
||||
|
||||
snippet h5 "XHTML <h5>" w
|
||||
<h5>${0:${VISUAL}}</h5>
|
||||
endsnippet
|
||||
|
||||
snippet h6 "XHTML <h6>" w
|
||||
<h6>${0:${VISUAL}}</h6>
|
||||
endsnippet
|
||||
|
||||
snippet head "XHTML <head>"
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>${1:`!p snip.rv = snip.basename or "Page Title"`}</title>
|
||||
$0
|
||||
${0:${VISUAL}}
|
||||
</head>
|
||||
endsnippet
|
||||
|
||||
@ -210,26 +163,37 @@ snippet meta "XHTML <meta>" w
|
||||
<meta name="${1:name}" content="${2:content}"`!p x(snip)`>
|
||||
endsnippet
|
||||
|
||||
snippet scriptsrc "XHTML <script src...>" w
|
||||
<script src="$1" type="text/javascript" charset="${3:utf-8}"></script>
|
||||
snippet scriptsrc "HTML <script src...>" w
|
||||
<script src="$1" charset="${3:utf-8}"></script>
|
||||
endsnippet
|
||||
|
||||
snippet script "XHTML <script>" w
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$0
|
||||
snippet script "HTML <script>" w
|
||||
<script charset="utf-8">
|
||||
${0:${VISUAL}}
|
||||
</script>
|
||||
endsnippet
|
||||
|
||||
snippet span "<span>" w
|
||||
<span> ${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 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 style "XHTML <style>" w
|
||||
<style type="text/css" media="screen">
|
||||
$0
|
||||
${0:${VISUAL}}
|
||||
</style>
|
||||
endsnippet
|
||||
|
||||
snippet table "XHTML <table>" w
|
||||
<table border="${1:0}"${2: cellspacing="${3:5}" cellpadding="${4:5}"}>
|
||||
<tr><th>${5:Header}</th></tr>
|
||||
<tr><td>${0:Data}</td></tr>
|
||||
<table>
|
||||
${0:${VISUAL}}
|
||||
</table>
|
||||
endsnippet
|
||||
|
||||
@ -238,29 +202,29 @@ snippet a "Link" w
|
||||
endsnippet
|
||||
|
||||
snippet p "paragraph" w
|
||||
<p>$0</p>
|
||||
<p>${0:${VISUAL}}</p>
|
||||
endsnippet
|
||||
|
||||
snippet li "list item" w
|
||||
<li>$0</li>
|
||||
<li>${0:${VISUAL}}</li>
|
||||
endsnippet
|
||||
|
||||
snippet ul "unordered list" w
|
||||
<ul>
|
||||
$0
|
||||
${0:${VISUAL}}
|
||||
</ul>
|
||||
endsnippet
|
||||
|
||||
snippet td "table cell" w
|
||||
<td>$0</td>
|
||||
<td>${0:${VISUAL}}</td>
|
||||
endsnippet
|
||||
|
||||
snippet th "table header" w
|
||||
<th>$0</th>
|
||||
<th>${0:${VISUAL}}</th>
|
||||
endsnippet
|
||||
|
||||
snippet tr "table row" w
|
||||
<tr>$0</tr>
|
||||
<tr>${0:${VISUAL}}</tr>
|
||||
endsnippet
|
||||
|
||||
snippet title "XHTML <title>" w
|
||||
@ -270,39 +234,11 @@ endsnippet
|
||||
snippet fieldset "Fieldset" w
|
||||
<fieldset id="${1/[\w\d]+|( )/(?1:_:\L$0\E)/g}" ${2:class="${3:}"}>
|
||||
<legend>$1</legend>
|
||||
$0
|
||||
${0:${VISUAL}}
|
||||
</fieldset>
|
||||
endsnippet
|
||||
|
||||
snippet movie "Embed QT movie (movie)" b
|
||||
<object width="$2" height="$3" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab">
|
||||
<param name="src" value="$1"`!p x(snip)`>
|
||||
<param name="controller" value="$4"`!p x(snip)`>
|
||||
<param name="autoplay" value="$5"`!p x(snip)`>
|
||||
<embed src="${1:movie.mov}"
|
||||
width="${2:320}" height="${3:240}"
|
||||
controller="${4:true}" autoplay="${5:true}"
|
||||
scale="tofit" cache="true"
|
||||
pluginspage="http://www.apple.com/quicktime/download/"
|
||||
`!p x(snip)`>
|
||||
</object>
|
||||
endsnippet
|
||||
|
||||
snippet html5 "HTML5 Template"
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>${1}</title>
|
||||
<meta charset="utf-8" />
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
${2}
|
||||
</header>
|
||||
<footer>
|
||||
${4}
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
snippet viewport "Responsive viewport meta" w
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
endsnippet
|
||||
# vim:ft=snippets:
|
||||
|
@ -4,24 +4,24 @@
|
||||
priority -50
|
||||
|
||||
snippet id
|
||||
id="${1}"${2}
|
||||
id="$1"$2
|
||||
endsnippet
|
||||
|
||||
snippet idn
|
||||
id="${1}" name="${2:$1}"
|
||||
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}
|
||||
<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}
|
||||
<input type="${1:text}" value="$2" name="$3"${4: id="${5:$3}"}/>$7
|
||||
endsnippet
|
||||
|
||||
snippet submit
|
||||
<input type="submit" value="${2}" ${3}/>${7}
|
||||
<input type="submit" value="$2" $3/>$7
|
||||
endsnippet
|
||||
|
||||
snippet textarea
|
||||
@ -29,5 +29,5 @@ snippet textarea
|
||||
endsnippet
|
||||
|
||||
snippet img
|
||||
<img src="$1"${2: alt="$3"}/>
|
||||
<img src="$1"${2: alt="$3"}/>
|
||||
endsnippet
|
||||
|
@ -1,3 +1,299 @@
|
||||
priority -50
|
||||
|
||||
extends html, django
|
||||
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:
|
||||
|
@ -21,7 +21,7 @@ def nl(snip):
|
||||
snip.rv += " "
|
||||
def getArgs(group):
|
||||
import re
|
||||
word = re.compile('[a-zA-Z><.]+ \w+')
|
||||
word = re.compile('[a-zA-Z0-9><.]+ \w+')
|
||||
return [i.split(" ") for i in word.findall(group) ]
|
||||
|
||||
def camel(word):
|
||||
@ -48,7 +48,7 @@ $0
|
||||
endsnippet
|
||||
|
||||
snippet /o|v/ "new Object or variable" br
|
||||
${1:Object} ${2:var} = new $1(${3});
|
||||
${1:Object} ${2:var} = new $1($3);
|
||||
endsnippet
|
||||
|
||||
snippet f "field" b
|
||||
@ -109,7 +109,7 @@ 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
|
||||
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] + ";"
|
||||
@ -123,8 +123,8 @@ 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\t\treturn " + i[1] + ";\n\t}\n"
|
||||
snip.rv += "\n\tpublic " + i[0] + " get" + camel(i[1]) + "() {\n\
|
||||
\treturn " + i[1] + ";\n\t}\n"
|
||||
`
|
||||
}
|
||||
endsnippet
|
||||
@ -138,7 +138,7 @@ 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
|
||||
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])
|
||||
@ -266,7 +266,7 @@ 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
|
||||
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])
|
||||
@ -310,13 +310,13 @@ try {
|
||||
endsnippet
|
||||
|
||||
snippet mt "method throws" b
|
||||
${1:private} ${2:void} ${3:method}(${4}) ${5:throws $6 }{
|
||||
${1:private} ${2:void} ${3:method}($4) ${5:throws $6 }{
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet m "method" b
|
||||
${1:private} ${2:void} ${3:method}(${4}) {
|
||||
${1:private} ${2:void} ${3:method}($4) {
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
@ -326,11 +326,11 @@ 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
|
||||
*`!p
|
||||
if "throws" in t[5]:
|
||||
snip.rv = "\n\t * @throws " + t[6]
|
||||
else:
|
||||
snip.rv = ""` `!p
|
||||
snip.rv = ""``!p
|
||||
if not "void" in t[2]:
|
||||
snip.rv = "\n\t * @return object"
|
||||
else:
|
||||
@ -356,8 +356,7 @@ 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])`;
|
||||
}
|
||||
|
@ -0,0 +1,77 @@
|
||||
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
|
@ -0,0 +1,234 @@
|
||||
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 any "any (js)" b
|
||||
jasmine.any($1)
|
||||
endsnippet
|
||||
|
||||
snippet anyt "anything (js)" b
|
||||
jasmine.anything()
|
||||
endsnippet
|
||||
|
||||
snippet objc "object containing (js)" b
|
||||
jasmine.objectContaining({
|
||||
${VISUAL}$0
|
||||
});
|
||||
endsnippet
|
||||
|
||||
snippet arrc "array containing (js)" b
|
||||
jasmine.arrayContaining([${1:value1}]);
|
||||
endsnippet
|
||||
|
||||
snippet strm "string matching (js)" b
|
||||
jasmine.stringMatching("${1:matcher}")
|
||||
endsnippet
|
||||
|
||||
snippet ru "runs (js)" b
|
||||
runs(() => {
|
||||
$0
|
||||
});
|
||||
endsnippet
|
||||
|
||||
snippet wa "waits (js)" b
|
||||
waits($1);
|
||||
endsnippet
|
||||
|
||||
snippet ex "expect (js)" b
|
||||
expect(${1:target})$0;
|
||||
endsnippet
|
||||
|
||||
snippet ee "expect to equal (js)" b
|
||||
expect(${1:target}).toEqual(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet el "expect to be less than (js)" b
|
||||
expect(${1:target}).toBeLessThan(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet eg "expect to be greater than (js)" b
|
||||
expect(${1:target}).toBeGreaterThan(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet eb "expect to be (js)" b
|
||||
expect(${1:target}).toBe(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet em "expect to match (js)" b
|
||||
expect(${1:target}).toMatch(${2:pattern});
|
||||
endsnippet
|
||||
|
||||
snippet eha "expect to have attribute (js)" b
|
||||
expect(${1:target}).toHaveAttr('${2:attr}'${3:, '${4:value}'});
|
||||
endsnippet
|
||||
|
||||
snippet et "expect to be truthy (js)" b
|
||||
expect(${1:target}).toBeTruthy();
|
||||
endsnippet
|
||||
|
||||
snippet ef "expect to be falsy (js)" b
|
||||
expect(${1:target}).toBeFalsy();
|
||||
endsnippet
|
||||
|
||||
snippet ed "expect to be defined (js)" b
|
||||
expect(${1:target}).toBeDefined();
|
||||
endsnippet
|
||||
|
||||
snippet eud "expect to be defined (js)" b
|
||||
expect(${1:target}).toBeUndefined();
|
||||
endsnippet
|
||||
|
||||
snippet en "expect to be null (js)" b
|
||||
expect(${1:target}).toBeNull();
|
||||
endsnippet
|
||||
|
||||
snippet ec "expect to contain (js)" b
|
||||
expect(${1:target}).toContain(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet ev "expect to be visible (js)" b
|
||||
expect(${1:target}).toBeVisible();
|
||||
endsnippet
|
||||
|
||||
snippet eh "expect to be hidden (js)" b
|
||||
expect(${1:target}).toBeHidden();
|
||||
endsnippet
|
||||
|
||||
snippet eth "expect to throw (js)" b
|
||||
expect(${1:target}).toThrow(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet ethe "expect to throw error (js)" b
|
||||
expect(${1:target}).toThrowError(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet notx "expect not (js)" b
|
||||
expect(${1:target}).not$0;
|
||||
endsnippet
|
||||
|
||||
snippet note "expect not to equal (js)" b
|
||||
expect(${1:target}).not.toEqual(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet notl "expect to not be less than (js)" b
|
||||
expect(${1:target}).not.toBeLessThan(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet notg "expect to not be greater than (js)" b
|
||||
expect(${1:target}).not.toBeGreaterThan(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet notm "expect not to match (js)" b
|
||||
expect(${1:target}).not.toMatch(${2:pattern});
|
||||
endsnippet
|
||||
|
||||
snippet notha "expect to not have attribute (js)" b
|
||||
expect(${1:target}).not.toHaveAttr('${2:attr}'${3:, '${4:value}'});
|
||||
endsnippet
|
||||
|
||||
snippet nott "expect not to be truthy (js)" b
|
||||
expect(${1:target}).not.toBeTruthy();
|
||||
endsnippet
|
||||
|
||||
snippet notf "expect not to be falsy (js)" b
|
||||
expect(${1:target}).not.toBeFalsy();
|
||||
endsnippet
|
||||
|
||||
snippet notd "expect not to be defined (js)" b
|
||||
expect(${1:target}).not.toBeDefined();
|
||||
endsnippet
|
||||
|
||||
snippet notn "expect not to be null (js)" b
|
||||
expect(${1:target}).not.toBeNull();
|
||||
endsnippet
|
||||
|
||||
snippet notc "expect not to contain (js)" b
|
||||
expect(${1:target}).not.toContain(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet notv "expect not to be visible (js)" b
|
||||
expect(${1:target}).not.toBeVisible();
|
||||
endsnippet
|
||||
|
||||
snippet noth "expect not to be hidden (js)" b
|
||||
expect(${1:target}).not.toBeHidden();
|
||||
endsnippet
|
||||
|
||||
snippet notth "expect not to throw (js)" b
|
||||
expect(${1:target}).not.toThrow(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet notthe "expect not to throw error (js)" b
|
||||
expect(${1:target}).not.toThrowError(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet s "spy on (js)" b
|
||||
spyOn(${1:object}, '${2:method}')$0;
|
||||
endsnippet
|
||||
|
||||
snippet sr "spy on and return (js)" b
|
||||
spyOn(${1:object}, '${2:method}').and.returnValue(${3:arguments});
|
||||
endsnippet
|
||||
|
||||
snippet st "spy on and throw (js)" b
|
||||
spyOn(${1:object}, '${2:method}').and.throwError(${3:exception});
|
||||
endsnippet
|
||||
|
||||
snippet sct "spy on and call through (js)" b
|
||||
spyOn(${1:object}, '${2:method}').and.callThrough();
|
||||
endsnippet
|
||||
|
||||
snippet scf "spy on and call fake (js)" b
|
||||
spyOn(${1:object}, '${2:method}').and.callFake(${3:function});
|
||||
endsnippet
|
||||
|
||||
snippet ethbc "expect to have been called (js)" b
|
||||
expect(${1:target}).toHaveBeenCalled();
|
||||
endsnippet
|
||||
|
||||
snippet nthbc "expect not to have been called (js)" b
|
||||
expect(${1:target}).not.toHaveBeenCalled();
|
||||
endsnippet
|
||||
|
||||
snippet ethbcw "expect to have been called with (js)" b
|
||||
expect(${1:target}).toHaveBeenCalledWith(${2:arguments});
|
||||
endsnippet
|
||||
|
@ -28,10 +28,40 @@ afterEach(function() {
|
||||
});
|
||||
endsnippet
|
||||
|
||||
snippet befa "before all (js)" b
|
||||
beforeAll(function() {
|
||||
$0
|
||||
});
|
||||
endsnippet
|
||||
|
||||
snippet afta "after all (js)" b
|
||||
afterAll(function() {
|
||||
$0
|
||||
});
|
||||
endsnippet
|
||||
|
||||
snippet any "any (js)" b
|
||||
jasmine.any($1)
|
||||
endsnippet
|
||||
|
||||
snippet anyt "anything (js)" b
|
||||
jasmine.anything()
|
||||
endsnippet
|
||||
|
||||
snippet objc "object containing (js)" b
|
||||
jasmine.objectContaining({
|
||||
${VISUAL}$0
|
||||
});
|
||||
endsnippet
|
||||
|
||||
snippet arrc "array containing (js)" b
|
||||
jasmine.arrayContaining([${1:value1}]);
|
||||
endsnippet
|
||||
|
||||
snippet strm "string matching (js)" b
|
||||
jasmine.stringMatching("${1:matcher}")
|
||||
endsnippet
|
||||
|
||||
snippet ru "runs (js)" b
|
||||
runs(function() {
|
||||
$0
|
||||
@ -50,6 +80,14 @@ snippet ee "expect to equal (js)" b
|
||||
expect(${1:target}).toEqual(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet el "expect to be less than (js)" b
|
||||
expect(${1:target}).toBeLessThan(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet eg "expect to be greater than (js)" b
|
||||
expect(${1:target}).toBeGreaterThan(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet eb "expect to be (js)" b
|
||||
expect(${1:target}).toBe(${2:value});
|
||||
endsnippet
|
||||
@ -74,6 +112,10 @@ snippet ed "expect to be defined (js)" b
|
||||
expect(${1:target}).toBeDefined();
|
||||
endsnippet
|
||||
|
||||
snippet eud "expect to be defined (js)" b
|
||||
expect(${1:target}).toBeUndefined();
|
||||
endsnippet
|
||||
|
||||
snippet en "expect to be null (js)" b
|
||||
expect(${1:target}).toBeNull();
|
||||
endsnippet
|
||||
@ -90,6 +132,14 @@ snippet eh "expect to be hidden (js)" b
|
||||
expect(${1:target}).toBeHidden();
|
||||
endsnippet
|
||||
|
||||
snippet eth "expect to throw (js)" b
|
||||
expect(${1:target}).toThrow(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet ethe "expect to throw error (js)" b
|
||||
expect(${1:target}).toThrowError(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet notx "expect not (js)" b
|
||||
expect(${1:target}).not$0;
|
||||
endsnippet
|
||||
@ -98,6 +148,14 @@ snippet note "expect not to equal (js)" b
|
||||
expect(${1:target}).not.toEqual(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet notl "expect to not be less than (js)" b
|
||||
expect(${1:target}).not.toBeLessThan(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet notg "expect to not be greater than (js)" b
|
||||
expect(${1:target}).not.toBeGreaterThan(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet notm "expect not to match (js)" b
|
||||
expect(${1:target}).not.toMatch(${2:pattern});
|
||||
endsnippet
|
||||
@ -134,40 +192,32 @@ snippet noth "expect not to be hidden (js)" b
|
||||
expect(${1:target}).not.toBeHidden();
|
||||
endsnippet
|
||||
|
||||
snippet notth "expect not to throw (js)" b
|
||||
expect(${1:target}).not.toThrow(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet notthe "expect not to throw error (js)" b
|
||||
expect(${1:target}).not.toThrowError(${2:value});
|
||||
endsnippet
|
||||
|
||||
snippet s "spy on (js)" b
|
||||
spyOn(${1:object}, '${2:method}')$0;
|
||||
endsnippet
|
||||
|
||||
snippet sr "spy on and return (js)" b
|
||||
spyOn(${1:object}, '${2:method}').andReturn(${3:arguments});
|
||||
spyOn(${1:object}, '${2:method}').and.returnValue(${3:arguments});
|
||||
endsnippet
|
||||
|
||||
snippet st "spy on and throw (js)" b
|
||||
spyOn(${1:object}, '${2:method}').andThrow(${3:exception});
|
||||
spyOn(${1:object}, '${2:method}').and.throwError(${3:exception});
|
||||
endsnippet
|
||||
|
||||
snippet sct "spy on and call through (js)" b
|
||||
spyOn(${1:object}, '${2:method}').andCallThrough();
|
||||
spyOn(${1:object}, '${2:method}').and.callThrough();
|
||||
endsnippet
|
||||
|
||||
snippet scf "spy on and call fake (js)" b
|
||||
spyOn(${1:object}, '${2:method}').andCallFake(${3:function});
|
||||
endsnippet
|
||||
|
||||
snippet esc "expect was called (js)" b
|
||||
expect(${1:target}).wasCalled();
|
||||
endsnippet
|
||||
|
||||
snippet escw "expect was called with (js)" b
|
||||
expect(${1:target}).wasCalledWith(${2:arguments});
|
||||
endsnippet
|
||||
|
||||
snippet notsc "expect was not called (js)" b
|
||||
expect(${1:target}).wasNotCalled();
|
||||
endsnippet
|
||||
|
||||
snippet noscw "expect was not called with (js)" b
|
||||
expect(${1:target}).wasNotCalledWith(${2:arguments});
|
||||
spyOn(${1:object}, '${2:method}').and.callFake(${3:function});
|
||||
endsnippet
|
||||
|
||||
snippet ethbc "expect to have been called (js)" b
|
@ -0,0 +1,65 @@
|
||||
priority -50
|
||||
|
||||
snippet #! "shebang"
|
||||
#!/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
|
||||
|
@ -0,0 +1,205 @@
|
||||
snippet sapmlabel
|
||||
var $1 = new sap.m.Label({
|
||||
design : $2,
|
||||
text : $3,
|
||||
visible : $4,
|
||||
textAlign : $5,
|
||||
textDirection : $6,
|
||||
width : $7,
|
||||
required : $7
|
||||
});
|
||||
|
||||
snippet sapmtext
|
||||
var $1 = new sap.m.Text({
|
||||
text :$2,
|
||||
textDirection :$3,
|
||||
visible :$4,
|
||||
wrapping : $5,
|
||||
textAlign : $6,
|
||||
width :$7,
|
||||
maxLines :$8
|
||||
});
|
||||
|
||||
snippet sapmbutton
|
||||
var $1 = new sap.m.Button({
|
||||
text : $2,
|
||||
type : $3,
|
||||
width : $4,
|
||||
enabled :$5,
|
||||
visible :$6,
|
||||
icon : $7,
|
||||
iconFirst : $8,
|
||||
activeIcon :$9,
|
||||
iconDensityAware : $10,
|
||||
});
|
||||
snippet sapmflexbox
|
||||
var $1 = new sap.m.FlexBox({
|
||||
visible : $2,
|
||||
height : $3,
|
||||
width : $4,
|
||||
displayInline :$5,
|
||||
direction :$6,
|
||||
fitContainer : $7,
|
||||
renderType : $8,
|
||||
justifyContent :$9,
|
||||
alignItems : $10,
|
||||
items:[]
|
||||
});
|
||||
snippet sapmhbox
|
||||
var $1 = new sap.m.HBox({
|
||||
visible : $2,
|
||||
height : $3,
|
||||
width : $4,
|
||||
displayInline :$5,
|
||||
direction :$6,
|
||||
fitContainer : $7,
|
||||
renderType : $8,
|
||||
justifyContent :$9,
|
||||
alignItems : $10,
|
||||
items:[]
|
||||
});
|
||||
|
||||
snippet sapmvbox
|
||||
var $1 = new sap.m.VBox({
|
||||
visible : $2,
|
||||
height : $3,
|
||||
width : $4,
|
||||
displayInline :$5,
|
||||
direction :$6,
|
||||
fitContainer : $7,
|
||||
renderType : $8,
|
||||
justifyContent :$9,
|
||||
alignItems : $10,
|
||||
items:[]
|
||||
});
|
||||
|
||||
snippet sapcomponent
|
||||
sap.ui.controller("$1", {
|
||||
onInit: function(){
|
||||
},
|
||||
onAfterRendering: function() {
|
||||
},
|
||||
onAfterRendering: function() {
|
||||
},
|
||||
onExit: function() {
|
||||
},
|
||||
});
|
||||
|
||||
snippet sapminput
|
||||
var $1 = new sap.m.Input({
|
||||
value :$2,
|
||||
width : $3,
|
||||
enabled :$4,
|
||||
visible :$5,
|
||||
valueState :$6,
|
||||
name : $7,
|
||||
placeholder : $8,
|
||||
editable : $9,
|
||||
type : $10,
|
||||
maxLength :$11,
|
||||
valueStateText :$12,
|
||||
showValueStateMessage :$13,
|
||||
dateFormat :$14,
|
||||
showValueHelp :$15,
|
||||
showSuggestion :$16,
|
||||
valueHelpOnly :$17,
|
||||
filterSuggests :$18,
|
||||
maxSuggestionWidth :$19,
|
||||
startSuggestion : $20,
|
||||
showTableSuggestionValueHelp : $21,
|
||||
description : $22,
|
||||
fieldWidth : $23,
|
||||
valueLiveUpdate :$24,
|
||||
suggestionItems :[$25],
|
||||
suggestionColumns : [$26],
|
||||
suggestionRows : [$27],
|
||||
liveChange : $28,
|
||||
valueHelpRequest :$29,
|
||||
suggest : $30,
|
||||
suggestionItemSelected : $31
|
||||
});
|
||||
snippet _sthis
|
||||
var _self = this;
|
||||
|
||||
snippet sapmresponsivepopup
|
||||
var $1 = new sap.m.ResponsivePopover({
|
||||
placement :$2 ,//sap.m.PlacementType (default: sap.m.PlacementType.Right)
|
||||
showHeader :$3 ,//boolean (default: true)
|
||||
title : $4,//string
|
||||
icon :$5 ,//sap.ui.core.URI
|
||||
modal :$6 ,// boolean
|
||||
offsetX :$7, //int
|
||||
offsetY :$8, //int
|
||||
contentWidth : $9,//sap.ui.core.CSSSize
|
||||
contentHeight :$10, //sap.ui.core.CSSSize
|
||||
horizontalScrolling :$11, //boolean
|
||||
verticalScrolling :$12, //boolean
|
||||
showCloseButton :$13, //boolean (default: true)
|
||||
//Aggregations
|
||||
content :$14, //sap.ui.core.Control[]
|
||||
customHeader :$15, //sap.m.IBar
|
||||
subHeader : $16, //sap.m.IBar
|
||||
beginButton :$17, //sap.m.Button
|
||||
endButton : $18, //sap.m.Button
|
||||
//Associations
|
||||
initialFocus : $19, //string | sap.ui.core.Control
|
||||
//Events
|
||||
beforeOpen :$20, //fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
|
||||
afterOpen : $21, //fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
|
||||
beforeClose : $22, //fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
|
||||
afterClose : $23 //fnList
|
||||
});
|
||||
|
||||
snippet sapicon
|
||||
var $1 = new sap.ui.core.Icon({
|
||||
src :$2 , //sap.ui.core.URI
|
||||
size :$3 , //sap.ui.core.CSSSize
|
||||
color :$4 , //sap.ui.core.CSSColor
|
||||
hoverColor : $5 , // sap.ui.core.CSSColor
|
||||
activeColor :$6 , //sap.ui.core.CSSColor
|
||||
width :$7 , //sap.ui.core.CSSSize
|
||||
height : $8 ,//sap.ui.core.CSSSize
|
||||
backgroundColor :$8 , //sap.ui.core.CSSColor
|
||||
hoverBackgroundColor :$9 , //sap.ui.core.CSSColor
|
||||
activeBackgroundColor :$10 , //sap.ui.core.CSSColor
|
||||
visible :$11 , //boolean (default: true)
|
||||
decorative : $12 ,//boolean (default: true)
|
||||
});
|
||||
snippet extendVerticalL
|
||||
sap.ui.layout.VerticalLayout.extend("$1", {
|
||||
metadata: {
|
||||
properties: {
|
||||
$2
|
||||
},
|
||||
aggregations: {
|
||||
$3
|
||||
},
|
||||
events: {
|
||||
$4
|
||||
}
|
||||
},
|
||||
init: function(){
|
||||
$5
|
||||
},
|
||||
|
||||
renderer: "$6"
|
||||
});
|
||||
snippet extendHorizontalL
|
||||
sap.ui.layout.HorizontalLayout.extend("$1", {
|
||||
metadata: {
|
||||
properties: {
|
||||
$2
|
||||
},
|
||||
aggregations: {
|
||||
$3
|
||||
},
|
||||
events: {
|
||||
$4
|
||||
}
|
||||
},
|
||||
init: function(){
|
||||
$5
|
||||
},
|
||||
|
||||
renderer: "$6"
|
||||
});
|
@ -1,5 +1,19 @@
|
||||
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.
|
||||
|
||||
global !p
|
||||
from javascript_snippets import (
|
||||
semi, space_before_function_paren, keyword_spacing
|
||||
)
|
||||
endglobal
|
||||
|
||||
###########################################################################
|
||||
# TextMate Snippets #
|
||||
###########################################################################
|
||||
@ -8,13 +22,13 @@ getElement${1/(T)|.*/(?1:s)/}By${1:T}${1/(T)|(I)|.*/(?1:agName)(?2:d)/}('$2')
|
||||
endsnippet
|
||||
|
||||
snippet '':f "object method string"
|
||||
'${1:${2:#thing}:${3:click}}': function(element) {
|
||||
'${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(${3:attribute}) {
|
||||
${1:method_name}: function`!p snip.rv = space_before_function_paren(snip)`(${3:attribute}) {
|
||||
${VISUAL}$0
|
||||
}${10:,}
|
||||
endsnippet
|
||||
@ -28,147 +42,99 @@ ${1:key}: ${2:"${3:value}"}${4:, }
|
||||
endsnippet
|
||||
|
||||
snippet proto "Prototype (proto)"
|
||||
${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) {
|
||||
${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 for "for (...) {...} (counting up)" b
|
||||
for (var ${1:i} = 0, ${2:len} = ${3:Things.length}; $1 < $2; $1++) {
|
||||
snippet fun "function (fun)" w
|
||||
function ${1:function_name}`!p snip.rv = space_before_function_paren(snip)`(${2:argument}) {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ford "for (...) {...} (counting down, faster)" b
|
||||
for (var ${2:i} = ${1:Things.length} - 1; $2 >= 0; $2--) {
|
||||
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
|
||||
|
||||
snippet fun "function (fun)"
|
||||
function ${1:function_name}(${2:argument}) {
|
||||
snippet af "Anonymous Function" i
|
||||
function`!p snip.rv = space_before_function_paren(snip)`($1) {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet iife "Immediately-Invoked Function Expression (iife)"
|
||||
(function (${1:argument}) {
|
||||
(function`!p snip.rv = space_before_function_paren(snip)`(${1:window}) {
|
||||
${VISUAL}$0
|
||||
}(${2:$1}));
|
||||
}(${2:$1}))`!p snip.rv = semi(snip)`
|
||||
endsnippet
|
||||
|
||||
snippet ife "if ___ else"
|
||||
if (${1:condition}) {
|
||||
${2://code}
|
||||
}
|
||||
else {
|
||||
${3://code}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet if "if"
|
||||
if (${1:condition}) {
|
||||
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() {
|
||||
setTimeout(function`!p snip.rv = space_before_function_paren(snip)`() {
|
||||
${VISUAL}$0
|
||||
}${2:.bind(${3:this})}, ${1:10});
|
||||
}${2:.bind(${3:this})}, ${1:10})`!p snip.rv = semi(snip)`
|
||||
endsnippet
|
||||
|
||||
snippet fi "for prop in obj using hasOwnProperty" b
|
||||
for (${1:prop} in ${2:obj}){
|
||||
if ($2.hasOwnProperty($1)) {
|
||||
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
|
||||
|
||||
# Snippets for Console Debug Output
|
||||
|
||||
snippet ca "console.assert" b
|
||||
console.assert(${1:assertion}, ${2:"${3:message}"});
|
||||
snippet if "if (condition) { ... }"
|
||||
if`!p snip.rv = keyword_spacing(snip)`(${1:true}) {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet cclear "console.clear" b
|
||||
console.clear();
|
||||
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 cdir "console.dir" b
|
||||
console.dir(${1:object});
|
||||
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 cdirx "console.dirxml" b
|
||||
console.dirxml(${1:object});
|
||||
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 ce "console.error" b
|
||||
console.error(${1:"${2:value}"});
|
||||
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 cgroup "console.group" b
|
||||
console.group("${1:label}");
|
||||
${VISUAL}$0
|
||||
console.groupEnd();
|
||||
snippet ret "Return statement"
|
||||
return ${VISUAL}$0`!p snip.rv = semi(snip)`
|
||||
endsnippet
|
||||
|
||||
snippet cgroupc "console.groupCollapsed" b
|
||||
console.groupCollapsed("${1:label}");
|
||||
${VISUAL}$0
|
||||
console.groupEnd();
|
||||
endsnippet
|
||||
|
||||
snippet ci "console.info" b
|
||||
console.info(${1:"${2:value}"});
|
||||
endsnippet
|
||||
|
||||
snippet cl "console.log" b
|
||||
console.log(${1:"${2:value}"});
|
||||
endsnippet
|
||||
|
||||
snippet cd "console.debug" b
|
||||
console.debug(${1:"${2:value}"});
|
||||
endsnippet
|
||||
|
||||
snippet cprof "console.profile" b
|
||||
console.profile("${1:label}");
|
||||
${VISUAL}$0
|
||||
console.profileEnd();
|
||||
endsnippet
|
||||
|
||||
snippet ctable "console.table" b
|
||||
console.table(${1:"${2:value}"});
|
||||
endsnippet
|
||||
|
||||
snippet ctime "console.time" b
|
||||
console.time("${1:label}");
|
||||
${VISUAL}$0
|
||||
console.timeEnd("$1");
|
||||
endsnippet
|
||||
|
||||
snippet ctimestamp "console.timeStamp" b
|
||||
console.timeStamp("${1:label}");
|
||||
endsnippet
|
||||
|
||||
snippet ctrace "console.trace" b
|
||||
console.trace();
|
||||
endsnippet
|
||||
|
||||
snippet cw "console.warn" b
|
||||
console.warn(${1:"${2:value}"});
|
||||
endsnippet
|
||||
|
||||
# AMD (Asynchronous Module Definition) snippets
|
||||
|
||||
snippet def "define an AMD module"
|
||||
define(${1:optional_name, }[${2:'jquery'}], ${3:callback});
|
||||
endsnippet
|
||||
|
||||
snippet req "require an AMD module"
|
||||
require([${1:'dependencies'}], ${2:callback});
|
||||
snippet us
|
||||
'use strict'`!p snip.rv = semi(snip)`
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
||||
|
@ -1,67 +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}', ['${2:param_annotation}', function(${3:param}) {
|
||||
$0
|
||||
}]);
|
||||
endsnippet
|
||||
|
||||
snippet aconts "angular controller with scope" i
|
||||
controller('${1:name}', ['$scope', function($scope) {
|
||||
$0
|
||||
}]);
|
||||
endsnippet
|
||||
|
||||
snippet adir "angular directive" i
|
||||
directive('${1:name}', ['${2:param_annotation}', function(${3:param}) {
|
||||
$0
|
||||
}]);
|
||||
endsnippet
|
||||
|
||||
snippet adirs "angular directive with scope" i
|
||||
directive('${1:name}', ['$scope', function($scope) {
|
||||
$0
|
||||
}]);
|
||||
endsnippet
|
||||
|
||||
snippet afact "angular factory" i
|
||||
factory('${1:name}', ['${2:param_annotation}', function(${3:param}) {
|
||||
$0
|
||||
}]);
|
||||
endsnippet
|
||||
|
||||
snippet afacts "angular factory with scope" i
|
||||
factory('${1:name}', ['$scope', function($scope) {
|
||||
$0
|
||||
}]);
|
||||
endsnippet
|
||||
|
||||
snippet aserv "angular service" i
|
||||
service('${1:name}', ['${2:param_annotation}', function(${3:param}) {
|
||||
$0
|
||||
}]);
|
||||
endsnippet
|
||||
|
||||
snippet aservs "angular service" i
|
||||
service('${1:name}', ['$scope', function($scope) {
|
||||
$0
|
||||
}]);
|
||||
endsnippet
|
@ -4,7 +4,7 @@ snippet s "String" b
|
||||
"${1:key}": "${0:value}",
|
||||
endsnippet
|
||||
|
||||
snippet n "number" b
|
||||
snippet n "Number" b
|
||||
"${1:key}": ${0:value},
|
||||
endsnippet
|
||||
|
||||
@ -13,8 +13,39 @@ 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
|
||||
|
@ -32,6 +32,65 @@ for ${1:i}=${2:first},${3:last}${4/^..*/(?0:,:)/}${4:step} do
|
||||
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
|
||||
|
@ -1,5 +1,27 @@
|
||||
priority -50
|
||||
|
||||
global !p
|
||||
def create_table(snip):
|
||||
# retrieving single line from current string and treat it like tabstops count
|
||||
placeholders_string = snip.buffer[snip.line].strip().split("x",1)
|
||||
rows_amount = int(placeholders_string[0])
|
||||
columns_amount = int(placeholders_string[1])
|
||||
|
||||
# erase current line
|
||||
snip.buffer[snip.line] = ''
|
||||
|
||||
# create anonymous snippet with expected content and number of tabstops
|
||||
anon_snippet_title = ' | '.join(['$' + str(col) for col in range(1,columns_amount+1)]) + "\n"
|
||||
anon_snippet_delimiter = ':-|' * (columns_amount-1) + ":-\n"
|
||||
anon_snippet_body = ""
|
||||
for row in range(1,rows_amount+1):
|
||||
anon_snippet_body += ' | '.join(['$' + str(row*columns_amount+col) for col in range(1,columns_amount+1)]) + "\n"
|
||||
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 #
|
||||
###########################
|
||||
@ -50,4 +72,21 @@ $1
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet refl "Reference Link"
|
||||
[${1:${VISUAL:Text}}][${2:id}]$0
|
||||
|
||||
[$2]:${4:http://${3:www.url.com}} "${5:$4}"
|
||||
endsnippet
|
||||
|
||||
snippet fnt "Footnote"
|
||||
[^${1:${VISUAL:Footnote}}]$0
|
||||
|
||||
[^$1]:${2:Text}
|
||||
endsnippet
|
||||
|
||||
post_jump "create_table(snip)"
|
||||
snippet "tb(\d+x\d+)" "Customizable table" br
|
||||
`!p snip.rv = match.group(1)`
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
||||
|
24
sources_non_forked/vim-snippets/UltiSnips/matlab.snippets
Normal file
24
sources_non_forked/vim-snippets/UltiSnips/matlab.snippets
Normal file
@ -0,0 +1,24 @@
|
||||
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
|
@ -4,7 +4,7 @@ extends markdown
|
||||
priority -49
|
||||
|
||||
snippet title "Title Header" b
|
||||
% ${1:`!v Filename('', 'title')`}
|
||||
% ${1:`!v vim_snippets#Filename('$1', 'title')`}
|
||||
% ${2:`!v g:snips_author`}
|
||||
% ${3:`!v strftime("%d %B %Y")`}
|
||||
|
||||
|
270
sources_non_forked/vim-snippets/UltiSnips/php-laravel.snippets
Normal file
270
sources_non_forked/vim-snippets/UltiSnips/php-laravel.snippets
Normal file
@ -0,0 +1,270 @@
|
||||
#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
|
222
sources_non_forked/vim-snippets/UltiSnips/php-phpspec.snippets
Normal file
222
sources_non_forked/vim-snippets/UltiSnips/php-phpspec.snippets
Normal file
@ -0,0 +1,222 @@
|
||||
# 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
|
@ -4,15 +4,17 @@
|
||||
priority -50
|
||||
|
||||
snippet classn "Basic class with namespace snippet" b
|
||||
<?php
|
||||
|
||||
namespace `!p
|
||||
abspath = os.path.abspath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||
relpath = os.path.relpath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
||||
if m:
|
||||
snip.rv = m.group().replace('/', '\\')
|
||||
`;
|
||||
|
||||
/**
|
||||
* ${1:@author `whoami`}
|
||||
* ${1:@author `!v g:snips_author`}
|
||||
*/
|
||||
class `!p
|
||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
@ -26,9 +28,11 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
endsnippet
|
||||
|
||||
snippet contr "Symfony2 controller" b
|
||||
<?php
|
||||
|
||||
namespace `!p
|
||||
abspath = os.path.abspath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||
relpath = os.path.relpath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
||||
if m:
|
||||
snip.rv = m.group().replace('/', '\\')
|
||||
`;
|
||||
@ -40,7 +44,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* ${1:@author `whoami`}
|
||||
* ${1:@author `!v g:snips_author`}
|
||||
*/
|
||||
class `!p
|
||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
@ -49,36 +53,50 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
}
|
||||
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}")
|
||||
* @Route("$3", name="$4")
|
||||
* @Method({${5:"POST"}})
|
||||
* @Template()
|
||||
*/
|
||||
public function ${1}Action(${2})
|
||||
public function $1Action($2)
|
||||
{
|
||||
${6}
|
||||
$6
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet actt "Symfony2 action and template" b
|
||||
/**
|
||||
* @Route("${3}", name="${4}")
|
||||
* @Route("$3", name="$4")
|
||||
* @Method({${5:"GET"}})
|
||||
* @Template()
|
||||
*/
|
||||
public function ${1}Action(${2})
|
||||
public function $1Action($2)
|
||||
{
|
||||
${6}
|
||||
$6
|
||||
return [];
|
||||
}`!p
|
||||
abspath = os.path.abspath(path)`
|
||||
relpath = os.path.relpath(path)`
|
||||
endsnippet
|
||||
|
||||
snippet comm "Symfony2 command" b
|
||||
<?php
|
||||
|
||||
namespace `!p
|
||||
abspath = os.path.abspath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||
relpath = os.path.relpath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
||||
if m:
|
||||
snip.rv = m.group().replace('/', '\\')
|
||||
`;
|
||||
@ -90,7 +108,7 @@ use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
* ${3:@author `whoami`}
|
||||
* ${3:@author `!v g:snips_author`}
|
||||
*/
|
||||
class `!p
|
||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
@ -98,8 +116,8 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('${1}')
|
||||
->setDescription('${2}')
|
||||
$this->setName('$1')
|
||||
->setDescription('$2')
|
||||
->setDefinition([
|
||||
new InputArgument('', InputArgument::REQUIRED, ''),
|
||||
new InputOption('', null, InputOption::VALUE_NONE, ''),
|
||||
@ -113,9 +131,11 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
endsnippet
|
||||
|
||||
snippet subs "Symfony2 subscriber" b
|
||||
<?php
|
||||
|
||||
namespace `!p
|
||||
abspath = os.path.abspath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||
relpath = os.path.relpath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
||||
if m:
|
||||
snip.rv = m.group().replace('/', '\\')
|
||||
`;
|
||||
@ -123,7 +143,7 @@ if m:
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
/**
|
||||
* ${1:@author `whoami`}
|
||||
* ${1:@author `!v g:snips_author`}
|
||||
*/
|
||||
class `!p
|
||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
@ -144,9 +164,11 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
endsnippet
|
||||
|
||||
snippet transf "Symfony2 form data transformer" b
|
||||
<?php
|
||||
|
||||
namespace `!p
|
||||
abspath = os.path.abspath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||
relpath = os.path.relpath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
||||
if m:
|
||||
snip.rv = m.group().replace('/', '\\')
|
||||
`;
|
||||
@ -155,7 +177,7 @@ use Symfony\Component\Form\DataTransformerInterface;
|
||||
use Symfony\Component\Form\Exception\TransformationFailedException;
|
||||
|
||||
/**
|
||||
* ${3:@author `whoami`}
|
||||
* ${3:@author `!v g:snips_author`}
|
||||
*/
|
||||
class `!p
|
||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
@ -164,23 +186,25 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function transform(${1})
|
||||
public function transform($1)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function reverseTransform(${2})
|
||||
public function reverseTransform($2)
|
||||
{
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ent "Symfony2 doctrine entity" b
|
||||
<?php
|
||||
|
||||
namespace `!p
|
||||
abspath = os.path.abspath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||
relpath = os.path.relpath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
||||
if m:
|
||||
snip.rv = m.group().replace('/', '\\')
|
||||
`;
|
||||
@ -188,7 +212,7 @@ if m:
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* ${3:@author `whoami`}
|
||||
* ${3:@author `!v g:snips_author`}
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @ORM\Table(name="`!p
|
||||
@ -215,9 +239,11 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
endsnippet
|
||||
|
||||
snippet form "Symfony2 form type" b
|
||||
<?php
|
||||
|
||||
namespace `!p
|
||||
abspath = os.path.abspath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||
relpath = os.path.relpath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
||||
if m:
|
||||
snip.rv = m.group().replace('/', '\\')
|
||||
`;
|
||||
@ -227,7 +253,7 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
|
||||
/**
|
||||
* ${2:@author `whoami`}
|
||||
* ${2:@author `!v g:snips_author`}
|
||||
*/
|
||||
class `!p
|
||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
@ -253,15 +279,17 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return '${1}';
|
||||
return '$1';
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ev "Symfony2 event" b
|
||||
<?php
|
||||
|
||||
namespace `!p
|
||||
abspath = os.path.abspath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||
relpath = os.path.relpath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
||||
if m:
|
||||
snip.rv = m.group().replace('/', '\\')
|
||||
`;
|
||||
@ -269,7 +297,7 @@ if m:
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
/**
|
||||
* ${2:@author `whoami`}
|
||||
* ${2:@author `!v g:snips_author`}
|
||||
*/
|
||||
class `!p
|
||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
@ -278,6 +306,55 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet redir "Symfony2 redirect"
|
||||
$this->redirect($this->generateUrl('${1}', ${2}));
|
||||
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,147 +1,67 @@
|
||||
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 array "array"
|
||||
$${1:arrayName} = array('${2}' => ${3});${4}
|
||||
endsnippet
|
||||
|
||||
snippet def "def"
|
||||
define('${1}'${2});${3}
|
||||
endsnippet
|
||||
|
||||
snippet do "do"
|
||||
do {
|
||||
${2:// code... }
|
||||
} while (${1:/* condition */});
|
||||
endsnippet
|
||||
|
||||
snippet doc_f "doc_f"
|
||||
snippet gm "PHP Class Getter" b
|
||||
/**
|
||||
* $2
|
||||
* @return ${4:void}
|
||||
* @author ${5:`!v g:snips_author`}
|
||||
**/
|
||||
${1:public }function ${2:someFunc}(${3})
|
||||
{${6}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet doc_i "doc_i"
|
||||
/**
|
||||
* $1
|
||||
* @package ${2:default}
|
||||
* @author ${3:`!v g:snips_author`}
|
||||
**/
|
||||
interface ${1:someClass}
|
||||
{${4}
|
||||
} // END interface $1"
|
||||
endsnippet
|
||||
|
||||
snippet else "else"
|
||||
else {
|
||||
${1:// code...}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet for "for"
|
||||
for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) {
|
||||
${4:// code...}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet foreachk "foreachk"
|
||||
foreach ($${1:variable} as $${2:key} => $${3:value}){
|
||||
${4:// code...}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet get "get"
|
||||
$_GET['${1}']${2}
|
||||
endsnippet
|
||||
|
||||
snippet if "if"
|
||||
if (${1:/* condition */}) {
|
||||
${2:// code...}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet elif "elseif"
|
||||
elseif (${1:/* condition */}) {
|
||||
${2:// code...}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet inc "inc"
|
||||
include '${1:file}';${2}
|
||||
endsnippet
|
||||
|
||||
snippet log "log"
|
||||
error_log(var_export(${1}, true));${2}
|
||||
endsnippet
|
||||
|
||||
snippet post "post"
|
||||
$_POST['${1}']${2}
|
||||
endsnippet
|
||||
|
||||
snippet req1 "req1"
|
||||
require_once '${1:file}';${2}
|
||||
endsnippet
|
||||
|
||||
snippet session "session"
|
||||
$_SESSION['${1}']${2}
|
||||
endsnippet
|
||||
|
||||
snippet t "t"
|
||||
$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};${5}
|
||||
endsnippet
|
||||
|
||||
snippet var "var"
|
||||
var_export(${1});${2}
|
||||
endsnippet
|
||||
|
||||
snippet getter "PHP Class Getter" b
|
||||
/*
|
||||
* Getter for $1
|
||||
*
|
||||
* @return ${2:string}
|
||||
*/
|
||||
public function get${1/\w+\s*/\u$0/}()
|
||||
public function get${1/\w+\s*/\u$0/}()`!p snip.rv = ': '+t[2] if isPHPScalarTypesEnabled() else ''`
|
||||
{
|
||||
return $this->$1;$2
|
||||
return $this->$1;
|
||||
}
|
||||
$4
|
||||
endsnippet
|
||||
|
||||
snippet setter "PHP Class Setter" b
|
||||
/*
|
||||
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/}($$1)
|
||||
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;$3
|
||||
${4:return $this;}
|
||||
$this->$1 = $$1;
|
||||
|
||||
${5:return $this;}
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet gs "PHP Class Getter Setter" b
|
||||
/*
|
||||
/**
|
||||
* Getter for $1
|
||||
*
|
||||
* @return ${2:string}
|
||||
*/
|
||||
public function get${1/\w+\s*/\u$0/}()
|
||||
public function get${1/\w+\s*/\u$0/}()`!p snip.rv = ': '+t[2] if isPHPScalarTypesEnabled() else ''`
|
||||
{
|
||||
return $this->$1;$2
|
||||
return $this->$1;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Setter for $1
|
||||
*
|
||||
* @param $2 $$1
|
||||
* @return ${3:`!p snip.rv=snip.basename`}
|
||||
*/
|
||||
public function set${1/\w+\s*/\u$0/}($$1)
|
||||
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;$3
|
||||
${4:return $this;}
|
||||
$this->$1 = $$1;
|
||||
|
||||
${5:return $this;}
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet pub "Public function" b
|
||||
@ -230,55 +150,76 @@ function ${1:name}(${2:$param})
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet fore "Foreach loop"
|
||||
foreach ($${1:variable} as $${3:value}){
|
||||
${VISUAL}${4}
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet new "New class instance" b
|
||||
$$1 = new $1($2);
|
||||
$${1:variableName} = new ${2:${1/\w+\s*/\u$0/}}($3);
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet ife "if else"
|
||||
if (${1:/* condition */}) {
|
||||
${2:// code...}
|
||||
} else {
|
||||
${3:// code...}
|
||||
}
|
||||
$0
|
||||
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 ${2:`!p snip.rv=snip.fn.split('.')[0]`}
|
||||
* @author ${3:`!v g:snips_author`}
|
||||
* Class ${1:`!p snip.rv=snip.basename`}
|
||||
* @author ${2:`!v g:snips_author`}
|
||||
*/
|
||||
$1class $2
|
||||
class $1
|
||||
{
|
||||
public function ${4:__construct}(${5:$options})
|
||||
{
|
||||
${6:// code}
|
||||
}
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet interface "interface declaration template" b
|
||||
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.fn.split('.')[0]`}
|
||||
* Interface ${1:`!p snip.rv=snip.basename`}
|
||||
* @author ${2:`!v g:snips_author`}
|
||||
*/
|
||||
interface $1
|
||||
{
|
||||
public function ${3:__construct}(${4:$options})
|
||||
{
|
||||
${5:// code}
|
||||
}
|
||||
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
|
||||
{
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet construct "__construct()" b
|
||||
@ -291,31 +232,29 @@ public function __construct(${1:$dependencies})
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet ve "Dumb debug helper in HTML"
|
||||
echo '<pre>' . var_export($1, 1) . '</pre>';$0
|
||||
endsnippet
|
||||
# PHPUnit snippets
|
||||
snippet testcase "class XYZTest extends \PHPUnit_Framework_TestCase { ... }"
|
||||
<?php
|
||||
|
||||
snippet pc "Dumb debug helper in cli"
|
||||
var_export($1);$0
|
||||
endsnippet
|
||||
namespace `!p
|
||||
relpath = os.path.relpath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
||||
if m:
|
||||
snip.rv = m.group().replace('/', '\\')
|
||||
`;
|
||||
|
||||
# Symfony 2 based snippets
|
||||
snippet sfa "Symfony 2 Controller action"
|
||||
/**
|
||||
* @Route("/${1:route_name}", name="$1")
|
||||
* @Template()
|
||||
*/
|
||||
public function $1Action($2)
|
||||
* @author `!v g:snips_author`
|
||||
*/
|
||||
class `!p
|
||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
` extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$3
|
||||
return ${4:array();}$0
|
||||
public function test$1()
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet inheritdoc "@inheritdoc docblock"
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
endsnippet
|
||||
|
||||
# :vim:ft=snippets:
|
||||
|
@ -1,32 +0,0 @@
|
||||
# suggestion? report bugs?
|
||||
# please go to https://github.com/chrisyue/vim-snippets/issues
|
||||
priority -50
|
||||
|
||||
snippet test "phpunit test class" b
|
||||
namespace `!p
|
||||
abspath = os.path.abspath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||
if m:
|
||||
snip.rv = m.group().replace('/', '\\')
|
||||
`;
|
||||
|
||||
/**
|
||||
* @author `whoami`
|
||||
*/
|
||||
class `!p
|
||||
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
` extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test${1}()
|
||||
{
|
||||
${2}
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet exp "phpunit expects" i
|
||||
expects($this->${1:once}())
|
||||
->method('${2}')
|
||||
->with($this->equalTo(${3})${4})
|
||||
->will($this->returnValue(${5}));
|
||||
endsnippet
|
@ -32,17 +32,17 @@ 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
|
||||
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};
|
||||
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};
|
||||
repeated $1`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1};
|
||||
endsnippet
|
||||
|
||||
snippet enum "Enumeration" b
|
||||
|
@ -133,103 +133,103 @@ endsnippet
|
||||
########################################################################
|
||||
|
||||
snippet alert "Alert Function" b
|
||||
alert("${1:message}")${0}
|
||||
alert("${1:message}")$0
|
||||
endsnippet
|
||||
|
||||
snippet crit "Crit Function" b
|
||||
crit("${1:message}")${0}
|
||||
crit("${1:message}")$0
|
||||
endsnippet
|
||||
|
||||
snippet debug "Debug Function" b
|
||||
debug("${1:message}")${0}
|
||||
debug("${1:message}")$0
|
||||
endsnippet
|
||||
|
||||
snippet defined "Defined Function" b
|
||||
defined(${1:Resource}["${2:name}"])${0}
|
||||
defined(${1:Resource}["${2:name}"])$0
|
||||
endsnippet
|
||||
|
||||
snippet emerg "Emerg Function" b
|
||||
emerg("${1:message}")${0}
|
||||
emerg("${1:message}")$0
|
||||
endsnippet
|
||||
|
||||
snippet extlookup "Simple Extlookup" b
|
||||
$${1:Variable} = extlookup("${2:Lookup}")${0}
|
||||
$${1:Variable} = extlookup("${2:Lookup}")$0
|
||||
endsnippet
|
||||
|
||||
snippet extlookup "Extlookup with defaults" b
|
||||
$${1:Variable} = extlookup("${2:Lookup}", ${3:Default})${0}
|
||||
$${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}
|
||||
$${1:Variable} = extlookup("${2:Lookup}", ${3:Default}, ${4:Data Source})$0
|
||||
endsnippet
|
||||
|
||||
snippet fail "Fail Function" b
|
||||
fail("${1:message}")${0}
|
||||
fail("${1:message}")$0
|
||||
endsnippet
|
||||
|
||||
snippet hiera "Hiera Function" b
|
||||
$${1:Variable} = hiera("${2:Lookup}")${0}
|
||||
$${1:Variable} = hiera("${2:Lookup}")$0
|
||||
endsnippet
|
||||
|
||||
snippet hiera "Hiera with defaults" b
|
||||
$${1:Variable} = hiera("${2:Lookup}", ${3:Default})${0}
|
||||
$${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}
|
||||
$${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}
|
||||
$${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}
|
||||
$${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}
|
||||
$${1:Variable} = hiera_hash("${2:Lookup}", ${3:Default}, ${4:Override})$0
|
||||
endsnippet
|
||||
|
||||
snippet hiera_include "Hiera Include Function" b
|
||||
hiera_include("${1:Lookup}")${0}
|
||||
hiera_include("${1:Lookup}")$0
|
||||
endsnippet
|
||||
|
||||
snippet include "Include Function" b
|
||||
include ${1:classname}${0}
|
||||
include ${1:classname}$0
|
||||
endsnippet
|
||||
|
||||
snippet info "Info Function" b
|
||||
info("${1:message}")${0}
|
||||
info("${1:message}")$0
|
||||
endsnippet
|
||||
|
||||
snippet inline_template "Inline Template Function" b
|
||||
inline_template("<%= ${1:template} %>")${0}
|
||||
inline_template("<%= ${1:template} %>")$0
|
||||
endsnippet
|
||||
|
||||
snippet notice "Notice Function" b
|
||||
notice("${1:message}")${0}
|
||||
notice("${1:message}")$0
|
||||
endsnippet
|
||||
|
||||
snippet realize "Realize Function" b
|
||||
realize(${1:Resource}["${2:name}"])${0}
|
||||
realize(${1:Resource}["${2:name}"])$0
|
||||
endsnippet
|
||||
|
||||
snippet regsubst "Regsubst Function" b
|
||||
regsubst($${1:Target}, '${2:regexp}', '${3:replacement}')${0}
|
||||
regsubst($${1:Target}, '${2:regexp}', '${3:replacement}')$0
|
||||
endsnippet
|
||||
|
||||
snippet split "Split Function" b
|
||||
$${1:Variable} = split($${1:Target}, '${2:regexp}')${0}
|
||||
$${1:Variable} = split($${1:Target}, '${2:regexp}')$0
|
||||
endsnippet
|
||||
|
||||
snippet versioncmp "Version Compare Function" b
|
||||
$${1:Variable} = versioncmp('${1:version}', '${2:version}')${0}
|
||||
$${1:Variable} = versioncmp('${1:version}', '${2:version}')$0
|
||||
endsnippet
|
||||
|
||||
snippet warning "Warning Function" b
|
||||
warning("${1:message}")${0}
|
||||
warning("${1:message}")$0
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
||||
|
@ -7,18 +7,24 @@ priority -50
|
||||
#! header
|
||||
snippet #! "Shebang header for python scripts" b
|
||||
#!/usr/bin/env python
|
||||
# encoding: utf-8
|
||||
# -*- coding: utf-8 -*-
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet ifmain "ifmain" b
|
||||
if __name__ == '__main__':
|
||||
${1:main()}$0
|
||||
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:pass}
|
||||
${3:${VISUAL:pass}}
|
||||
endsnippet
|
||||
|
||||
##########
|
||||
@ -35,6 +41,8 @@ NORMAL = 0x1
|
||||
DOXYGEN = 0x2
|
||||
SPHINX = 0x3
|
||||
GOOGLE = 0x4
|
||||
NUMPY = 0x5
|
||||
JEDI = 0x6
|
||||
|
||||
SINGLE_QUOTES = "'"
|
||||
DOUBLE_QUOTES = '"'
|
||||
@ -69,7 +77,10 @@ def get_quoting_style(snip):
|
||||
return DOUBLE_QUOTES
|
||||
|
||||
def triple_quotes(snip):
|
||||
return get_quoting_style(snip) * 3
|
||||
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):
|
||||
"""
|
||||
@ -105,6 +116,8 @@ def get_style(snip):
|
||||
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
|
||||
|
||||
|
||||
@ -117,12 +130,16 @@ def format_arg(arg, style):
|
||||
return ":%s: TODO" % arg
|
||||
elif style == GOOGLE:
|
||||
return "%s (TODO): TODO" % arg
|
||||
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):
|
||||
elif style in (NORMAL, SPHINX, JEDI):
|
||||
return ":returns: TODO"
|
||||
elif style == GOOGLE:
|
||||
return "Returns: TODO"
|
||||
@ -139,6 +156,8 @@ def write_docstring_args(args, 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)
|
||||
@ -165,6 +184,23 @@ def write_google_docstring_args(args, snip):
|
||||
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']
|
||||
@ -199,10 +235,19 @@ def write_function_docstring(t, snip):
|
||||
write_docstring_args(args, snip)
|
||||
|
||||
style = get_style(snip)
|
||||
snip += format_return(style)
|
||||
|
||||
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
|
||||
|
||||
########################################
|
||||
@ -441,13 +486,18 @@ def __coerce__(self, other):
|
||||
${25:pass}
|
||||
endsnippet
|
||||
|
||||
snippet deff
|
||||
def ${1:fname}(`!p snip.rv = vim.eval('indent(".") ? "self" : ""')`$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) `
|
||||
${0:pass}
|
||||
${5:${VISUAL:pass}}
|
||||
endsnippet
|
||||
|
||||
|
||||
@ -458,7 +508,7 @@ 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) `
|
||||
${0:pass}
|
||||
${5:${VISUAL:pass}}
|
||||
endsnippet
|
||||
|
||||
|
||||
@ -467,7 +517,7 @@ snippet defs "static method with docstrings" b
|
||||
def ${1:function}(${2:arg1}):
|
||||
`!p snip.rv = triple_quotes(snip)`${4:TODO: Docstring for $1.}`!p
|
||||
write_function_docstring(t, snip) `
|
||||
${0:pass}
|
||||
${5:${VISUAL:pass}}
|
||||
endsnippet
|
||||
|
||||
|
||||
@ -520,19 +570,19 @@ endsnippet
|
||||
####################
|
||||
snippet if "If" b
|
||||
if ${1:condition}:
|
||||
${2:pass}
|
||||
${2:${VISUAL:pass}}
|
||||
endsnippet
|
||||
|
||||
snippet ife "If / Else" b
|
||||
if ${1:condition}:
|
||||
${2:pass}
|
||||
${2:${VISUAL:pass}}
|
||||
else:
|
||||
${3:pass}
|
||||
endsnippet
|
||||
|
||||
snippet ifee "If / Elif / Else" b
|
||||
if ${1:condition}:
|
||||
${2:pass}
|
||||
${2:${VISUAL:pass}}
|
||||
elif ${3:condition}:
|
||||
${4:pass}
|
||||
else:
|
||||
@ -545,33 +595,33 @@ endsnippet
|
||||
##########################
|
||||
snippet try "Try / Except" b
|
||||
try:
|
||||
${1:pass}
|
||||
except ${2:Exception}, ${3:e}:
|
||||
${1:${VISUAL:pass}}
|
||||
except ${2:Exception} as ${3:e}:
|
||||
${4:raise $3}
|
||||
endsnippet
|
||||
|
||||
snippet try "Try / Except / Else" b
|
||||
snippet trye "Try / Except / Else" b
|
||||
try:
|
||||
${1:pass}
|
||||
except ${2:Exception}, ${3:e}:
|
||||
${1:${VISUAL:pass}}
|
||||
except ${2:Exception} as ${3:e}:
|
||||
${4:raise $3}
|
||||
else:
|
||||
${5:pass}
|
||||
endsnippet
|
||||
|
||||
snippet try "Try / Except / Finally" b
|
||||
snippet tryf "Try / Except / Finally" b
|
||||
try:
|
||||
${1:pass}
|
||||
except ${2:Exception}, ${3:e}:
|
||||
${1:${VISUAL:pass}}
|
||||
except ${2:Exception} as ${3:e}:
|
||||
${4:raise $3}
|
||||
finally:
|
||||
${5:pass}
|
||||
endsnippet
|
||||
|
||||
snippet try "Try / Except / Else / Finally" b
|
||||
snippet tryef "Try / Except / Else / Finally" b
|
||||
try:
|
||||
${1:pass}
|
||||
except${2: ${3:Exception}, ${4:e}}:
|
||||
${1:${VISUAL:pass}}
|
||||
except${2: ${3:Exception} as ${4:e}}:
|
||||
${5:raise}
|
||||
else:
|
||||
${6:pass}
|
||||
@ -580,48 +630,36 @@ finally:
|
||||
endsnippet
|
||||
|
||||
|
||||
#####################
|
||||
######################
|
||||
# Assertions & Tests #
|
||||
#####################
|
||||
|
||||
snippet pdb "Set PDB breakpoint" b
|
||||
import pdb; pdb.set_trace()
|
||||
endsnippet
|
||||
|
||||
snippet ipdb "Set IPDB breakpoint" b
|
||||
import ipdb; ipdb.set_trace()
|
||||
endsnippet
|
||||
|
||||
snippet pudb "Set PUDB breakpoint" b
|
||||
import pudb; pudb.set_trace()
|
||||
endsnippet
|
||||
######################
|
||||
|
||||
snippet ae "Assert equal" b
|
||||
self.assertEqual(${1:first},${2:second})
|
||||
self.assertEqual(${1:${VISUAL:first}},${2:second})
|
||||
endsnippet
|
||||
|
||||
snippet at "Assert True" b
|
||||
self.assertTrue(${0:exp})
|
||||
self.assertTrue(${1:${VISUAL:expression}})
|
||||
endsnippet
|
||||
|
||||
snippet af "Assert False" b
|
||||
self.assertFalse(${1:expression})
|
||||
self.assertFalse(${1:${VISUAL:expression}})
|
||||
endsnippet
|
||||
|
||||
snippet aae "Assert almost equal" b
|
||||
self.assertAlmostEqual(${1:first},${2:second})
|
||||
self.assertAlmostEqual(${1:${VISUAL:first}},${2:second})
|
||||
endsnippet
|
||||
|
||||
snippet ar "Assert raises" b
|
||||
self.assertRaises(${1:exception}, ${2:func}${3/.+/, /}${3:arguments})
|
||||
self.assertRaises(${1:exception}, ${2:${VISUAL:func}}${3/.+/, /}${3:arguments})
|
||||
endsnippet
|
||||
|
||||
snippet an "Assert is None" b
|
||||
self.assertIsNone(${0:expression})
|
||||
self.assertIsNone(${1:${VISUAL:expression}})
|
||||
endsnippet
|
||||
|
||||
snippet ann "Assert is not None" b
|
||||
self.assertIsNotNone(${0:expression})
|
||||
self.assertIsNotNone(${1:${VISUAL:expression}})
|
||||
endsnippet
|
||||
|
||||
snippet testcase "pyunit testcase" b
|
||||
@ -636,25 +674,39 @@ class Test${1:Class}(${2:unittest.TestCase}):
|
||||
${5:pass}
|
||||
|
||||
def test_${6:name}(self):
|
||||
${7:pass}
|
||||
${7:${VISUAL:pass}}
|
||||
endsnippet
|
||||
|
||||
snippet " "triple quoted string (double quotes)" b
|
||||
"""
|
||||
${1:doc}
|
||||
${1:${VISUAL:doc}}
|
||||
`!p triple_quotes_handle_trailing(snip, '"')`
|
||||
endsnippet
|
||||
|
||||
snippet ' "triple quoted string (single quotes)" b
|
||||
'''
|
||||
${1:doc}
|
||||
${1:${VISUAL:doc}}
|
||||
`!p triple_quotes_handle_trailing(snip, "'")`
|
||||
endsnippet
|
||||
|
||||
snippet doc "doc block (triple quotes)"
|
||||
`!p snip.rv = triple_quotes(snip)`
|
||||
${1:doc}
|
||||
${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:
|
||||
|
@ -24,11 +24,11 @@ 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})
|
||||
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})
|
||||
is.$1`!p snip.rv = complete(t[1], FIELD_TYPES)`($2${VISUAL})
|
||||
endsnippet
|
||||
|
||||
snippet dl "Download and install a package" b
|
||||
@ -50,50 +50,51 @@ source('${0:file}')
|
||||
endsnippet
|
||||
|
||||
snippet if "If statement"
|
||||
if (${1}) {
|
||||
${0}
|
||||
if ($1) {
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet eif "Else-If statement"
|
||||
else if (${1}) {
|
||||
${0}
|
||||
else if ($1) {
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet el "Else statement"
|
||||
else {
|
||||
${0}
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ife "if .. else"
|
||||
if (${1}) {
|
||||
${2}
|
||||
if ($1) {
|
||||
$2
|
||||
} else {
|
||||
${3}
|
||||
$3
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet wh "while loop"
|
||||
while(${1}) {
|
||||
${2}
|
||||
while($1) {
|
||||
$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet for "for loop"
|
||||
for (${1:item} in ${2:list}) {
|
||||
${3}
|
||||
$3
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet fun "Function definition"
|
||||
${1:name} <- function (${2}) {
|
||||
${0}
|
||||
${1:name} <- function ($2) {
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ret "Return call"
|
||||
return(${0})
|
||||
return($0)
|
||||
endsnippet
|
||||
|
||||
snippet df "Data frame"
|
||||
|
@ -15,14 +15,14 @@ t.boolean :${1:title}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet cla "Create controller class"
|
||||
snippet clac "Create controller class"
|
||||
class ${1:Model}Controller < ApplicationController
|
||||
before_filter :find_${2:model}
|
||||
|
||||
$0
|
||||
|
||||
private
|
||||
def find_${2}
|
||||
def find_$2
|
||||
@$2 = ${3:$1}.find(params[:id]) if params[:id]
|
||||
end
|
||||
end
|
||||
@ -48,7 +48,7 @@ t.float :${1:title}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet cla "Create functional test class"
|
||||
snippet clact "Create functional test class"
|
||||
require 'test_helper'
|
||||
|
||||
class ${1:Model}ControllerTest < ActionController::TestCase
|
||||
@ -133,7 +133,7 @@ class ${1:Model}sController < ApplicationController
|
||||
# PUT /${1/./\l$0/}s/1.xml
|
||||
def update
|
||||
respond_to do |wants|
|
||||
if @${1/./\l$0/}.update_attributes(params[:${1/./\l$0/}])
|
||||
if @${1/./\l$0/}.update(params[:${1/./\l$0/}])
|
||||
flash[:notice] = '${1:Model} was successfully updated.'
|
||||
wants.html { redirect_to(@${1/./\l$0/}) }
|
||||
wants.xml { head :ok }
|
||||
@ -253,7 +253,7 @@ after_validation_on_update $0
|
||||
endsnippet
|
||||
|
||||
snippet asg "assert(var = assigns(:var))"
|
||||
assert(${1:var} = assigns(:${1}), "Cannot find @${1}")
|
||||
assert(${1:var} = assigns(:$1), "Cannot find @$1")
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
@ -270,11 +270,11 @@ end
|
||||
endsnippet
|
||||
|
||||
snippet artnpp "assert_redirected_to (nested path plural)"
|
||||
assert_redirected_to ${10:${2:parent}_${3:child}_path(${4:@}${5:${2}})}
|
||||
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}})}
|
||||
assert_redirected_to ${2:${12:parent}_${13:child}_path(${14:@}${15:$12}, ${16:@}${17:$13})}
|
||||
endsnippet
|
||||
|
||||
snippet artpp "assert_redirected_to (path plural)"
|
||||
@ -282,7 +282,7 @@ 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}})}
|
||||
assert_redirected_to ${2:${12:model}_path(${13:@}${14:$12})}
|
||||
endsnippet
|
||||
|
||||
snippet asrj "assert_rjs"
|
||||
@ -324,7 +324,7 @@ 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}"}
|
||||
belongs_to :${1:object}${2:, :class_name => "${3:${1/[[:alpha:]]+|(_)/(?1::\u$0)/g}}", :foreign_key => "${4:$1_id}"}
|
||||
endsnippet
|
||||
|
||||
snippet crw "cattr_accessor"
|
||||
@ -358,7 +358,7 @@ 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}
|
||||
}get :$1${6:, :id => @$3.to_param}
|
||||
assert_response :success
|
||||
$0
|
||||
end
|
||||
@ -367,7 +367,7 @@ 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 }
|
||||
}post :$1${6:, :id => @$2.to_param}, :${2:model} => { $0 }
|
||||
assert_response :redirect
|
||||
|
||||
end
|
||||
@ -400,23 +400,23 @@ 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}"}
|
||||
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"}
|
||||
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}}
|
||||
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
|
||||
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}"}
|
||||
has_one :${1:object}${2:, :class_name => "${3:${1/[[:alpha:]]+|(_)/(?1::\u$0)/g}}", :foreign_key => "${4:$1_id}"}
|
||||
endsnippet
|
||||
|
||||
snippet logd "logger.debug"
|
||||
@ -514,11 +514,11 @@ redirect_to :controller => "${1:items}", :action => "${2:show}", :id => ${0:@ite
|
||||
endsnippet
|
||||
|
||||
snippet renpp "redirect_to (nested path plural)"
|
||||
redirect_to(${2:${10:parent}_${11:child}_path(${12:@}${13:${10}})})
|
||||
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}})})
|
||||
redirect_to(${2:${12:parent}_${13:child}_path(${14:@}${15:$12}, ${16:@}${17:$13})})
|
||||
endsnippet
|
||||
|
||||
snippet repp "redirect_to (path plural)"
|
||||
@ -526,7 +526,7 @@ redirect_to(${2:${10:model}s_path})
|
||||
endsnippet
|
||||
|
||||
snippet rep "redirect_to (path)"
|
||||
redirect_to(${2:${12:model}_path(${13:@}${14:${12}})})
|
||||
redirect_to(${2:${12:model}_path(${13:@}${14:$12})})
|
||||
endsnippet
|
||||
|
||||
snippet reb "redirect_to :back"
|
||||
@ -601,12 +601,6 @@ respond_to do |wants|
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet resw "respond_with"
|
||||
respond_with(${1:@${2:model}})${3: do |format|
|
||||
format.${4:html} { $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:|)/}
|
||||
@ -799,10 +793,6 @@ snippet xput "xhr put"
|
||||
xhr :put, :${1:update}, :id => ${2:1}, :${3:object} => { $4 }$0
|
||||
endsnippet
|
||||
|
||||
snippet finl "find(:last)"
|
||||
find(:last${1:, :conditions => ['${2:${3:field} = ?}', ${5:true}]})
|
||||
endsnippet
|
||||
|
||||
snippet sweeper "Create sweeper class"
|
||||
class ${1:Model}Sweeper < ActionController::Caching::Sweeper
|
||||
observe ${1:Model}
|
||||
@ -892,12 +882,12 @@ 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}
|
||||
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}
|
||||
${2:get}('/${3:url}').should route_to('`!v substitute(expand('%:t:r'), '_routing_spec$', '', '')`#$1'${4:, ${5:params}})$6
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
@ -28,7 +28,7 @@ SPECIFIC_ADMONITIONS = ["attention", "caution", "danger",
|
||||
#http://docutils.sourceforge.net/docs/ref/rst/directives.html
|
||||
DIRECTIVES = ['topic','sidebar','math','epigraph',
|
||||
'parsed-literal','code','highlights',
|
||||
'pull-quote','compound','container',
|
||||
'pull-quote','compound','container','table','csv-table',
|
||||
'list-table','class','sectnum',
|
||||
'role','default-role','unicode',
|
||||
'raw']
|
||||
@ -238,6 +238,7 @@ if di == 'im':
|
||||
if di == 'fi':
|
||||
content="""
|
||||
:alt: {0}
|
||||
|
||||
{0}""".format(real_name)
|
||||
`
|
||||
..`!p snip.rv = " %s" % link if link else ""` $1`!p
|
||||
@ -281,6 +282,23 @@ snippet ro "Text Roles" w
|
||||
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
|
||||
|
||||
############
|
||||
# Sphinx #
|
||||
############
|
||||
|
@ -1,271 +1,159 @@
|
||||
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" r
|
||||
#!/usr/bin/env ruby
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
|
||||
snippet "^# ?[uU][tT][fF]-?8" "# encoding: UTF-8" r
|
||||
# encoding: UTF-8
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet If "<command> if <expression>"
|
||||
${1:command} if ${0:expression}
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet Unless "<command> unless <expression>"
|
||||
${1:command} unless ${0:expression}
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet if "if <condition> ... end"
|
||||
if ${1:condition}
|
||||
${2:# TODO}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet ife "if <condition> ... else ... end"
|
||||
if ${1:condition}
|
||||
${2:# TODO}
|
||||
else
|
||||
${3:# TODO}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet ifee "if <condition> ... elseif <condition> ... else ... end"
|
||||
if ${1:condition}
|
||||
${2:# TODO}
|
||||
elsif ${3:condition}
|
||||
${4:# TODO}
|
||||
else
|
||||
${0:# TODO}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet unless "unless <condition> ... end"
|
||||
unless ${1:condition}
|
||||
${0:# TODO}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet unlesse "unless <condition> ... else ... end"
|
||||
unless ${1:condition}
|
||||
${2:# TODO}
|
||||
else
|
||||
${0:# TODO}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet unlesee "unless <condition> ... elseif <condition> ... else ... end"
|
||||
unless ${1:condition}
|
||||
${2:# TODO}
|
||||
elsif ${3:condition}
|
||||
${4:# TODO}
|
||||
else
|
||||
${0:# TODO}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "\b(de)?f" "def <name>..." r
|
||||
def ${1:function_name}${2: ${3:*args}}
|
||||
${0:# TODO}
|
||||
def ${1:function_name}${2:(${3:*args})}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet defi "def initialize ..."
|
||||
def initialize${1: ${2:*args}}
|
||||
${0:# TODO}
|
||||
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:# TODO}
|
||||
def ${1:function_name}${2:(${3:*args})}
|
||||
$4
|
||||
rescue
|
||||
${0:# TODO}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet For "(<from>..<to>).each { |<i>| <block> }"
|
||||
(${1:from}..${2:to}).each { |${3:i}| ${4:# TODO} }
|
||||
(${1:from}..${2:to}).each { |${3:i}| $0 }
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet for "(<from>..<to>).each do |<i>| <block> end"
|
||||
(${1:from}..${2:to}).each do |${3:i}|
|
||||
${0:# TODO}
|
||||
end
|
||||
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}| ${3:# TODO} }
|
||||
`!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:# TODO}
|
||||
$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}| ${3:# TODO} }
|
||||
`!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:# TODO}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.Reject" ".reject { |<key>,<value>| <block> }" r
|
||||
`!p snip.rv=match.group(1)`.reject { |${1:key},${2:value}| ${3:# TODO} }
|
||||
`!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:# TODO}
|
||||
$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}| ${3:# TODO} }
|
||||
`!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:# TODO}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.Each_?k(ey)?" ".each_key { |<key>| <block> }" r
|
||||
`!p snip.rv=match.group(1)`.each_key { |${1:key}| ${2:# TODO} }
|
||||
`!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:# TODO}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.Each_?val(ue)?" ".each_value { |<value>| <block> }" r
|
||||
`!p snip.rv=match.group(1)`.each_value { |${1:value}| ${2:# TODO} }
|
||||
`!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:# TODO}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet Each "<elements>.each { |<element>| <block> }"
|
||||
${1:elements}.each { |${2:${1/s$//}}| ${3:# TODO} }
|
||||
snippet "(\S+)\.ea" "<elements>.each do |<element>| <block> end" r
|
||||
`!p snip.rv=match.group(1)`.each { |${1:e}| $0 }
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet each "<elements>.each do |<element>| <block> end"
|
||||
${1:elements}.each do |${2:${1/s$//}}|
|
||||
${0:# TODO}
|
||||
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:# TODO}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "Each_?s(lice)?" "<array>.each_slice(n) { |slice| <block> }" r
|
||||
${1:elements}.each_slice(${2:2}) { |${3:slice}| ${0:# TODO} }
|
||||
${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('$@')
|
||||
@ -275,11 +163,9 @@ try:
|
||||
snip.rv = wmatch.group(1).lower()
|
||||
except:
|
||||
snip.rv = 'element'
|
||||
`}| ${2:# TODO} }
|
||||
`}| $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('$@')
|
||||
@ -290,12 +176,10 @@ try:
|
||||
except:
|
||||
snip.rv = 'element'
|
||||
`}|
|
||||
${0:# TODO}
|
||||
$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('$@')
|
||||
@ -305,11 +189,9 @@ try:
|
||||
snip.rv = wmatch.group(1).lower()
|
||||
except:
|
||||
snip.rv = 'element'
|
||||
`}| ${2:# TODO} }
|
||||
`}| $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('$@')
|
||||
@ -320,12 +202,10 @@ try:
|
||||
except:
|
||||
snip.rv = 'element'
|
||||
`}|
|
||||
${0:# TODO}
|
||||
$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('$@')
|
||||
@ -335,11 +215,9 @@ try:
|
||||
snip.rv = wmatch.group(1).lower()
|
||||
except:
|
||||
snip.rv = 'element'
|
||||
`}| ${2:# TODO} }
|
||||
`}| $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('$@')
|
||||
@ -350,175 +228,70 @@ try:
|
||||
except:
|
||||
snip.rv = 'element'
|
||||
`}|
|
||||
${0:# TODO}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.Each_?w(ith)?_?i(ndex)?" ".each_with_index { |<element>,<i>| <block> }" r
|
||||
`!p snip.rv=match.group(1)`.each_with_index { |${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'
|
||||
`},${2:i}| ${3:# TODO} }$0
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "(\S+)\.each_?w(ith)?_?i(ndex)?" ".each_with_index do |<element>,<i>| <block> end" r
|
||||
`!p snip.rv=match.group(1)`.each_with_index 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'
|
||||
`},${2:i}|
|
||||
${0:# TODO}
|
||||
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}| ${3:# TODO} }
|
||||
`!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:# TODO}
|
||||
$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 do "do |<key>| ... end" i
|
||||
do |${1:args}|
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet Do "do ... end" i
|
||||
do
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
snippet until "until <expression> ... end"
|
||||
until ${1:expression}
|
||||
${0:# TODO}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet Until "begin ... end until <expression>"
|
||||
begin
|
||||
${0:# TODO}
|
||||
$0
|
||||
end until ${1:expression}
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet while "while <expression> ... end"
|
||||
while ${1:expression}
|
||||
${0:# TODO}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet While "begin ... end while <expression>"
|
||||
begin
|
||||
${0:# TODO}
|
||||
$0
|
||||
end while ${1:expression}
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "\b(r|attr)" "attr_reader :<attr_names>" r
|
||||
attr_reader :${0:attr_names}
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "\b(w|attr)" "attr_writer :<attr_names>" r
|
||||
attr_writer :${0:attr_names}
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "\b(rw|attr)" "attr_accessor :<attr_names>" r
|
||||
attr_accessor :${0:attr_names}
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet begin "begin ... rescue ... end"
|
||||
begin
|
||||
${1:# TODO}
|
||||
$1
|
||||
rescue
|
||||
${0:# TODO}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet begin "begin ... rescue ... else ... ensure ... end"
|
||||
begin
|
||||
${1:# Raise exception}
|
||||
rescue Exception => e
|
||||
puts e.message
|
||||
puts e.backtrace.inspect
|
||||
${2:# Rescue}
|
||||
else
|
||||
${3:# other exception}
|
||||
ensure
|
||||
${0:# always excute}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet rescue
|
||||
rescue Exception => e
|
||||
puts e.message
|
||||
@ -526,8 +299,6 @@ rescue Exception => e
|
||||
${0:# Rescue}
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet "\b(case|sw(itch)?)" "case <variable> when <expression> ... end" r
|
||||
case ${1:variable}
|
||||
when ${2:expression}
|
||||
@ -535,32 +306,20 @@ $0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet alias "alias :<new_name> :<old_name>"
|
||||
alias :${1:new_name} :${2:old_name}
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet class "class <class_name> def initialize ... end end"
|
||||
class ${1:class_name}
|
||||
def initialize ${2:*args}
|
||||
def initialize(${2:*args})
|
||||
$0
|
||||
end
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet module "module"
|
||||
module ${1:module_name}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
|
||||
|
||||
snippet ###
|
||||
=begin
|
||||
$0
|
||||
|
@ -4,249 +4,103 @@
|
||||
|
||||
priority -50
|
||||
|
||||
snippet fn "A function, optionally with arguments and return type." b
|
||||
fn ${1:function_name}(${2})${3/..*/ -> /}${3} {
|
||||
${VISUAL}${0}
|
||||
snippet let "let variable declaration" b
|
||||
let ${1:name}${2:: ${3:type}} = $4;
|
||||
endsnippet
|
||||
|
||||
snippet letm "let mut variable declaration" b
|
||||
let mut ${1:name}${2:: ${3:type}} = $4;
|
||||
endsnippet
|
||||
|
||||
snippet fn "A function, optionally with arguments and return type."
|
||||
fn ${1:function_name}($2)${3/..*/ -> /}$3 {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet test "Test function" b
|
||||
#[test]
|
||||
fn ${1:test_function_name}() {
|
||||
${VISUAL}${0}
|
||||
snippet pfn "A public function, optionally with arguments and return type."
|
||||
pub fn ${1:function_name}($2)${3/..*/ -> /}$3 {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet arg "Function Arguments" i
|
||||
${1:a}: ${2:T}${3:, arg}
|
||||
endsnippet
|
||||
|
||||
snippet bench "Bench function" b
|
||||
#[bench]
|
||||
fn ${1:bench_function_name}(b: &mut test::Bencher) {
|
||||
b.iter(|| {
|
||||
${VISUAL}${0}
|
||||
})
|
||||
snippet || "Closure, anonymous function (inline)" i
|
||||
${1:move }|$2| { $3 }
|
||||
endsnippet
|
||||
|
||||
snippet |} "Closure, anonymous function (block)" i
|
||||
${1:move }|$2| {
|
||||
$3
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet new "A new function" b
|
||||
pub fn new(${2}) -> ${1:Name} {
|
||||
${VISUAL}${0}return $1 { ${3} };
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet main "The main function" b
|
||||
pub fn main() {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet let "A let statement" b
|
||||
let ${1:name}${3} = ${VISUAL}${2};
|
||||
endsnippet
|
||||
|
||||
snippet lmut "let mut = .." b
|
||||
let mut ${1:name}${3} = ${VISUAL}${2};
|
||||
endsnippet
|
||||
|
||||
snippet pri "print!(..)" b
|
||||
print!("${1}"${2/..*/, /}${2});
|
||||
print!("$1"${2/..*/, /}$2);
|
||||
endsnippet
|
||||
|
||||
snippet pln "println!(..)" b
|
||||
println!("${1}"${2/..*/, /}${2});
|
||||
println!("$1"${2/..*/, /}$2);
|
||||
endsnippet
|
||||
|
||||
snippet fmt "format!(..)"
|
||||
format!("${1}"${2/..*/, /}${2});
|
||||
format!("$1"${2/..*/, /}$2);
|
||||
endsnippet
|
||||
|
||||
snippet macro "macro_rules!" b
|
||||
macro_rules! ${1:name} (
|
||||
macro_rules! ${1:name} {
|
||||
(${2:matcher}) => (
|
||||
${3}
|
||||
$3
|
||||
)
|
||||
)
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ec "extern crate ..." b
|
||||
extern crate ${1:sync};
|
||||
endsnippet
|
||||
|
||||
snippet ecl "...extern crate log;" b
|
||||
#![feature(phase)]
|
||||
#[phase(plugin, link)] extern crate log;
|
||||
endsnippet
|
||||
|
||||
snippet mod "A module" b
|
||||
snippet mod "A module" b
|
||||
mod ${1:`!p snip.rv = snip.basename.lower() or "name"`} {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet crate "Create header information" b
|
||||
// Crate name
|
||||
#![crate_name = "${1:crate_name}"]
|
||||
|
||||
// Additional metadata attributes
|
||||
#![desc = "${2:Descrption.}"]
|
||||
#![license = "${3:BSD}"]
|
||||
#![comment = "${4:Comment.}"]
|
||||
|
||||
// Specify the output type
|
||||
#![crate_type = "${5:lib}"]
|
||||
endsnippet
|
||||
|
||||
snippet allow "#[allow(..)]" b
|
||||
#[allow(${1:unused_variable})]
|
||||
endsnippet
|
||||
|
||||
snippet feat "#![feature(..)]" b
|
||||
#![feature(${1:macro_rules})]
|
||||
endsnippet
|
||||
|
||||
snippet der "#[deriving(..)]" b
|
||||
#[deriving(${1:Show})]
|
||||
endsnippet
|
||||
|
||||
snippet attr "#[..]" b
|
||||
#[${1:inline}]
|
||||
endsnippet
|
||||
|
||||
snippet opt "Option<..>"
|
||||
Option<${1:int}>
|
||||
endsnippet
|
||||
|
||||
snippet res "Result<.., ..>"
|
||||
Result<${1:int}, ${2:()}>
|
||||
endsnippet
|
||||
|
||||
snippet if "if .. (if)" b
|
||||
if ${1} {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet el "else .. (el)"
|
||||
else {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet eli "else if .. (eli)"
|
||||
else if ${1} {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ife "if .. else (ife)"
|
||||
if ${1} {
|
||||
${2}
|
||||
} else {
|
||||
${3}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet mat "match"
|
||||
match ${1} {
|
||||
${2} => ${3},
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet loop "loop {}" b
|
||||
loop {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet while "while .. {}" b
|
||||
while ${1} {
|
||||
${VISUAL}${0}
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet for "for .. in .." b
|
||||
for ${1:i} in ${2:range(0u, 10)} {
|
||||
${VISUAL}${0}
|
||||
for ${1:i} in $2 {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet spawn "spawn(proc() { .. });" b
|
||||
spawn(proc() {
|
||||
${VISUAL}${0}
|
||||
});
|
||||
endsnippet
|
||||
|
||||
snippet chan "A channel" b
|
||||
let (${1:tx}, ${2:rx}): (Sender<${3:int}>, Receiver<${4:int}>) = channel();
|
||||
endsnippet
|
||||
|
||||
snippet duplex "Duplex stream" b
|
||||
let (${1:from_child}, ${2:to_child}) = sync::duplex();
|
||||
endsnippet
|
||||
|
||||
snippet todo "A Todo comment"
|
||||
// [TODO]: ${1:Description} - `!v strftime("%Y-%m-%d %I:%M%P")`
|
||||
endsnippet
|
||||
|
||||
snippet fixme "FIXME comment"
|
||||
// FIXME: ${1}
|
||||
endsnippet
|
||||
|
||||
snippet st "Struct" b
|
||||
struct ${1:`!p snip.rv = snip.basename.title() or "Name"`} {
|
||||
${VISUAL}${0}
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
# TODO: fancy dynamic field mirroring like Python slotclass
|
||||
snippet stn "Struct with new constructor." b
|
||||
pub struct ${1:`!p snip.rv = snip.basename.title() or "Name"`} {
|
||||
${3}
|
||||
fd$0
|
||||
}
|
||||
|
||||
impl $1 {
|
||||
pub fn new(${2}) -> $1 {
|
||||
${4}return $1 {
|
||||
${5}
|
||||
};
|
||||
pub fn new($2) -> $1 {
|
||||
$1 { $3 }
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet enum "An enum" b
|
||||
enum ${1:Name} {
|
||||
${VISUAL}${0},
|
||||
snippet fd "Struct field definition" w
|
||||
${1:name}: ${2:Type},
|
||||
endsnippet
|
||||
|
||||
snippet impl "Struct/Trait implementation" b
|
||||
impl ${1:Type/Trait}${2: for ${3:Type}} {
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet type "A type" b
|
||||
type ${1:NewName} = ${VISUAL}${0};
|
||||
endsnippet
|
||||
|
||||
snippet imp "An impl" b
|
||||
impl ${1:Name} {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet drop "Drop implementation" b
|
||||
impl Drop for ${1:Name} {
|
||||
fn drop(&mut self) {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet trait "Trait definition" b
|
||||
trait ${1:Name} {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ss "A static string."
|
||||
static ${1}: &'static str = "${VISUAL}${0}";
|
||||
endsnippet
|
||||
|
||||
snippet stat "A static variable."
|
||||
static ${1}: ${2:uint} = ${VISUAL}${0};
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
||||
|
@ -1,57 +0,0 @@
|
||||
extends css
|
||||
|
||||
priority -50
|
||||
|
||||
snippet imp "@import '...';" b
|
||||
@import '${1:file}';
|
||||
endsnippet
|
||||
|
||||
snippet inc "@include mixin(...);" b
|
||||
@include ${1:mixin}(${2});
|
||||
endsnippet
|
||||
|
||||
snippet ext "@extend %placeholder;" b
|
||||
@extend %${1:%placeholder};
|
||||
endsnippet
|
||||
|
||||
snippet mixin "@mixin (...) { ... }" b
|
||||
@mixin ${1:name}(${2}) {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet fun "@function (...) { ... }" b
|
||||
@function ${1:name}(${2}) {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet if "@if (...) { ... }" b
|
||||
@if ${1:condition} {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet else "@else { ... }" b
|
||||
@else ${1:condition} {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet for "@for loop" b
|
||||
@for ${1:$i} from ${2:1} through ${3:3} {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet each "@each loop" b
|
||||
@each ${1:$item} in ${2:item, item, item} {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet while "@while loop" b
|
||||
@while ${1:$i} ${2:>} ${3:0} {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
@ -33,6 +33,13 @@ snippet !env "#!/usr/bin/env (!env)"
|
||||
`!p snip.rv = '#!/usr/bin/env ' + getShell() + "\n\n" `
|
||||
endsnippet
|
||||
|
||||
snippet sbash "safe bash options"
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
`!p snip.rv ='\n\n' `
|
||||
endsnippet
|
||||
|
||||
snippet temp "Tempfile"
|
||||
${1:TMPFILE}="$(mktemp -t ${2:`!p
|
||||
snip.rv = re.sub(r'[^a-zA-Z]', '_', snip.fn) or "untitled"
|
||||
|
@ -2,15 +2,15 @@ priority -50
|
||||
|
||||
# We use a little hack so that the snippet is expanded
|
||||
# and parsed correctly
|
||||
snippet snip "Snippet definition" b
|
||||
snippet usnip "Ultisnips snippet definition" b
|
||||
`!p snip.rv = "snippet"` ${1:Tab_trigger} "${2:Description}" ${3:b}
|
||||
$0
|
||||
${0:${VISUAL}}
|
||||
`!p snip.rv = "endsnippet"`
|
||||
endsnippet
|
||||
|
||||
snippet global "Global snippet" b
|
||||
`!p snip.rv = "global"` !p
|
||||
$0
|
||||
${0:${VISUAL}}
|
||||
`!p snip.rv = "endglobal"`
|
||||
endsnippet
|
||||
|
||||
|
@ -0,0 +1,10 @@
|
||||
snippet for
|
||||
for (${1:1}, ${2:10}) {${3: |i}|}
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
snippet sdef
|
||||
SynthDef(\\${1:synthName}, {${2: |${3:x}|}
|
||||
$0
|
||||
}).add;
|
||||
endsnippet
|
@ -5,21 +5,21 @@ priority -50
|
||||
###########################################################################
|
||||
snippet for "for... (for)" b
|
||||
for {${1:set i 0}} {${2:\$i < \$n}} {${3:incr i}} {
|
||||
${4}
|
||||
$4
|
||||
}
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet foreach "foreach... (foreach)"
|
||||
foreach ${1:var} ${2:\$list} {
|
||||
${3}
|
||||
$3
|
||||
}
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet if "if... (if)" b
|
||||
if {${1:condition}} {
|
||||
${2}
|
||||
$2
|
||||
}
|
||||
|
||||
endsnippet
|
||||
@ -27,7 +27,7 @@ endsnippet
|
||||
snippet proc "proc... (proc)" b
|
||||
proc ${1:name} {${2:args}} \
|
||||
{
|
||||
${3}
|
||||
$3
|
||||
}
|
||||
|
||||
endsnippet
|
||||
@ -35,16 +35,16 @@ endsnippet
|
||||
snippet switch "switch... (switch)" b
|
||||
switch ${1:-exact} -- ${2:\$var} {
|
||||
${3:match} {
|
||||
${4}
|
||||
$4
|
||||
}
|
||||
default {${5}}
|
||||
default {$5}
|
||||
}
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet while "while... (while)" b
|
||||
while {${1:condition}} {
|
||||
${2}
|
||||
$2
|
||||
}
|
||||
|
||||
endsnippet
|
||||
|
@ -10,10 +10,21 @@ endsnippet
|
||||
|
||||
snippet tab "tabular / array environment" b
|
||||
\begin{${1:t}${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}{${2:c}}
|
||||
$0${2/((?<=.)c|l|r)|./(?1: & )/g}
|
||||
$0${2/(?<=.)(c|l|r)|./(?1: & )/g}
|
||||
\end{$1${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}
|
||||
endsnippet
|
||||
|
||||
snippet table "Table environment" b
|
||||
\begin{table}[${1:htpb}]
|
||||
\centering
|
||||
\caption{${2:caption}}
|
||||
\label{tab:${3:label}}
|
||||
\begin{${4:t}${4/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}{${5:c}}
|
||||
$0${5/(?<=.)(c|l|r)|./(?1: & )/g}
|
||||
\end{$4${4/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}
|
||||
\end{table}
|
||||
endsnippet
|
||||
|
||||
snippet fig "Figure environment" b
|
||||
\begin{figure}[${2:htpb}]
|
||||
\centering
|
||||
@ -42,7 +53,7 @@ snippet desc "Description" b
|
||||
endsnippet
|
||||
|
||||
snippet it "Individual item" b
|
||||
\item ${1}
|
||||
\item $1
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
@ -50,54 +61,54 @@ snippet part "Part" b
|
||||
\part{${1:part name}}
|
||||
\label{prt:${2:${1/(\w+)|\W+/(?1:\L$0\E:_)/ga}}}
|
||||
|
||||
${0}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet cha "Chapter" b
|
||||
\chapter{${1:chapter name}}
|
||||
\label{cha:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
|
||||
|
||||
${0}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet sec "Section" b
|
||||
\section{${1:section name}}
|
||||
\label{sec:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
|
||||
|
||||
${0}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet sub "Subsection" b
|
||||
\subsection{${1:subsection name}}
|
||||
\label{sub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
|
||||
|
||||
${0}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet ssub "Subsubsection" b
|
||||
\subsubsection{${1:subsubsection name}}
|
||||
\label{ssub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
|
||||
|
||||
${0}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet par "Paragraph" b
|
||||
\paragraph{${1:paragraph name}}
|
||||
\label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
|
||||
|
||||
${0}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet subp "Subparagraph" b
|
||||
\subparagraph{${1:subparagraph name}}
|
||||
\label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
|
||||
|
||||
${0}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet ni "Non-indented paragraph" b
|
||||
\noindent
|
||||
${0}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet pac "Package" b
|
||||
|
@ -1,35 +0,0 @@
|
||||
priority -50
|
||||
|
||||
snippet bl "twig block" b
|
||||
{% block ${1} %}
|
||||
${2}
|
||||
{% endblock $1 %}
|
||||
endsnippet
|
||||
|
||||
snippet js "twig javascripts" b
|
||||
{% javascripts '${1}' %}
|
||||
<script src="{{ asset_url }}"></script>
|
||||
{% endjavascripts %}
|
||||
endsnippet
|
||||
|
||||
snippet css "twig stylesheets" b
|
||||
{% stylesheets '${1}' %}
|
||||
<link rel="stylesheet" href="{{ asset_url }}">
|
||||
{% endstylesheets %}
|
||||
endsnippet
|
||||
|
||||
snippet if "twig if" b
|
||||
{% if ${1} %}
|
||||
${2}
|
||||
{% endif %}
|
||||
endsnippet
|
||||
|
||||
snippet for "twig for" b
|
||||
{% for ${1} in ${2} %}
|
||||
${3}
|
||||
{% endfor %}
|
||||
endsnippet
|
||||
|
||||
snippet ext "twig extends" b
|
||||
{% extends ${1} %}
|
||||
endsnippet
|
@ -0,0 +1,3 @@
|
||||
priority -50
|
||||
|
||||
extends javascript
|
@ -13,11 +13,11 @@ 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}
|
||||
let $1 = 1$3
|
||||
endsnippet
|
||||
|
||||
snippet f "function" b
|
||||
fun ${1:function_name}(${2})
|
||||
fun ${1:function_name}($2)
|
||||
${3:" code}
|
||||
endf
|
||||
endsnippet
|
||||
|
@ -3,6 +3,19 @@ if exists("b:done_vimsnippets")
|
||||
endif
|
||||
let b:done_vimsnippets = 1
|
||||
|
||||
" Some variables need default value
|
||||
if !exists("g:snips_author")
|
||||
let g:snips_author = "yourname"
|
||||
endif
|
||||
|
||||
if !exists("g:snips_email")
|
||||
let g:snips_email = "yourname@email.com"
|
||||
endif
|
||||
|
||||
if !exists("g:snips_github")
|
||||
let g:snips_github = "https://github.com/yourname"
|
||||
endif
|
||||
|
||||
" Expanding the path is not needed on Vim 7.4
|
||||
if &cp || version >= 704
|
||||
finish
|
||||
|
@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Helper utilities to format javascript snippets.
|
||||
"""
|
||||
|
||||
ALWAYS = 'always'
|
||||
NEVER = 'never'
|
||||
|
||||
|
||||
def get_option(snip, option, default=None):
|
||||
return snip.opt('g:ultisnips_javascript["{}"]'.format(option), default)
|
||||
|
||||
|
||||
def semi(snip):
|
||||
option = get_option(snip, 'semi', ALWAYS)
|
||||
|
||||
if option == NEVER:
|
||||
ret = ''
|
||||
elif option == ALWAYS:
|
||||
ret = ';'
|
||||
else:
|
||||
ret = ';'
|
||||
return ret
|
||||
|
||||
|
||||
def space_before_function_paren(snip):
|
||||
option = get_option(snip, 'space-before-function-paren', NEVER)
|
||||
|
||||
if option == NEVER:
|
||||
ret = ''
|
||||
elif option == ALWAYS:
|
||||
ret = ' '
|
||||
else:
|
||||
ret = ''
|
||||
return ret
|
||||
|
||||
|
||||
def keyword_spacing(snip):
|
||||
option = get_option(snip, 'keyword-spacing', ALWAYS)
|
||||
|
||||
if option == NEVER:
|
||||
ret = ''
|
||||
elif option == ALWAYS:
|
||||
ret = ' '
|
||||
else:
|
||||
ret = ''
|
||||
return ret
|
@ -1,5 +1,7 @@
|
||||
"""Helper methods used in UltiSnips snippets."""
|
||||
|
||||
import string, vim
|
||||
|
||||
def complete(tab, opts):
|
||||
"""
|
||||
get options that start with tab
|
||||
@ -18,3 +20,73 @@ def complete(tab, opts):
|
||||
if not len(opts):
|
||||
msg = "{0}"
|
||||
return msg.format("|".join(opts))
|
||||
|
||||
def _parse_comments(s):
|
||||
""" Parses vim's comments option to extract comment format """
|
||||
i = iter(s.split(","))
|
||||
|
||||
rv = []
|
||||
try:
|
||||
while True:
|
||||
# get the flags and text of a comment part
|
||||
flags, text = next(i).split(':', 1)
|
||||
|
||||
if len(flags) == 0:
|
||||
rv.append(('OTHER', text, text, text, ""))
|
||||
# parse 3-part comment, but ignore those with O flag
|
||||
elif 's' in flags and 'O' not in flags:
|
||||
ctriple = ["TRIPLE"]
|
||||
indent = ""
|
||||
|
||||
if flags[-1] in string.digits:
|
||||
indent = " " * int(flags[-1])
|
||||
ctriple.append(text)
|
||||
|
||||
flags, text = next(i).split(':', 1)
|
||||
assert flags[0] == 'm'
|
||||
ctriple.append(text)
|
||||
|
||||
flags, text = next(i).split(':', 1)
|
||||
assert flags[0] == 'e'
|
||||
ctriple.append(text)
|
||||
ctriple.append(indent)
|
||||
|
||||
rv.append(ctriple)
|
||||
elif 'b' in flags:
|
||||
if len(text) == 1:
|
||||
rv.insert(0, ("SINGLE_CHAR", text, text, text, ""))
|
||||
except StopIteration:
|
||||
return rv
|
||||
|
||||
def get_comment_format():
|
||||
""" Returns a 4-element tuple (first_line, middle_lines, end_line, indent)
|
||||
representing the comment format for the current file.
|
||||
|
||||
It first looks at the 'commentstring', if that ends with %s, it uses that.
|
||||
Otherwise it parses '&comments' and prefers single character comment
|
||||
markers if there are any.
|
||||
"""
|
||||
commentstring = vim.eval("&commentstring")
|
||||
if commentstring.endswith("%s"):
|
||||
c = commentstring[:-2]
|
||||
return (c, c, c, "")
|
||||
comments = _parse_comments(vim.eval("&comments"))
|
||||
for c in comments:
|
||||
if c[0] == "SINGLE_CHAR":
|
||||
return c[1:]
|
||||
return comments[0][1:]
|
||||
|
||||
|
||||
def make_box(twidth, bwidth=None):
|
||||
b, m, e, i = (s.strip() for s in get_comment_format())
|
||||
bwidth_inner = bwidth - 3 - max(len(b), len(i + e)) if bwidth else twidth + 2
|
||||
sline = b + m + bwidth_inner * m[0] + 2 * m[0]
|
||||
nspaces = (bwidth_inner - twidth) // 2
|
||||
mlines = i + m + " " + " " * nspaces
|
||||
mlinee = " " + " "*(bwidth_inner - twidth - nspaces) + m
|
||||
eline = i + m + bwidth_inner * m[0] + 2 * m[0] + e
|
||||
return sline, mlines, mlinee, eline
|
||||
|
||||
def foldmarker():
|
||||
"Return a tuple of (open fold marker, close fold marker)"
|
||||
return vim.eval("&foldmarker").split(",")
|
||||
|
@ -7,6 +7,8 @@ snippet date
|
||||
`strftime("%Y-%m-%d")`
|
||||
snippet ddate
|
||||
`strftime("%B %d, %Y")`
|
||||
snippet diso
|
||||
`strftime("%Y-%m-%dT%H:%M:%S")`
|
||||
snippet time
|
||||
`strftime("%H:%M")`
|
||||
snippet datetime
|
||||
@ -15,7 +17,7 @@ snippet lorem
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
snippet GPL2
|
||||
${1:One line to give the program's name and a brief description.}
|
||||
Copyright (C) `strftime("%Y")` ${2:copyright holder}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
|
||||
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
|
||||
@ -29,11 +31,10 @@ snippet GPL2
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
${0}
|
||||
snippet LGPL2
|
||||
${1:One line to give the program's name and a brief description.}
|
||||
Copyright (C) `strftime("%Y")` ${2:copyright holder}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
|
||||
This library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published
|
||||
@ -47,11 +48,10 @@ snippet LGPL2
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
${0}
|
||||
snippet GPL3
|
||||
${1:one line to give the program's name and a brief description.}
|
||||
Copyright (C) `strftime("%Y")` ${2:copyright holder}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
|
||||
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
|
||||
@ -65,11 +65,10 @@ snippet GPL3
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
${0}
|
||||
snippet LGPL3
|
||||
${1:One line to give the program's name and a brief description.}
|
||||
Copyright (C) `strftime("%Y")` ${2:copyright holder}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
|
||||
This library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published
|
||||
@ -83,11 +82,10 @@ snippet LGPL3
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
${0}
|
||||
snippet AGPL3
|
||||
${1:one line to give the program's name and a brief description.}
|
||||
Copyright (C) `strftime("%Y")` ${2:copyright holder}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
@ -101,11 +99,19 @@ snippet AGPL3
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
${0}
|
||||
snippet GMGPL linking exception
|
||||
As a special exception, if other files instantiate generics from
|
||||
this unit, or you link this unit with other files to produce an
|
||||
executable, this unit does not by itself cause the resulting
|
||||
executable to be covered by the GNU General Public License.
|
||||
This exception does not however invalidate any other reasons why the
|
||||
executable file might be covered by the GNU Public License.
|
||||
|
||||
${0}
|
||||
snippet BSD2
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright (C) `strftime("%Y")` ${2:copyright holder}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -131,11 +137,10 @@ snippet BSD2
|
||||
The views and conclusions contained in the software and documentation
|
||||
are those of the authors and should not be interpreted as representing
|
||||
official policies, either expressedor implied, of $2.
|
||||
|
||||
${0}
|
||||
snippet BSD3
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright (C) `strftime("%Y")` ${2:copyright holder}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -159,11 +164,10 @@ snippet BSD3
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
${0}
|
||||
snippet BSD4
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright (C) `strftime("%Y")` ${2:copyright holder}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -190,11 +194,10 @@ snippet BSD4
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
${0}
|
||||
snippet MIT
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright (C) `strftime("%Y")` ${2:copyright holder}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the "Software"),
|
||||
@ -213,11 +216,10 @@ snippet MIT
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
${0}
|
||||
snippet APACHE
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright `strftime("%Y")` ${2:copyright holder}
|
||||
Copyright `strftime("%Y")` ${2:`g:snips_author`}
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@ -230,24 +232,21 @@ snippet APACHE
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
${0}
|
||||
snippet BEERWARE
|
||||
${2:one line to give the program's name and a brief description}
|
||||
Copyright `strftime("%Y")` ${3:copyright holder}
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright `strftime("%Y")` ${2:`g:snips_author`}
|
||||
|
||||
Licensed under the "THE BEER-WARE LICENSE" (Revision 42):
|
||||
${1:`g:snips_author`} wrote this file. As long as you retain this notice you
|
||||
$2 wrote this file. As long as you retain this notice you
|
||||
can do whatever you want with this stuff. If we meet some day, and you think
|
||||
this stuff is worth it, you can buy me a beer or coffee in return
|
||||
|
||||
${0}
|
||||
|
||||
snippet WTFPL
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright `strftime("%Y")` ${0:copyright holder}
|
||||
Copyright `strftime("%Y")` ${0:`g:snips_author`}
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
@ -257,3 +256,34 @@ snippet WTFPL
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||
|
||||
${0}
|
||||
snippet MPL2
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
${0}
|
||||
snippet AGPL
|
||||
${1:One line to give the program's name and a brief description.}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
snippet ISC
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")`, ${2:`g:snips_author`}
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
${0}
|
||||
|
@ -75,10 +75,6 @@ snippet do
|
||||
do {
|
||||
${0}
|
||||
} while (${1:cond})
|
||||
snippet wh
|
||||
while ${1:cond}{
|
||||
${0}
|
||||
}
|
||||
snippet for enumerate names
|
||||
for (${1:var} in ${2:object}){
|
||||
${0}
|
||||
@ -100,7 +96,7 @@ snippet interface
|
||||
}
|
||||
snippet try
|
||||
try {
|
||||
${1}
|
||||
${1:${VISUAL}}
|
||||
} catch (error:ErrorType) {
|
||||
${2}
|
||||
} finally {
|
||||
@ -119,11 +115,11 @@ snippet forr
|
||||
# If Condition
|
||||
snippet if
|
||||
if (${1:/* condition */}) {
|
||||
${0}
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet el
|
||||
else {
|
||||
${0}
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# Ternary conditional
|
||||
snippet t
|
||||
|
@ -90,19 +90,19 @@ snippet fors for some
|
||||
|
||||
snippet if if
|
||||
if ${1} then
|
||||
${0}
|
||||
${0:${VISUAL}}
|
||||
end if;
|
||||
|
||||
snippet ife if ... else
|
||||
if ${1} then
|
||||
${2}
|
||||
${2:${VISUAL}}
|
||||
else
|
||||
${0}
|
||||
end if;
|
||||
|
||||
snippet el else
|
||||
else
|
||||
${0}
|
||||
${0:${VISUAL}}
|
||||
|
||||
snippet eif elsif
|
||||
elsif ${1} then
|
||||
@ -110,13 +110,13 @@ snippet eif elsif
|
||||
|
||||
snippet wh while
|
||||
while ${1} loop
|
||||
${0}
|
||||
${0:${VISUAL}}
|
||||
end loop;
|
||||
|
||||
snippet nwh named while
|
||||
${1}:
|
||||
while ${2} loop
|
||||
${0}
|
||||
${0:${VISUAL}}
|
||||
end loop $1;
|
||||
|
||||
snippet for for
|
||||
@ -215,41 +215,3 @@ snippet getl Ada.Text_IO.Get_Line
|
||||
snippet newline Ada.Text_IO.New_Line
|
||||
Ada.Text_IO.New_Line(${1:1});${0}
|
||||
|
||||
snippet gpl GPL license header
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU ${1}General Public License as published by
|
||||
-- the Free Software Foundation; either version ${2:3} 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 $1General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU $1General Public License
|
||||
-- along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- Copyright (C) ${3:Author}, ${4:`strftime("%Y")`}
|
||||
|
||||
${0}
|
||||
|
||||
snippet gplf GPL file license header
|
||||
-- This file is part of ${1:Program-Name}.
|
||||
--
|
||||
-- $1 is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU ${2}General Public License as published by
|
||||
-- the Free Software Foundation, either version ${3:3} of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- $1 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 $2General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU $2General Public License
|
||||
-- along with $1. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- Copyright (C) ${4:Author}, ${5:`strftime("%Y")`}
|
||||
|
||||
${0}
|
||||
|
||||
|
@ -9,22 +9,22 @@ snippet dir
|
||||
# <FilesMatch>
|
||||
snippet filesmatch
|
||||
<FilesMatch "${1:regex}">
|
||||
${0}
|
||||
${0:${VISUAL}}
|
||||
</FilesMatch>
|
||||
# <IfModule>
|
||||
snippet ifmodule
|
||||
<IfModule ${1:mod_example.c}>
|
||||
${0}
|
||||
${0:${VISUAL}}
|
||||
</IfModule>
|
||||
# <LimitExcept>
|
||||
snippet limitexcept
|
||||
<LimitExcept ${1:POST GET}>
|
||||
${0}
|
||||
${0:${VISUAL}}
|
||||
</LimitExcept>
|
||||
# <Proxy>
|
||||
snippet proxy
|
||||
<Proxy ${1:*}>
|
||||
${0}
|
||||
${0:${VISUAL}}
|
||||
</Proxy>
|
||||
# <VirtualHost>
|
||||
snippet virtualhost
|
||||
|
124
sources_non_forked/vim-snippets/snippets/arduino.snippets
Normal file
124
sources_non_forked/vim-snippets/snippets/arduino.snippets
Normal file
@ -0,0 +1,124 @@
|
||||
snippet setup
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(${1:9600});
|
||||
${2}
|
||||
}
|
||||
|
||||
snippet loop
|
||||
void loop()
|
||||
{
|
||||
${0}
|
||||
}
|
||||
|
||||
snippet inc
|
||||
#include <${1}.h>
|
||||
|
||||
snippet def
|
||||
#define ${1}
|
||||
|
||||
# if
|
||||
snippet if
|
||||
if (${1:/* condition */}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# else
|
||||
snippet el
|
||||
else {
|
||||
${1}
|
||||
}
|
||||
# else if
|
||||
snippet elif
|
||||
else if (${1:/* condition */}) {
|
||||
${2}
|
||||
}
|
||||
# ifi
|
||||
snippet ifi
|
||||
if (${1:/* condition */}) ${2};
|
||||
|
||||
# switch
|
||||
snippet switch
|
||||
switch (${1:/* variable */}) {
|
||||
case ${2:/* variable case */}:
|
||||
${3}
|
||||
${4:break;}${5}
|
||||
default:
|
||||
${6}
|
||||
}
|
||||
|
||||
snippet case
|
||||
case ${1:/* variable case */}:
|
||||
${2}
|
||||
${3:break;}
|
||||
|
||||
# for
|
||||
snippet for
|
||||
for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
|
||||
${4}
|
||||
}
|
||||
# for (custom)
|
||||
snippet forr
|
||||
for (int ${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) {
|
||||
${5}
|
||||
}
|
||||
# while
|
||||
snippet wh
|
||||
while (${1:/* condition */}) {
|
||||
${2}
|
||||
}
|
||||
# do... while
|
||||
snippet do
|
||||
do {
|
||||
${2}
|
||||
} while (${1:/* condition */});
|
||||
##
|
||||
## Functions
|
||||
# function definition
|
||||
snippet fun
|
||||
${1:void} ${2:function_name}(${3})
|
||||
{
|
||||
${4}
|
||||
}
|
||||
|
||||
## IO
|
||||
# pinMode OUTPUT
|
||||
snippet pinout
|
||||
pinMode(${1}, OUTPUT);
|
||||
# pinMode INPUT
|
||||
snippet pinin
|
||||
pinMode(${1}, INPUT);
|
||||
# digitalWrite HIGH
|
||||
snippet dwHigh
|
||||
digitalWrite(${1}, HIGH);
|
||||
# digitalWrite LOW
|
||||
snippet dwLow
|
||||
digitalWrite(${1}, LOW);
|
||||
# digitalRead
|
||||
snippet dr
|
||||
digitalRead(${1});
|
||||
# analogRead
|
||||
snippet ar
|
||||
analogRead(${1});
|
||||
# analogWrite
|
||||
snippet aw
|
||||
analogWrite(${1});
|
||||
# serialRead
|
||||
snippet sr
|
||||
Serial.read();
|
||||
# serialWrite
|
||||
snippet sw
|
||||
Serial.write();
|
||||
# serial.print
|
||||
snippet sp
|
||||
Serial.print(${1});
|
||||
# serial.println
|
||||
snippet sl
|
||||
Serial.println(${1});
|
||||
|
||||
|
||||
# delay
|
||||
snippet dl
|
||||
delay(${1});
|
||||
# millis
|
||||
snippet ml
|
||||
millis();
|
102
sources_non_forked/vim-snippets/snippets/awk.snippets
Normal file
102
sources_non_forked/vim-snippets/snippets/awk.snippets
Normal file
@ -0,0 +1,102 @@
|
||||
# cannot use /usr/bin/env because it does not support parameters (as -f)
|
||||
snippet #! #!/usr/bin/awk -f
|
||||
#!/usr/bin/awk -f
|
||||
|
||||
# @include is a gawk extension
|
||||
snippet inc @include
|
||||
@include "${1}"${0}
|
||||
|
||||
# @load is a gawk extension
|
||||
snippet loa @load
|
||||
@load "${1}"${0}
|
||||
|
||||
snippet beg BEGIN { ... }
|
||||
BEGIN {
|
||||
${0}
|
||||
}
|
||||
|
||||
# BEGINFILE is a gawk extension
|
||||
snippet begf BEGINFILE { ... }
|
||||
BEGINFILE {
|
||||
${0}
|
||||
}
|
||||
|
||||
snippet end END { ... }
|
||||
END {
|
||||
${0}
|
||||
}
|
||||
|
||||
# ENDFILE is a gawk extension
|
||||
snippet endf ENDFILE { ... }
|
||||
ENDFILE {
|
||||
${0}
|
||||
}
|
||||
|
||||
snippet pri print
|
||||
print ${1:"${2}"}${0}
|
||||
|
||||
snippet printf printf
|
||||
printf("${1:%s}\n", ${2})${0}
|
||||
|
||||
snippet ign IGNORECASE
|
||||
IGNORECASE = ${1:1}
|
||||
|
||||
snippet if if {...}
|
||||
if (${1}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
|
||||
snippet ife if ... else ...
|
||||
if (${1}) {
|
||||
${2:${VISUAL}}
|
||||
} else {
|
||||
${0}
|
||||
}
|
||||
|
||||
snippet eif else if ...
|
||||
else if (${1}) {
|
||||
${0}
|
||||
}
|
||||
|
||||
snippet el else {...}
|
||||
else {
|
||||
${0}
|
||||
}
|
||||
|
||||
snippet wh while
|
||||
while (${1}) {
|
||||
${2}
|
||||
}
|
||||
|
||||
snippet do do ... while
|
||||
do {
|
||||
${0}
|
||||
} while (${1})
|
||||
|
||||
snippet for for
|
||||
for (${2:i} = 0; i < ${1:n}; ${3:++i}) {
|
||||
${0}
|
||||
}
|
||||
|
||||
snippet fore for each
|
||||
for (${1:i} in ${2:array}) {
|
||||
${0}
|
||||
}
|
||||
|
||||
# the switch is a gawk extension
|
||||
snippet sw switch
|
||||
switch (${1}) {
|
||||
case ${2}:
|
||||
${3}
|
||||
break
|
||||
default:
|
||||
${0}
|
||||
break
|
||||
}
|
||||
|
||||
# the switch is a gawk extension
|
||||
snippet case case
|
||||
case ${1}:
|
||||
${0}
|
||||
break
|
||||
|
@ -25,7 +25,7 @@ snippet Inc
|
||||
snippet ndef
|
||||
#ifndef $1
|
||||
#define ${1:SYMBOL} ${2:value}
|
||||
#endif
|
||||
#endif /* ifndef $1 */
|
||||
# define
|
||||
snippet def
|
||||
#define
|
||||
@ -37,7 +37,7 @@ snippet ifdef
|
||||
# if
|
||||
snippet #if
|
||||
#if ${1:FOO}
|
||||
${0}
|
||||
${0:${VISUAL}}
|
||||
#endif
|
||||
# header include guard
|
||||
snippet once
|
||||
@ -52,22 +52,28 @@ snippet once
|
||||
## Control Statements
|
||||
# if
|
||||
snippet if
|
||||
if (${1:/* condition */}) {
|
||||
${2}
|
||||
if (${1:true}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet ife
|
||||
if (${1:true}) {
|
||||
${2:${VISUAL}}
|
||||
} else {
|
||||
${0}
|
||||
}
|
||||
# else
|
||||
snippet el
|
||||
else {
|
||||
${1}
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# else if
|
||||
snippet elif
|
||||
else if (${1:/* condition */}) {
|
||||
${2}
|
||||
else if (${1:true}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# ifi
|
||||
snippet ifi
|
||||
if (${1:/* condition */}) ${2};
|
||||
if (${1:true}) ${0};
|
||||
# ternary
|
||||
snippet t
|
||||
${1:/* condition */} ? ${2:a} : ${3:b}
|
||||
@ -92,27 +98,29 @@ snippet case
|
||||
case ${1:/* variable case */}:
|
||||
${2}
|
||||
${3:break;}
|
||||
snippet ret
|
||||
return ${0};
|
||||
##
|
||||
## Loops
|
||||
# for
|
||||
snippet for
|
||||
for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
|
||||
for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
|
||||
${4}
|
||||
}
|
||||
# for (custom)
|
||||
snippet forr
|
||||
for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) {
|
||||
for (int ${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) {
|
||||
${5}
|
||||
}
|
||||
# while
|
||||
snippet wh
|
||||
while (${1:/* condition */}) {
|
||||
${2}
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# do... while
|
||||
snippet do
|
||||
do {
|
||||
${2}
|
||||
${0:${VISUAL}}
|
||||
} while (${1:/* condition */});
|
||||
##
|
||||
## Functions
|
||||
@ -122,6 +130,84 @@ snippet fun
|
||||
{
|
||||
${4}
|
||||
}
|
||||
# function definition with zero parameters
|
||||
snippet fun0
|
||||
${1:void} ${2:function_name}()
|
||||
{
|
||||
${3}
|
||||
}
|
||||
# function definition with Doxygen documentation
|
||||
snippet dfun0
|
||||
/*! \brief ${1:Brief function description here}
|
||||
*
|
||||
* ${2:Detailed description of the function}
|
||||
*
|
||||
* \return ${3:Return parameter description}
|
||||
*/
|
||||
${4:void} ${5:function_name}()
|
||||
{
|
||||
${6}
|
||||
}
|
||||
# function definition with one parameter
|
||||
snippet fun1
|
||||
${1:void} ${2:function_name}(${3:Type} ${4:Parameter})
|
||||
{
|
||||
${5}
|
||||
}
|
||||
# function definition with one parameter with Doxygen documentation
|
||||
snippet dfun1
|
||||
/*! \brief ${1:Brief function description here}
|
||||
*
|
||||
* ${2:Detailed description of the function}
|
||||
*
|
||||
* \param $3 ${4:Parameter description}
|
||||
* \return ${5:Return parameter description}
|
||||
*/
|
||||
${6:void} ${7:function_name}(${8:Type} ${3:Parameter})
|
||||
{
|
||||
${9}
|
||||
}
|
||||
# function definition with two parameters
|
||||
snippet fun2
|
||||
${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter})
|
||||
{
|
||||
${7}
|
||||
}
|
||||
# function definition with two parameters with Doxygen documentation
|
||||
snippet dfun2
|
||||
/*! \brief ${1:Brief function description here}
|
||||
*
|
||||
* ${2:Detailed description of the function}
|
||||
*
|
||||
* \param $3 ${4:Parameter description}
|
||||
* \param $5 ${6:Parameter description}
|
||||
* \return ${7:Return parameter description}
|
||||
*/
|
||||
${8:void} ${9:function_name}(${10:Type} ${3:Parameter}, ${11:Type} ${5:Parameter})
|
||||
{
|
||||
${12}
|
||||
}
|
||||
# function definition with two parameters
|
||||
snippet fun3
|
||||
${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter}, ${7:Type} ${8:Parameter})
|
||||
{
|
||||
${9}
|
||||
}
|
||||
# function definition with two parameters with Doxygen documentation
|
||||
snippet dfun3
|
||||
/*! \brief ${1:Brief function description here}
|
||||
*
|
||||
* ${2:Detailed description of the function}
|
||||
*
|
||||
* \param $3 ${4:Parameter description}
|
||||
* \param $5 ${6:Parameter description}
|
||||
* \param $7 ${8:Parameter description}
|
||||
* \return ${9:Return parameter description}
|
||||
*/
|
||||
${10:void} ${11:function_name}(${12:Type} ${3:Parameter}, ${13:Type} ${5:Parameter}, ${14:Type} ${7:Parameter})
|
||||
{
|
||||
${15}
|
||||
}
|
||||
# function declaration
|
||||
snippet fund
|
||||
${1:void} ${2:function_name}(${3});
|
||||
@ -132,18 +218,39 @@ snippet td
|
||||
typedef ${1:int} ${2:MyCustomType};
|
||||
# struct
|
||||
snippet st
|
||||
/*! \struct $1
|
||||
* \brief ${3:Brief struct description}
|
||||
*
|
||||
* ${4:Detailed description}
|
||||
*/
|
||||
struct ${1:`vim_snippets#Filename('$1_t', 'name')`} {
|
||||
${2:/* data */}
|
||||
}${3: /* optional variable list */};
|
||||
${2:Data} /*!< ${4:Description} */
|
||||
}${5: /* optional variable list */};
|
||||
# typedef struct
|
||||
snippet tds
|
||||
/*! \struct $2
|
||||
* \brief ${5:Brief struct description}
|
||||
*
|
||||
* ${6:Detailed description}
|
||||
*/
|
||||
typedef struct ${2:_$1 }{
|
||||
${3:/* data */}
|
||||
m_${3:Data} /*!< ${4:Description} */
|
||||
} ${1:`vim_snippets#Filename('$1_t', 'name')`};
|
||||
|
||||
snippet enum
|
||||
/*! \enum $1
|
||||
*
|
||||
* ${2:Detailed description}
|
||||
*/
|
||||
enum ${1:name} { ${0} };
|
||||
# typedef enum
|
||||
snippet tde
|
||||
/*! \enum $2
|
||||
*
|
||||
* ${4:Detailed description}
|
||||
*/
|
||||
typedef enum {
|
||||
${1:/* data */}
|
||||
${1:Data} /*!< ${3:Description} */
|
||||
} ${2:foo};
|
||||
##
|
||||
## Input/Output
|
||||
@ -153,6 +260,12 @@ snippet pr
|
||||
# fprintf (again, this isn't as nice as TextMate's version, but it works)
|
||||
snippet fpr
|
||||
fprintf(${1:stderr}, "${2:%s}\n"${3});
|
||||
snippet prd
|
||||
printf("${1:} = %d\n", $1);
|
||||
snippet prf
|
||||
printf("${1:} = %f\n", $1);
|
||||
snippet prx
|
||||
printf("${1:} = %${2}\n", $1);
|
||||
# getopt
|
||||
snippet getopt
|
||||
int choice;
|
||||
@ -211,27 +324,12 @@ snippet getopt
|
||||
}
|
||||
}
|
||||
##
|
||||
# TODO section
|
||||
snippet todo
|
||||
/*! TODO: ${1:Todo description here}
|
||||
* \todo $1
|
||||
*/
|
||||
## Miscellaneous
|
||||
# This is kind of convenient
|
||||
snippet .
|
||||
[${1}]
|
||||
# GPL
|
||||
snippet gpl
|
||||
/*
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright (C) ${1:Author}, `strftime("%Y")`
|
||||
*/
|
||||
|
||||
${0}
|
||||
|
@ -1,76 +1,73 @@
|
||||
snippet comm
|
||||
(comment
|
||||
${0}
|
||||
)
|
||||
${0})
|
||||
snippet condp
|
||||
(condp ${1:pred} ${2:expr}
|
||||
${0})
|
||||
${0})
|
||||
snippet def
|
||||
(def ${0})
|
||||
snippet defm
|
||||
(defmethod ${1:multifn} "${2:doc-string}" ${3:dispatch-val} [${4:args}]
|
||||
${0})
|
||||
${0})
|
||||
snippet defmm
|
||||
(defmulti ${1:name} "${2:doc-string}" ${0:dispatch-fn})
|
||||
snippet defma
|
||||
(defmacro ${1:name} "${2:doc-string}" ${0:dispatch-fn})
|
||||
snippet defn
|
||||
(defn ${1:name} "${2:doc-string}" [${3:arg-list}]
|
||||
${0})
|
||||
${0})
|
||||
snippet defp
|
||||
(defprotocol ${1:name}
|
||||
${0})
|
||||
${0})
|
||||
snippet defr
|
||||
(defrecord ${1:name} [${2:fields}]
|
||||
${3:protocol}
|
||||
${0})
|
||||
${3:protocol}
|
||||
${0})
|
||||
snippet deft
|
||||
(deftest ${1:name}
|
||||
(is (= ${2:assertion})))
|
||||
${0})
|
||||
(is (= ${0:assertion})))
|
||||
snippet is
|
||||
(is (= ${1} ${0}))
|
||||
snippet defty
|
||||
(deftype ${1:Name} [${2:fields}]
|
||||
${3:Protocol}
|
||||
${0})
|
||||
${3:Protocol}
|
||||
${0})
|
||||
snippet doseq
|
||||
(doseq [${1:elem} ${2:coll}]
|
||||
${0})
|
||||
${0})
|
||||
snippet fn
|
||||
(fn [${1:arg-list}] ${0})
|
||||
snippet if
|
||||
(if ${1:test-expr}
|
||||
${2:then-expr}
|
||||
${0:else-expr})
|
||||
${2:then-expr}
|
||||
${0:else-expr})
|
||||
snippet if-let
|
||||
(if-let [${1:result} ${2:test-expr}]
|
||||
(${3:then-expr} $1)
|
||||
(${0:else-expr}))
|
||||
snippet imp
|
||||
(:import [${1:package}])
|
||||
& {:keys [${1:keys}] :or {${0:defaults}}}
|
||||
& {:keys [${1:keys}] :or {${0:defaults}}}
|
||||
snippet let
|
||||
(let [${1:name} ${2:expr}]
|
||||
${0})
|
||||
snippet letfn
|
||||
(letfn [(${1:name) [${2:args}]
|
||||
${0})])
|
||||
(letfn [(${1:name}) [${2:args}]
|
||||
${0})])
|
||||
snippet map
|
||||
(map ${1:func} ${0:coll})
|
||||
snippet mapl
|
||||
(map #(${1:lambda}) ${0:coll})
|
||||
snippet met
|
||||
(${1:name} [${2:this} ${3:args}]
|
||||
${0})
|
||||
${0})
|
||||
snippet ns
|
||||
(ns ${1:name}
|
||||
${0})
|
||||
(ns ${0:name})
|
||||
snippet dotimes
|
||||
(dotimes [_ 10]
|
||||
(time
|
||||
(dotimes [_ ${1:times}]
|
||||
${0})))
|
||||
(time
|
||||
(dotimes [_ ${1:times}]
|
||||
${0})))
|
||||
snippet pmethod
|
||||
(${1:name} [${2:this} ${0:args}])
|
||||
snippet refer
|
||||
|
@ -1,58 +1,83 @@
|
||||
snippet cmake
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
||||
PROJECT(${1:ProjectName})
|
||||
snippet init
|
||||
cmake_minimum_required(version ${1:2.8.2})
|
||||
project(${2:ProjectName})
|
||||
|
||||
FIND_PACKAGE(${2:LIBRARY})
|
||||
find_package(${3:library})
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
${$2_INCLUDE_DIR}
|
||||
)
|
||||
include_directories(${$3_INCLUDE_DIRS})
|
||||
|
||||
ADD_SUBDIRECTORY(${0:src})
|
||||
add_subdirectory(${0:src})
|
||||
|
||||
ADD_EXECUTABLE($1)
|
||||
add_executable($2)
|
||||
|
||||
TARGET_LINK_LIBRARIES($1
|
||||
${$2_LIBRARIES}
|
||||
)
|
||||
target_link_libraries($2 ${$3_LIBRARIES})
|
||||
|
||||
snippet proj
|
||||
project(${0:Name})
|
||||
|
||||
snippet min
|
||||
cmake_minimum_required(version ${0:2.8.2})
|
||||
|
||||
snippet include
|
||||
INCLUDE_DIRECTORIES(
|
||||
${${0:INCLUDE_DIR}}
|
||||
)
|
||||
include_directories(${${0:include_dir}})
|
||||
|
||||
snippet find
|
||||
FIND_PACKAGE(${0:LIBRARY})
|
||||
find_package(${1:library} ${0:REQUIRED})
|
||||
|
||||
snippet glob
|
||||
FILE(GLOB ${1:SRCS} *.${0:cpp})
|
||||
file(glob ${1:srcs} *.${0:cpp})
|
||||
|
||||
snippet subdir
|
||||
ADD_SUBDIRECTORY(${0:src})
|
||||
add_subdirectory(${0:src})
|
||||
|
||||
snippet lib
|
||||
ADD_LIBRARY(${1:lib} ${2:STATIC}
|
||||
${${0:SRCS}}
|
||||
)
|
||||
add_library(${1:lib} ${${0:srcs}})
|
||||
|
||||
snippet link
|
||||
TARGET_LINK_LIBRARIES(${1:bin}
|
||||
${0:somelib}
|
||||
)
|
||||
target_link_libraries(${1:bin} ${0:somelib})
|
||||
|
||||
snippet bin
|
||||
ADD_EXECUTABLE(${1:bin})
|
||||
add_executable(${1:bin})
|
||||
|
||||
snippet set
|
||||
SET(${1:var} ${0:val})
|
||||
set(${1:var} ${0:val})
|
||||
|
||||
snippet dep
|
||||
ADD_DEPENDENCIES(${1:target}
|
||||
add_dependencies(${1:target}
|
||||
${0:dep}
|
||||
)
|
||||
|
||||
snippet Ext_url
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(${1:googletest}
|
||||
URL ${2:http://googletest.googlecode.com/files/gtest-1.7.0.zip}
|
||||
URL_HASH SHA1=${3:f85f6d2481e2c6c4a18539e391aa4ea8ab0394af}
|
||||
SOURCE_DIR "${4:${CMAKE_BINARY_DIR}/gtest-src}"
|
||||
BINARY_DIR "${0:${CMAKE_BINARY_DIR}/gtest-build}"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
||||
|
||||
snippet Ext_git
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(${1:googletest}
|
||||
GIT_REPOSITORY ${2:https://github.com/google/googletest.git}
|
||||
GIT_TAG ${3:master}
|
||||
SOURCE_DIR "${4:${CMAKE_BINARY_DIR}/googletest-src}"
|
||||
BINARY_DIR "${0:${CMAKE_BINARY_DIR}/googletest-build}"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
||||
|
||||
snippet props
|
||||
SET_TARGET_PROPERTIES(${1:target}
|
||||
${2:PROPERTIES} ${3:COMPILE_FLAGS}
|
||||
set_target_properties(${1:target}
|
||||
${2:properties} ${3:compile_flags}
|
||||
${0:"-O3 -Wall -pedantic"}
|
||||
)
|
||||
|
||||
snippet test
|
||||
add_test(${1:ATestName} ${0:testCommand --options})
|
||||
|
171
sources_non_forked/vim-snippets/snippets/codeigniter.snippets
Normal file
171
sources_non_forked/vim-snippets/snippets/codeigniter.snippets
Normal file
@ -0,0 +1,171 @@
|
||||
# Based on nebjak/snipmate.vim/snippets/php.snippets
|
||||
|
||||
# Controller
|
||||
snippet ci_controller
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class ${1:ClassName} extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
${2:// code...}
|
||||
}
|
||||
|
||||
function ${3:index}()
|
||||
{
|
||||
${4:// code...}
|
||||
}
|
||||
}
|
||||
# Model
|
||||
snippet ci_model
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class ${1:ClassName_model} extends CI_Model
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
${2:// code...}
|
||||
}
|
||||
}
|
||||
snippet ci_model_crudl
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class ${1:ClassName_model} extends CI_Model
|
||||
{
|
||||
private $table = '${2:table_name}';
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
${3:// code...}
|
||||
}
|
||||
|
||||
public function create($data)
|
||||
{
|
||||
if($this->db->insert($this->table, $data))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public function read($id)
|
||||
{
|
||||
return $this->db->get_where($this->table, array('id', $id))->result();
|
||||
}
|
||||
|
||||
public function update($id, $data)
|
||||
{
|
||||
if($this->db->update($this->table, $data, array('id' => $id)))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public function delete($id)
|
||||
{
|
||||
if(is_array($id))
|
||||
{
|
||||
$this->db->trans_start();
|
||||
foreach($id as $elem)
|
||||
$this->db->delete($this->table, array('id' => $elem));
|
||||
$this->db->trans_complete();
|
||||
}
|
||||
else
|
||||
{
|
||||
if($this->db->delete($this->table, array('id' => $id)))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function listRows($limit = null, $offset = 0)
|
||||
{
|
||||
if(!is_null($limit))
|
||||
$this->db->limit($limit, $offset);
|
||||
return $this->db->get($this->table)->result();
|
||||
}
|
||||
}
|
||||
# Load view
|
||||
snippet ci_load-view
|
||||
$this->load->view("${1:view_name}", $${2:data});${3}
|
||||
# DB Class snippets
|
||||
snippet ci_db-insert
|
||||
$this->db->insert("${1:table}", $${2:data});${3}
|
||||
snippet ci_db-select
|
||||
$this->db->select("${1:id, ...}");${2}
|
||||
snippet ci_db-from
|
||||
$this->db->from("${1:table}");${2}
|
||||
snippet ci_db-join
|
||||
$this->db->join("${1:table}", "${2:condition}", "${3:type}");${4}
|
||||
snippet ci_db-where
|
||||
$this->db->where("${1:key}", "${2:value}");${3}
|
||||
snippet ci_db-or_where
|
||||
$this->db->or_where("${1:key}", "${2:value}");${3}
|
||||
snippet ci_db-get
|
||||
$this->db->get("${1:table}", ${2:limit}, ${3:offset});${4}
|
||||
snippet ci_db-delete
|
||||
$this->db->delete("${1:table}", "${2:where}");${3}
|
||||
snippet ci_db-update
|
||||
$this->db->update("${1:table}", $${2:set}, $${3:where});${4}
|
||||
# Input Class snippets
|
||||
snippet ci_input-post
|
||||
$this->input->post("${1:index}");${2}
|
||||
snippet ci_input-get
|
||||
$this->input->get("${1:index}");${2}
|
||||
snippet ci_input-cookie
|
||||
$this->input->cookie("${1:index}");${2}
|
||||
snippet ci_input-server
|
||||
$this->input->server("${1:index}");${2}
|
||||
snippet ci_input-user_agent
|
||||
$this->input->user_agent();${1}
|
||||
snippet ci_input-is_ajax_request
|
||||
$this->input->is_ajax_request();${1}
|
||||
snippet ci_input-is_cli_request
|
||||
$this->input->is_cli_request();${1}
|
||||
# Form Validation Class and Form Helper snippets
|
||||
snippet ci_form_validation-set_rules
|
||||
$this->form_validation->set_rules("${1:field}", "${2:label}", "${3:trim|required}");${4}
|
||||
snippet ci_form_open
|
||||
form_open("${1:action}");${2}
|
||||
snippet ci_form_open_multipart
|
||||
form_open_multipart("${1:action}");${2}
|
||||
snippet ci_form_hidden
|
||||
form_hidden("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_input
|
||||
form_input("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_password
|
||||
form_password("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_upload
|
||||
form_upload("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_textarea
|
||||
form_textarea("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_dropdown
|
||||
form_dropdown("${1:name}", $${2:options}, $${3:selected);${4}
|
||||
snippet ci_form_checkbox
|
||||
form_checkbox("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_radio
|
||||
form_radio("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_submit
|
||||
form_submit("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_reset
|
||||
form_reset("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_button
|
||||
form_button("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_label
|
||||
form_label("${1:label text}", "${2:id}");${3}
|
||||
snippet ci_form_close
|
||||
form_close();${1}
|
||||
snippet ci_validation_errors
|
||||
validation_errors();${1}
|
||||
# Session Class snippets
|
||||
snippet ci_session_userdata
|
||||
$this->session->userdata("${1:item}");${2}
|
||||
snippet ci_session_set_userdata
|
||||
$this->session->set_userdata($${1:array});${2}
|
||||
snippet ci_session_flashdata
|
||||
$this->session->flashdata("${1:item}");${2}
|
||||
snippet ci_session_set_flashdata
|
||||
$this->session->set_flashdata("${1:item}", "${2:value}");${3}
|
@ -55,17 +55,17 @@ snippet cla class .. extends .. constructor: ..
|
||||
# If
|
||||
snippet if
|
||||
if ${1:condition}
|
||||
${0:# body...}
|
||||
${0:${VISUAL}}
|
||||
# If __ Else
|
||||
snippet ife
|
||||
if ${1:condition}
|
||||
${2:# body...}
|
||||
${2:${VISUAL}}
|
||||
else
|
||||
${0:# body...}
|
||||
# Else if
|
||||
snippet eif
|
||||
else if ${1:condition}
|
||||
${0:# body...}
|
||||
${0:${VISUAL}}
|
||||
# Ternary If
|
||||
snippet ifte
|
||||
if ${1:condition} then ${2:value} else ${0:other}
|
||||
@ -84,7 +84,7 @@ snippet log
|
||||
# Try __ Catch
|
||||
snippet try
|
||||
try
|
||||
${1}
|
||||
${1:${VISUAL}}
|
||||
catch ${2:error}
|
||||
${0}
|
||||
# Require
|
||||
|
@ -1,3 +1,13 @@
|
||||
extends c
|
||||
|
||||
##
|
||||
## Preprocessor
|
||||
# #include <...>
|
||||
snippet incc
|
||||
#include <${1:iostream}>
|
||||
snippet binc
|
||||
#include <boost/${1:shared_ptr}.hpp>
|
||||
##
|
||||
## STL Collections
|
||||
# std::array
|
||||
snippet array
|
||||
@ -68,20 +78,61 @@ snippet mu
|
||||
## Class
|
||||
# class
|
||||
snippet cl
|
||||
/*! \class $1
|
||||
* \brief ${3:Brief class description}
|
||||
*
|
||||
* ${4:Detailed description}
|
||||
*/
|
||||
class ${1:`vim_snippets#Filename('$1', 'name')`}
|
||||
{
|
||||
public:
|
||||
$1(${2});
|
||||
~$1();
|
||||
virtual ~$1();
|
||||
|
||||
private:
|
||||
${0:/* data */}
|
||||
protected:
|
||||
m_${5}; /*!< ${6:Member description} */
|
||||
};
|
||||
# member function implementation
|
||||
snippet mfun
|
||||
${4:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) {
|
||||
${0}
|
||||
}
|
||||
# member function implementation without parameters
|
||||
snippet dmfun0
|
||||
/*! \brief ${4:Brief function description here}
|
||||
*
|
||||
* ${5:Detailed description}
|
||||
*
|
||||
* \return ${6:Return parameter description}
|
||||
*/
|
||||
${3:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}() {
|
||||
${0}
|
||||
}
|
||||
# member function implementation with one parameter
|
||||
snippet dmfun1
|
||||
/*! \brief ${6:Brief function description here}
|
||||
*
|
||||
* ${7:Detailed description}
|
||||
*
|
||||
* \param $4 ${8:Parameter description}
|
||||
* \return ${9:Return parameter description}
|
||||
*/
|
||||
${5:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3:Type} ${4:Parameter}) {
|
||||
${0}
|
||||
}
|
||||
# member function implementation with two parameter
|
||||
snippet dmfun2
|
||||
/*! \brief ${8:Brief function description here}
|
||||
*
|
||||
* ${9:Detailed description}
|
||||
*
|
||||
* \param $4 ${10:Parameter description}
|
||||
* \param $6 ${11:Parameter description}
|
||||
* \return ${12:Return parameter description}
|
||||
*/
|
||||
${7:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3:Type} ${4:Parameter},${5:Type} ${6:Parameter}) {
|
||||
${0}
|
||||
}
|
||||
# namespace
|
||||
snippet ns
|
||||
namespace ${1:`vim_snippets#Filename('', 'my')`} {
|
||||
@ -96,6 +147,19 @@ snippet cout
|
||||
snippet cin
|
||||
std::cin >> ${1};
|
||||
##
|
||||
## Casts
|
||||
# static
|
||||
snippet sca
|
||||
static_cast<${1:unsigned}>(${2:expr})${3}
|
||||
# dynamic
|
||||
snippet dca
|
||||
dynamic_cast<${1:unsigned}>(${2:expr})${3}
|
||||
# reinterpret
|
||||
snippet rca
|
||||
reinterpret_cast<${1:unsigned}>(${2:expr})${3}
|
||||
# const
|
||||
snippet cca
|
||||
const_cast<${1:unsigned}>(${2:expr})${3}
|
||||
## Iteration
|
||||
# for i
|
||||
snippet fori
|
||||
@ -123,9 +187,19 @@ snippet itera
|
||||
## Lambdas
|
||||
# lamda (one line)
|
||||
snippet ld
|
||||
[${1}](${2}){${3}}
|
||||
[${1}](${2}){${3}};
|
||||
# lambda (multi-line)
|
||||
snippet lld
|
||||
[${1}](${2}){
|
||||
${3}
|
||||
};
|
||||
# snippets exception
|
||||
snippet try
|
||||
try {
|
||||
|
||||
}catch(${1}) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
82
sources_non_forked/vim-snippets/snippets/crystal.snippets
Normal file
82
sources_non_forked/vim-snippets/snippets/crystal.snippets
Normal file
@ -0,0 +1,82 @@
|
||||
snippet req require
|
||||
require "${1}"
|
||||
snippet case
|
||||
case ${1:object}
|
||||
when ${2:condition}
|
||||
${0}
|
||||
end
|
||||
snippet when
|
||||
when ${1:condition}
|
||||
${0}
|
||||
snippet def
|
||||
def ${1:method_name}
|
||||
${0}
|
||||
end
|
||||
snippet pdef
|
||||
private def ${1:method_name}
|
||||
${0}
|
||||
end
|
||||
snippet if
|
||||
if ${1:condition}
|
||||
${0:${VISUAL}}
|
||||
end
|
||||
snippet ife
|
||||
if ${1:condition}
|
||||
${2:${VISUAL}}
|
||||
else
|
||||
${0}
|
||||
end
|
||||
snippet wh
|
||||
while ${1:condition}
|
||||
${0:${VISUAL}}
|
||||
end
|
||||
snippet cla class .. end
|
||||
class ${1:`substitute(vim_snippets#Filename(), "\(_\|^\)\(.\)", "\u\2", "g")`}
|
||||
${0}
|
||||
end
|
||||
snippet mod class .. end
|
||||
module ${1:`substitute(vim_snippets#Filename(), "\(_\|^\)\(.\)", "\u\2", "g")`}
|
||||
${0}
|
||||
end
|
||||
snippet r
|
||||
getter ${0:name}
|
||||
snippet r!
|
||||
getter! ${0:name}
|
||||
snippet r?
|
||||
getter? ${0:name}
|
||||
snippet w
|
||||
setter ${0:name}
|
||||
snippet w!
|
||||
setter! ${0:name}
|
||||
snippet w?
|
||||
setter? ${0:name}
|
||||
snippet rw
|
||||
property ${0:name}
|
||||
snippet rw!
|
||||
property! ${0:name}
|
||||
snippet rw?
|
||||
property? ${0:name}
|
||||
snippet defs
|
||||
def self.${1:class_method_name}
|
||||
${0}
|
||||
end
|
||||
snippet defi
|
||||
def initialize(${1})
|
||||
${0}
|
||||
end
|
||||
snippet do
|
||||
do
|
||||
${0:${VISUAL}}
|
||||
end
|
||||
snippet dov
|
||||
do |${1:v}|
|
||||
${2}
|
||||
end
|
||||
snippet desc
|
||||
describe ${1:`substitute(substitute(vim_snippets#Filename(), "_spec$", "", ""), "\(_\|^\)\(.\)", "\u\2", "g")`} do
|
||||
${0}
|
||||
end
|
||||
snippet it
|
||||
it "${1}" do
|
||||
${0}
|
||||
end
|
@ -56,31 +56,35 @@
|
||||
#
|
||||
# Feedback is welcome!
|
||||
#
|
||||
# entry point
|
||||
# Main
|
||||
snippet sim
|
||||
public static int Main(string[] args) {
|
||||
${1:public }static int Main(string[] args) {
|
||||
${0}
|
||||
return 0;
|
||||
}
|
||||
snippet simc
|
||||
public class Application {
|
||||
public static int Main(string[] args) {
|
||||
${1:public }static int Main(string[] args) {
|
||||
${0}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
snippet svm
|
||||
${1:public }static void Main(string[] args) {
|
||||
${0}
|
||||
}
|
||||
# if condition
|
||||
snippet if
|
||||
if (${1}) {
|
||||
${0}
|
||||
if (${1:true}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet el
|
||||
else {
|
||||
${0}
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet ifs
|
||||
if (${1})
|
||||
${0}
|
||||
${0:${VISUAL}}
|
||||
# ternary conditional
|
||||
snippet t
|
||||
${1} ? ${2} : ${0}
|
||||
@ -89,29 +93,33 @@ snippet ?
|
||||
# do while loop
|
||||
snippet do
|
||||
do {
|
||||
${0}
|
||||
} while (${1});
|
||||
${0:${VISUAL}}
|
||||
} while (${1:true});
|
||||
# while loop
|
||||
snippet wh
|
||||
while (${1}) {
|
||||
${0}
|
||||
while (${1:true}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# for loop
|
||||
snippet for
|
||||
for (int ${1:i} = 0; $1 < ${2:count}; $1${3:++}) {
|
||||
${0}
|
||||
}
|
||||
snippet forr
|
||||
for (int ${1:i} = ${2:length}; $1 >= 0; $1--) {
|
||||
${0}
|
||||
}
|
||||
# foreach
|
||||
snippet fore
|
||||
foreach (var ${1:entry} in ${2}) {
|
||||
foreach (${1:var} ${2:entry} in ${3}) {
|
||||
${0}
|
||||
}
|
||||
snippet foreach
|
||||
foreach (var ${1:entry} in ${2}) {
|
||||
foreach (${1:var} ${2:entry} in ${3}) {
|
||||
${0}
|
||||
}
|
||||
snippet each
|
||||
foreach (var ${1:entry} in ${2}) {
|
||||
foreach (${1:var} ${2:entry} in ${3}) {
|
||||
${0}
|
||||
}
|
||||
# interfaces
|
||||
@ -164,32 +172,32 @@ snippet ctor
|
||||
# properties - auto properties by default.
|
||||
# default type is int with layout get / set.
|
||||
snippet prop
|
||||
${1:public} ${2:int} ${3:} { get; set; }
|
||||
${1:public} ${2:int} ${3} { get; set; }
|
||||
snippet p
|
||||
${1:public} ${2:int} ${3:} { get; set; }
|
||||
${1:public} ${2:int} ${3} { get; set; }
|
||||
snippet p+
|
||||
public ${1:int} ${2:} { get; set; }
|
||||
public ${1:int} ${2} { get; set; }
|
||||
snippet p+&
|
||||
public ${1:int} ${2:} { get; internal set; }
|
||||
public ${1:int} ${2} { get; internal set; }
|
||||
snippet p+|
|
||||
public ${1:int} ${2:} { get; protected set; }
|
||||
public ${1:int} ${2} { get; protected set; }
|
||||
snippet p+-
|
||||
public ${1:int} ${2:} { get; private set; }
|
||||
public ${1:int} ${2} { get; private set; }
|
||||
snippet p&
|
||||
internal ${1:int} ${2:} { get; set; }
|
||||
internal ${1:int} ${2} { get; set; }
|
||||
snippet p&|
|
||||
internal ${1:int} ${2:} { get; protected set; }
|
||||
internal ${1:int} ${2} { get; protected set; }
|
||||
snippet p&-
|
||||
internal ${1:int} ${2:} { get; private set; }
|
||||
internal ${1:int} ${2} { get; private set; }
|
||||
snippet p|
|
||||
protected ${1:int} ${2:} { get; set; }
|
||||
protected ${1:int} ${2} { get; set; }
|
||||
snippet p|-
|
||||
protected ${1:int} ${2:} { get; private set; }
|
||||
protected ${1:int} ${2} { get; private set; }
|
||||
snippet p-
|
||||
private ${1:int} ${2:} { get; set; }
|
||||
private ${1:int} ${2} { get; set; }
|
||||
# property - bool
|
||||
snippet pi
|
||||
${1:public} int ${2:} { get; set; }
|
||||
${1:public} int ${2} { get; set; }
|
||||
snippet pi+
|
||||
public int ${1} { get; set; }
|
||||
snippet pi+&
|
||||
@ -212,7 +220,7 @@ snippet pi-
|
||||
private int ${1} { get; set; }
|
||||
# property - bool
|
||||
snippet pb
|
||||
${1:public} bool ${2:} { get; set; }
|
||||
${1:public} bool ${2} { get; set; }
|
||||
snippet pb+
|
||||
public bool ${1} { get; set; }
|
||||
snippet pb+&
|
||||
@ -235,7 +243,7 @@ snippet pb-
|
||||
private bool ${1} { get; set; }
|
||||
# property - string
|
||||
snippet ps
|
||||
${1:public} string ${2:} { get; set; }
|
||||
${1:public} string ${2} { get; set; }
|
||||
snippet ps+
|
||||
public string ${1} { get; set; }
|
||||
snippet ps+&
|
||||
@ -258,87 +266,87 @@ snippet ps-
|
||||
private string ${1} { get; set; }
|
||||
# members - void
|
||||
snippet m
|
||||
${1:public} ${2:void} ${3:}(${4:}) {
|
||||
${5:}
|
||||
${1:public} ${2:void} ${3}(${4}) {
|
||||
${0}
|
||||
}
|
||||
snippet m+
|
||||
public ${1:void} ${2:}(${3:}) {
|
||||
${4:}
|
||||
public ${1:void} ${2}(${3}) {
|
||||
${0}
|
||||
}
|
||||
snippet m&
|
||||
internal ${1:void} ${2:}(${3:}) {
|
||||
${4:}
|
||||
internal ${1:void} ${2}(${3}) {
|
||||
${0}
|
||||
}
|
||||
snippet m|
|
||||
protected ${1:void} ${2:}(${3:}) {
|
||||
${4:}
|
||||
protected ${1:void} ${2}(${3}) {
|
||||
${0}
|
||||
}
|
||||
snippet m-
|
||||
private ${1:void} ${2:}(${3:}) {
|
||||
${4:}
|
||||
private ${1:void} ${2}(${3}) {
|
||||
${0}
|
||||
}
|
||||
# members - int
|
||||
snippet mi
|
||||
${1:public} int ${2:}(${3:}) {
|
||||
${4:return 0;}
|
||||
${1:public} int ${2}(${3}) {
|
||||
${0:return 0;}
|
||||
}
|
||||
snippet mi+
|
||||
public int ${1:}(${2:}) {
|
||||
${3:return 0;}
|
||||
public int ${1}(${2}) {
|
||||
${0:return 0;}
|
||||
}
|
||||
snippet mi&
|
||||
internal int ${1:}(${2:}) {
|
||||
${3:return 0;}
|
||||
internal int ${1}(${2}) {
|
||||
${0:return 0;}
|
||||
}
|
||||
snippet mi|
|
||||
protected int ${1:}(${2:}) {
|
||||
${3:return 0;}
|
||||
protected int ${1}(${2}) {
|
||||
${0:return 0;}
|
||||
}
|
||||
snippet mi-
|
||||
private int ${1:}(${2:}) {
|
||||
${3:return 0;}
|
||||
private int ${1}(${2}) {
|
||||
${0:return 0;}
|
||||
}
|
||||
# members - bool
|
||||
snippet mb
|
||||
${1:public} bool ${2:}(${3:}) {
|
||||
${4:return false;}
|
||||
${1:public} bool ${2}(${3}) {
|
||||
${0:return false;}
|
||||
}
|
||||
snippet mb+
|
||||
public bool ${1:}(${2:}) {
|
||||
${3:return false;}
|
||||
public bool ${1}(${2}) {
|
||||
${0:return false;}
|
||||
}
|
||||
snippet mb&
|
||||
internal bool ${1:}(${2:}) {
|
||||
${3:return false;}
|
||||
internal bool ${1}(${2}) {
|
||||
${0:return false;}
|
||||
}
|
||||
snippet mb|
|
||||
protected bool ${1:}(${2:}) {
|
||||
${3:return false;}
|
||||
protected bool ${1}(${2}) {
|
||||
${0:return false;}
|
||||
}
|
||||
snippet mb-
|
||||
private bool ${1:}(${2:}) {
|
||||
${3:return false;}
|
||||
private bool ${1}(${2}) {
|
||||
${0:return false;}
|
||||
}
|
||||
# members - string
|
||||
snippet ms
|
||||
${1:public} string ${2:}(${3:}) {
|
||||
${4:return "";}
|
||||
${1:public} string ${2}(${3}) {
|
||||
${0:return "";}
|
||||
}
|
||||
snippet ms+
|
||||
public string ${1:}(${2:}) {
|
||||
${3:return "";}
|
||||
public string ${1}(${2}) {
|
||||
${0:return "";}
|
||||
}
|
||||
snippet ms&
|
||||
internal string ${1:}(${2:}) {
|
||||
${3:return "";}
|
||||
internal string ${1}(${2}) {
|
||||
${0:return "";}
|
||||
}
|
||||
snippet ms|
|
||||
protected string ${1:}(${2:}) {
|
||||
${3:return "";}
|
||||
${0:return "";}
|
||||
}
|
||||
snippet ms-
|
||||
private string ${1:}(${2:}) {
|
||||
${3:return "";}
|
||||
private string ${1}(${2}) {
|
||||
${0:return "";}
|
||||
}
|
||||
# structure
|
||||
snippet struct
|
||||
@ -347,6 +355,11 @@ snippet struct
|
||||
}
|
||||
# enumeration
|
||||
snippet enum
|
||||
enum ${1} {
|
||||
${0}
|
||||
}
|
||||
|
||||
snippet enum+
|
||||
public enum ${1} {
|
||||
${0}
|
||||
}
|
||||
@ -365,10 +378,93 @@ snippet <p
|
||||
snippet <ex
|
||||
<exception cref="${1:System.Exception}">${2}</exception>
|
||||
snippet <r
|
||||
<returns>${1}</returns>{
|
||||
<returns>${1}</returns>
|
||||
snippet <s
|
||||
<see cref="${1}"/>
|
||||
snippet <rem
|
||||
<remarks>${1}</remarks>
|
||||
snippet <c
|
||||
<code>${1}</code>
|
||||
|
||||
snippet cw
|
||||
Console.WriteLine(${1});
|
||||
|
||||
# equals override
|
||||
snippet eq
|
||||
public override bool Equals(object obj) {
|
||||
if (obj == null || GetType() != obj.GetType()) {
|
||||
return false;
|
||||
}
|
||||
${0:throw new NotImplementedException();}
|
||||
return base.Equals(obj);
|
||||
}
|
||||
# exception
|
||||
snippet exc
|
||||
public class ${1:MyException} : ${2:Exception} {
|
||||
public $1() { }
|
||||
public $1(string message) : base(message) { }
|
||||
public $1(string message, Exception inner) : base(message, inner) { }
|
||||
protected $1(
|
||||
System.Runtime.Serialization.SerializationInfo info,
|
||||
System.Runtime.Serialization.StreamingContext context)
|
||||
: base(info, context) { }
|
||||
}
|
||||
# indexer
|
||||
snippet index
|
||||
public ${1:object} this[${2:int} index] {
|
||||
get { ${0} }
|
||||
set { ${0} }
|
||||
}
|
||||
# eventhandler
|
||||
snippet inv
|
||||
EventHandler temp = ${1:MyEvent};
|
||||
if (${2:temp} != null) {
|
||||
$2();
|
||||
}
|
||||
# lock
|
||||
snippet lock
|
||||
lock (${1:this}) {
|
||||
${0}
|
||||
}
|
||||
# namespace
|
||||
snippet namespace
|
||||
namespace ${1:MyNamespace} {
|
||||
${0}
|
||||
}
|
||||
# property
|
||||
snippet prop
|
||||
public ${1:int} ${2:MyProperty} { get; set; }
|
||||
snippet propf
|
||||
private ${1:int} ${2:myVar};
|
||||
public $1 ${3:MyProperty} {
|
||||
get { return $2; }
|
||||
set { $2 = value; }
|
||||
}
|
||||
snippet propg
|
||||
public ${1:int} ${2:MyProperty} { get; private set; }
|
||||
# switch
|
||||
snippet switch
|
||||
switch (${1:switch_on}) {
|
||||
${0}
|
||||
default:
|
||||
}
|
||||
# try
|
||||
snippet try
|
||||
try {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
catch (${1:System.Exception}) {
|
||||
throw;
|
||||
}
|
||||
snippet tryf
|
||||
try {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
finally {
|
||||
${1}
|
||||
}
|
||||
# using
|
||||
snippet usi
|
||||
using(${1:resource}) {
|
||||
${0}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
snippet .
|
||||
snippet . "selector { }"
|
||||
${1} {
|
||||
${0}
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet !
|
||||
snippet ! "!important"
|
||||
!important
|
||||
snippet bdi:m+
|
||||
-moz-border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${0:stretch};
|
||||
@ -31,9 +31,9 @@ snippet @f
|
||||
}
|
||||
snippet @i
|
||||
@import url(${0});
|
||||
snippet @m
|
||||
snippet @m "@media mediatype { }"
|
||||
@media ${1:print} {
|
||||
${0}
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet bg+
|
||||
background: #${1:FFF} url(${2}) ${3:0} ${4:0} ${0:no-repeat};
|
||||
|
1
sources_non_forked/vim-snippets/snippets/cuda.snippets
Normal file
1
sources_non_forked/vim-snippets/snippets/cuda.snippets
Normal file
@ -0,0 +1 @@
|
||||
extends cpp
|
@ -88,13 +88,13 @@ snippet fsw
|
||||
}
|
||||
snippet try
|
||||
try {
|
||||
${1}
|
||||
${1:${VISUAL}}
|
||||
} catch(${2:Exception} ${3:e}) {
|
||||
${4}
|
||||
}
|
||||
snippet tcf
|
||||
try {
|
||||
${0}
|
||||
${0:${VISUAL}}
|
||||
} catch(${1:Exception} ${2:e}) {
|
||||
${3}
|
||||
} finally {
|
||||
@ -102,7 +102,7 @@ snippet tcf
|
||||
}
|
||||
snippet wh
|
||||
while(${1:cond}) {
|
||||
${0}
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet dowh
|
||||
do {
|
||||
|
@ -71,12 +71,12 @@ snippet as
|
||||
assert(${0:/* condition */});
|
||||
snippet try
|
||||
try {
|
||||
${0}
|
||||
${0:${VISUAL}}
|
||||
} catch (${1:Exception e}) {
|
||||
}
|
||||
snippet tryf
|
||||
try {
|
||||
${0}
|
||||
${0:${VISUAL}}
|
||||
} catch (${1:Exception e}) {
|
||||
} finally {
|
||||
}
|
||||
|
34
sources_non_forked/vim-snippets/snippets/eelixir.snippets
Normal file
34
sources_non_forked/vim-snippets/snippets/eelixir.snippets
Normal file
@ -0,0 +1,34 @@
|
||||
extends html
|
||||
|
||||
snippet %
|
||||
<% ${0} %>
|
||||
snippet =
|
||||
<%= ${0} %>
|
||||
snippet end
|
||||
<% end %>
|
||||
snippet for
|
||||
<%= for ${1:item} <- ${2:items} ${3:@conn} do %>
|
||||
${0}
|
||||
<% end %>
|
||||
snippet if
|
||||
<%= if ${1} do %>
|
||||
${0:${VISUAL}}
|
||||
<% end %>
|
||||
snippet ife
|
||||
<%= if ${1} do %>
|
||||
${2:${VISUAL}}
|
||||
<%= else %>
|
||||
${0}
|
||||
<% end %>
|
||||
snippet ft
|
||||
<%= form_tag(${1:"/users"}, method: ${2::post}) %>
|
||||
${0}
|
||||
</form>
|
||||
snippet lin
|
||||
<%= link "${1:Submit}", to: ${2:"/users"}, method: ${3::delete} %>
|
||||
snippet ff
|
||||
<%= form_for @changeset, ${1:"/users"}, fn f -> %>
|
||||
${0}
|
||||
|
||||
<%= submit "Submit" %>
|
||||
<% end %>
|
@ -1,51 +1,81 @@
|
||||
snippet do
|
||||
do
|
||||
${0}
|
||||
${0:${VISUAL}}
|
||||
end
|
||||
snippet if if .. do .. end
|
||||
if ${1} do
|
||||
${0}
|
||||
${0:${VISUAL}}
|
||||
end
|
||||
snippet if if .. do: ..
|
||||
snippet if: if .. do: ..
|
||||
if ${1:condition}, do: ${0}
|
||||
snippet ife if .. do .. else .. end
|
||||
if ${1:condition} do
|
||||
${2}
|
||||
${2:${VISUAL}}
|
||||
else
|
||||
${0}
|
||||
end
|
||||
snippet ife if .. do: .. else:
|
||||
snippet ife: if .. do: .. else:
|
||||
if ${1:condition}, do: ${2}, else: ${0}
|
||||
snippet unless unless .. do .. end
|
||||
unless ${1} do
|
||||
${0}
|
||||
${0:${VISUAL}}
|
||||
end
|
||||
snippet unless unless .. do: ..
|
||||
snippet unless: unless .. do: ..
|
||||
unless ${1:condition}, do: ${0}
|
||||
snippet unlesse unless .. do .. else .. end
|
||||
unless ${1:condition} do
|
||||
${2}
|
||||
${2:${VISUAL}}
|
||||
else
|
||||
${0}
|
||||
end
|
||||
snippet unlesse unless .. do: .. else:
|
||||
snippet unlesse: unless .. do: .. else:
|
||||
unless ${1:condition}, do: ${2}, else: ${0}
|
||||
snippet cond
|
||||
cond do
|
||||
${1} ->
|
||||
${0}
|
||||
${1} ->
|
||||
${0:${VISUAL}}
|
||||
end
|
||||
snippet case
|
||||
case ${1} do
|
||||
${2} ->
|
||||
${2} ->
|
||||
${0}
|
||||
end
|
||||
snippet for
|
||||
for ${1:item} <- ${2:items} do
|
||||
${0}
|
||||
end
|
||||
snippet fori
|
||||
for ${1:item} <- ${2:items}, into: ${3} do
|
||||
${0}
|
||||
end
|
||||
snippet wi
|
||||
with(
|
||||
${1:item} <- ${2:items}
|
||||
) do
|
||||
${0}
|
||||
end
|
||||
snippet wie
|
||||
with(
|
||||
${1:item} <- ${2:items}
|
||||
) do
|
||||
${3}
|
||||
else
|
||||
${4} ->
|
||||
${0}
|
||||
end
|
||||
snippet df
|
||||
def ${1:name}, do: ${2}
|
||||
snippet def
|
||||
def ${1:name} do
|
||||
${0}
|
||||
end
|
||||
snippet defd
|
||||
@doc """
|
||||
${1:doc string}
|
||||
"""
|
||||
def ${2:name} do
|
||||
${0}
|
||||
end
|
||||
snippet defim
|
||||
defimpl ${1:protocol_name}, for: ${2:data_type} do
|
||||
${0}
|
||||
@ -55,9 +85,11 @@ snippet defma
|
||||
${0}
|
||||
end
|
||||
snippet defmo
|
||||
defmodule ${1:module_name} do
|
||||
defmodule ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} do
|
||||
${0}
|
||||
end
|
||||
snippet dfp
|
||||
defp ${1:name}, do: ${2}
|
||||
snippet defp
|
||||
defp ${1:name} do
|
||||
${0}
|
||||
@ -70,20 +102,20 @@ snippet doc
|
||||
@doc """
|
||||
${0}
|
||||
"""
|
||||
snippet docf
|
||||
@doc false
|
||||
snippet fn
|
||||
fn(${1:args}) -> ${0} end
|
||||
snippet fun
|
||||
function do
|
||||
${0}
|
||||
end
|
||||
fn ${1:args} -> ${0} end
|
||||
snippet mdoc
|
||||
@moduledoc """
|
||||
${0}
|
||||
"""
|
||||
snippet mdocf
|
||||
@moduledoc false
|
||||
snippet rec
|
||||
receive do
|
||||
${1} ->
|
||||
${0}
|
||||
${1} ->
|
||||
${0}
|
||||
end
|
||||
snippet req
|
||||
require ${0:module_name}
|
||||
@ -92,12 +124,36 @@ snippet imp
|
||||
snippet ali
|
||||
alias ${0:module_name}
|
||||
snippet test
|
||||
test "${1:test_name}" do
|
||||
test "${1:test name}" do
|
||||
${0}
|
||||
end
|
||||
snippet testa
|
||||
test "${1:test_name}", %{${2:arg: arg}} do
|
||||
${0}
|
||||
end
|
||||
snippet des
|
||||
describe "${1:test group subject}" do
|
||||
${0}
|
||||
end
|
||||
snippet exunit
|
||||
defmodule ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} do
|
||||
use ExUnit.Case, async: true
|
||||
|
||||
${0}
|
||||
end
|
||||
snippet try try .. rescue .. end
|
||||
try do
|
||||
${1}
|
||||
${1:${VISUAL}}
|
||||
rescue
|
||||
${2} -> ${0}
|
||||
end
|
||||
snippet pry
|
||||
require IEx; IEx.pry
|
||||
${0}
|
||||
snippet qu
|
||||
quote do
|
||||
${1}
|
||||
end
|
||||
snippet beh
|
||||
@behaviour ${1:Mix.Task}
|
||||
${0}
|
||||
|
50
sources_non_forked/vim-snippets/snippets/elm.snippets
Normal file
50
sources_non_forked/vim-snippets/snippets/elm.snippets
Normal file
@ -0,0 +1,50 @@
|
||||
snippet mod
|
||||
module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` exposing (${1})
|
||||
${0}
|
||||
snippet imp
|
||||
import ${0:List}
|
||||
snippet impe
|
||||
import ${1:List} exposing (${0:map})
|
||||
snippet fn
|
||||
${1:fn} : ${2:a} -> ${3:a}
|
||||
$1 ${4} =
|
||||
${0}
|
||||
snippet fn1
|
||||
${1:fn} : ${2:a} -> ${3:a}
|
||||
$1 ${4} =
|
||||
${0}
|
||||
snippet fn2
|
||||
${1:fn} : ${2:a} -> ${3:a} -> ${4:a}
|
||||
$1 ${5} =
|
||||
${0}
|
||||
snippet fn3
|
||||
${1:fn} : ${2:a} -> ${3:a} -> ${4:a} -> ${5:a}
|
||||
$1 ${6} =
|
||||
${0}
|
||||
snippet fn0
|
||||
${1:fn} : ${2:a}
|
||||
$1 =
|
||||
${0}
|
||||
snippet case
|
||||
case ${1} of
|
||||
${2} ->
|
||||
${0}
|
||||
snippet -
|
||||
${1} ->
|
||||
${0}
|
||||
snippet let
|
||||
let
|
||||
${1} = ${2}
|
||||
in
|
||||
${0}
|
||||
snippet if
|
||||
if ${1} then
|
||||
${2:${VISUAL}}
|
||||
else
|
||||
${0}
|
||||
snippet ty
|
||||
type ${1:Msg}
|
||||
= ${0}
|
||||
snippet tya
|
||||
type alias ${1:Model} =
|
||||
${0}
|
@ -24,6 +24,10 @@ snippet incl
|
||||
# behavior directive
|
||||
snippet beh
|
||||
-behaviour(${1:behaviour}).
|
||||
snippet ifd
|
||||
-ifdef(${1:TEST}).
|
||||
${0}
|
||||
-endif.
|
||||
# if expression
|
||||
snippet if
|
||||
if
|
||||
@ -42,7 +46,7 @@ snippet fun
|
||||
# try...catch
|
||||
snippet try
|
||||
try
|
||||
${1}
|
||||
${1:${VISUAL}}
|
||||
catch
|
||||
${2:_:_} -> ${0:got_some_exception}
|
||||
end
|
||||
@ -103,8 +107,8 @@ snippet supervisor
|
||||
supervisor:start_link({local, ?SERVER}, ?MODULE, []).
|
||||
|
||||
init([]) ->
|
||||
Server = {${0:my_server}, {$2, start_link, []},
|
||||
permanent, 2000, worker, [$2]},
|
||||
Server = {${0:my_server}, {${2}, start_link, []},
|
||||
permanent, 2000, worker, [${2}]},
|
||||
Children = [Server],
|
||||
RestartStrategy = {one_for_one, 0, 1},
|
||||
{ok, {RestartStrategy, Children}}.
|
||||
@ -478,26 +482,57 @@ snippet gen_event
|
||||
%%%===================================================================
|
||||
%%% Internal functions
|
||||
%%%===================================================================
|
||||
# EUnit snippets
|
||||
snippet eunit
|
||||
-module(${1:`vim_snippets#Filename('', 'my')`}).
|
||||
-include_lib("eunit/include/eunit.hrl").
|
||||
|
||||
${0}
|
||||
snippet ieunit
|
||||
-ifdef(TEST).
|
||||
-include_lib("eunit/include/eunit.hrl").
|
||||
|
||||
${0}
|
||||
|
||||
-endif.
|
||||
snippet as
|
||||
?assert(${0})
|
||||
snippet asn
|
||||
?assertNot(${0})
|
||||
snippet aseq
|
||||
?assertEqual(${1}, ${0})
|
||||
snippet asneq
|
||||
?assertNotEqual(${1}, ${0})
|
||||
snippet asmat
|
||||
?assertMatch(${1:Pattern}, ${0:Expression})
|
||||
snippet asnmat
|
||||
?assertNotMatch(${1:Pattern}, ${0:Expression})
|
||||
snippet aserr
|
||||
?assertError(${1:Pattern}, ${0:Expression})
|
||||
snippet asex
|
||||
?assertExit(${1:Pattern}, ${0:Expression})
|
||||
snippet asexc
|
||||
?assertException(${1:Class}, ${2:Pattern}, ${0:Expression})
|
||||
# common_test test_SUITE
|
||||
snippet testsuite
|
||||
-module(${0:`vim_snippets#Filename('', 'my')`}).
|
||||
|
||||
-include_lib("common_test/include/ct.hrl").
|
||||
|
||||
|
||||
%% Test server callbacks
|
||||
-export([suite/0, all/0, groups/0,
|
||||
init_per_suite/1, end_per_suite/1,
|
||||
init_per_group/2, end_per_group/2,
|
||||
init_per_testcase/2, end_per_testcase/2]).
|
||||
|
||||
|
||||
%% Test cases
|
||||
-export([
|
||||
]).
|
||||
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% COMMON TEST CALLBACK FUNCTIONS
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: suite() -> Info
|
||||
%%
|
||||
@ -512,7 +547,7 @@ snippet testsuite
|
||||
%%--------------------------------------------------------------------
|
||||
suite() ->
|
||||
[{timetrap,{minutes,10}}].
|
||||
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: init_per_suite(Config0) ->
|
||||
%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
|
||||
@ -529,7 +564,7 @@ snippet testsuite
|
||||
%%--------------------------------------------------------------------
|
||||
init_per_suite(Config) ->
|
||||
Config.
|
||||
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: end_per_suite(Config0) -> void() | {save_config,Config1}
|
||||
%%
|
||||
@ -540,7 +575,7 @@ snippet testsuite
|
||||
%%--------------------------------------------------------------------
|
||||
end_per_suite(_Config) ->
|
||||
ok.
|
||||
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: init_per_group(GroupName, Config0) ->
|
||||
%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
|
||||
@ -556,7 +591,7 @@ snippet testsuite
|
||||
%%--------------------------------------------------------------------
|
||||
init_per_group(_GroupName, Config) ->
|
||||
Config.
|
||||
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: end_per_group(GroupName, Config0) ->
|
||||
%% void() | {save_config,Config1}
|
||||
@ -570,7 +605,7 @@ snippet testsuite
|
||||
%%--------------------------------------------------------------------
|
||||
end_per_group(_GroupName, _Config) ->
|
||||
ok.
|
||||
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: init_per_testcase(TestCase, Config0) ->
|
||||
%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
|
||||
@ -589,7 +624,7 @@ snippet testsuite
|
||||
%%--------------------------------------------------------------------
|
||||
init_per_testcase(_TestCase, Config) ->
|
||||
Config.
|
||||
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: end_per_testcase(TestCase, Config0) ->
|
||||
%% void() | {save_config,Config1} | {fail,Reason}
|
||||
@ -605,7 +640,7 @@ snippet testsuite
|
||||
%%--------------------------------------------------------------------
|
||||
end_per_testcase(_TestCase, _Config) ->
|
||||
ok.
|
||||
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: groups() -> [Group]
|
||||
%%
|
||||
@ -629,7 +664,7 @@ snippet testsuite
|
||||
%%--------------------------------------------------------------------
|
||||
groups() ->
|
||||
[].
|
||||
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: all() -> GroupsAndTestCases | {skip,Reason}
|
||||
%%
|
||||
@ -644,14 +679,14 @@ snippet testsuite
|
||||
%% Description: Returns the list of groups and test cases that
|
||||
%% are to be executed.
|
||||
%%--------------------------------------------------------------------
|
||||
all() ->
|
||||
all() ->
|
||||
[].
|
||||
|
||||
|
||||
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% TEST CASES
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: TestCase(Config0) ->
|
||||
%% ok | exit() | {skip,Reason} | {comment,Comment} |
|
||||
|
@ -1,6 +1,7 @@
|
||||
# .erb and .rhmtl files
|
||||
|
||||
# Includes html.snippets
|
||||
extends html
|
||||
|
||||
# Rails *****************************
|
||||
snippet rc
|
||||
@ -22,23 +23,23 @@ snippet for
|
||||
${0}
|
||||
<% end %>
|
||||
snippet rp
|
||||
<%= render :partial => '${0:item}' %>
|
||||
<%= render partial: '${0:item}' %>
|
||||
snippet rpl
|
||||
<%= render :partial => '${1:item}', :locals => { :${2:name} => '${3:value}'${0} } %>
|
||||
<%= render partial: '${1:item}', locals: { :${2:name} => '${3:value}'${0} } %>
|
||||
snippet rps
|
||||
<%= render :partial => '${1:item}', :status => ${0:500} %>
|
||||
<%= render partial: '${1:item}', status: ${0:500} %>
|
||||
snippet rpc
|
||||
<%= render :partial => '${1:item}', :collection => ${0:items} %>
|
||||
<%= render partial: '${1:item}', collection: ${0:items} %>
|
||||
snippet lia
|
||||
<%= link_to '${1:link text...}', :action => '${0:index}' %>
|
||||
<%= link_to '${1:link text...}', action: '${0:index}' %>
|
||||
snippet liai
|
||||
<%= link_to '${1:link text...}', :action => '${2:edit}', :id => ${0:@item} %>
|
||||
<%= link_to '${1:link text...}', action: '${2:edit}', id: ${0:@item} %>
|
||||
snippet lic
|
||||
<%= link_to '${1:link text...}', :controller => '${0:items}' %>
|
||||
<%= link_to '${1:link text...}', controller: '${0:items}' %>
|
||||
snippet lica
|
||||
<%= link_to '${1:link text...}', :controller => '${2:items}', :action => '${0:index}' %>
|
||||
<%= link_to '${1:link text...}', controller: '${2:items}', action: '${0:index}' %>
|
||||
snippet licai
|
||||
<%= link_to '${1:link text...}', :controller => '${2:items}', :action => '${3:edit}', :id => ${0:@item} %>
|
||||
<%= link_to '${1:link text...}', controller: '${2:items}', action: '${3:edit}', id: ${0:@item} %>
|
||||
snippet yield
|
||||
<%= yield ${1::content_symbol} %>
|
||||
snippet conf
|
||||
@ -110,16 +111,16 @@ snippet ofcfs
|
||||
snippet ofs
|
||||
<%= options_for_select ${1:collection}, ${2:value_method} %>
|
||||
snippet rf
|
||||
<%= render :file => "${1:file}"${0} %>
|
||||
<%= render file: "${1:file}"${0} %>
|
||||
snippet rt
|
||||
<%= render :template => "${1:file}"${0} %>
|
||||
<%= render template: "${1:file}"${0} %>
|
||||
snippet slt
|
||||
<%= stylesheet_link_tag ${1::all}, :cache => ${0:true} %>
|
||||
<%= stylesheet_link_tag ${1::all}, cache: ${0:true} %>
|
||||
snippet sslt
|
||||
<%= stylesheet_link_tag "${0}" %>
|
||||
snippet if
|
||||
<% if ${1} %>
|
||||
${0}
|
||||
${0:${VISUAL}}
|
||||
<% end %>
|
||||
snippet ife
|
||||
<% if ${1} %>
|
||||
|
101
sources_non_forked/vim-snippets/snippets/fortran.snippets
Normal file
101
sources_non_forked/vim-snippets/snippets/fortran.snippets
Normal file
@ -0,0 +1,101 @@
|
||||
snippet impl
|
||||
implicit none
|
||||
$0
|
||||
snippet prog
|
||||
program ${1:main}
|
||||
$0
|
||||
end program $1
|
||||
snippet mod
|
||||
module ${1:modulename}
|
||||
$0
|
||||
end module $1
|
||||
snippet proc
|
||||
procedure ${1:name}
|
||||
${0}
|
||||
end procedure $1
|
||||
snippet iface
|
||||
interface ${1:name}
|
||||
${0}
|
||||
end interface $1
|
||||
snippet doc
|
||||
! """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
! File: ${2:`vim_snippets#Filename('$1')`}
|
||||
! Author: `g:snips_author`
|
||||
! Email: `g:snips_email`
|
||||
! Github: `g:snips_github`
|
||||
! Description: $1
|
||||
! """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
$0
|
||||
snippet dox
|
||||
!> @brief ${1}
|
||||
!!
|
||||
!> ${2}
|
||||
!> @author `g:snips_author`
|
||||
${0}
|
||||
snippet doxp
|
||||
!> @param[${1}]${0}
|
||||
# Variables definitions
|
||||
# Boolean
|
||||
snippet bool
|
||||
logical :: $0
|
||||
# Integer
|
||||
snippet int
|
||||
integer :: $0
|
||||
snippet real
|
||||
real :: $0
|
||||
# Double Precision
|
||||
snippet double
|
||||
double precision :: $0
|
||||
# Char
|
||||
snippet str
|
||||
character(len=${1:*}) :: ${0:}
|
||||
# Types
|
||||
snippet type
|
||||
type(${1:name})
|
||||
$0
|
||||
end type
|
||||
snippet const
|
||||
${1:type}, parameter :: $2 = $0
|
||||
snippet arr
|
||||
${1:type}, ${2:allocatable, }dimension(${3::}) :: $0
|
||||
snippet intent
|
||||
${1:type}, intent(inout) :: $0
|
||||
# Array
|
||||
snippet /
|
||||
(/ $1 /) ${2:,&} $0
|
||||
snippet if
|
||||
if (${1:condition}) then
|
||||
$0
|
||||
end if
|
||||
snippet case
|
||||
select case (${1:expr})
|
||||
case ($2)
|
||||
case default
|
||||
$3
|
||||
end select $0
|
||||
snippet do
|
||||
do ${1:i} = ${2:start}, ${3:end}, ${4:incr}
|
||||
$0
|
||||
end do
|
||||
snippet dow
|
||||
do while (${1:condition})
|
||||
$2
|
||||
end do
|
||||
snippet sub
|
||||
subroutine ${1:name}($2)
|
||||
$0
|
||||
end subroutine $1
|
||||
snippet func
|
||||
function ${1:name}($2) result($3)
|
||||
$0
|
||||
end function $1
|
||||
snippet pr
|
||||
write(*,*) $0
|
||||
snippet read
|
||||
read(unit = ${1:fp}, file = ${2:filename}, iostat = ${3:ierr}) $0
|
||||
snippet write
|
||||
write(unit = ${1:fp}, file = ${2:filename}, iostat = ${3:ierr}) $0
|
||||
snippet open
|
||||
open(unit = ${1:fp}, file = ${2:filename}, status = ${3:unknown}, iostat = ${4:ierr}) $0
|
||||
snippet close
|
||||
close(unit = ${1:fp}) $0
|
@ -30,7 +30,7 @@ snippet ch
|
||||
# case
|
||||
snippet cs
|
||||
case ${1:value}:
|
||||
${0}
|
||||
${0:${VISUAL}}
|
||||
# const
|
||||
snippet c
|
||||
const ${1:NAME} = ${0:0}
|
||||
@ -50,29 +50,9 @@ snippet df
|
||||
snippet dfr
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
${0}
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
}()
|
||||
# gpl
|
||||
snippet gpl
|
||||
/*
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright (C) ${1:Author}, `strftime("%Y")`
|
||||
*/
|
||||
|
||||
${0}
|
||||
# int
|
||||
snippet i
|
||||
int
|
||||
@ -92,12 +72,18 @@ snippet inf
|
||||
# if condition
|
||||
snippet if
|
||||
if ${1:/* condition */} {
|
||||
${2}
|
||||
${2:${VISUAL}}
|
||||
}
|
||||
snippet ife
|
||||
if ${1:/* condition */} {
|
||||
${2:${VISUAL}}
|
||||
} else {
|
||||
${0}
|
||||
}
|
||||
# else snippet
|
||||
snippet el
|
||||
else {
|
||||
${1}
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# error snippet
|
||||
snippet ir
|
||||
@ -120,26 +106,21 @@ snippet f3
|
||||
# float64
|
||||
snippet f6
|
||||
float64
|
||||
# if else
|
||||
snippet ie
|
||||
if ${1:/* condition */} {
|
||||
${2}
|
||||
} else {
|
||||
${3}
|
||||
# for int loop
|
||||
snippet for
|
||||
for ${1}{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
${0}
|
||||
# for loop
|
||||
snippet fo
|
||||
# for int loop
|
||||
snippet fori
|
||||
for ${2:i} := 0; $2 < ${1:count}; $2${3:++} {
|
||||
${4}
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
${0}
|
||||
# for range loop
|
||||
snippet fr
|
||||
for ${1:k}, ${2:v} := range ${3} {
|
||||
${4}
|
||||
snippet forr
|
||||
for ${1:e} := range ${2:collection} {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
${0}
|
||||
# function simple
|
||||
snippet fun
|
||||
func ${1:funcName}(${2}) ${3:error} {
|
||||
@ -148,8 +129,8 @@ snippet fun
|
||||
${0}
|
||||
# function on receiver
|
||||
snippet fum
|
||||
func (self ${1:type}) ${2:funcName}(${3}) ${4:error} {
|
||||
${5}
|
||||
func (${1:receiver} ${2:type}) ${3:funcName}(${4}) ${5:error} {
|
||||
${6}
|
||||
}
|
||||
${0}
|
||||
# log printf
|
||||
@ -173,12 +154,18 @@ snippet main
|
||||
# new
|
||||
snippet nw
|
||||
new(${0:type})
|
||||
# package
|
||||
snippet pa
|
||||
package ${1:main}
|
||||
# panic
|
||||
snippet pn
|
||||
panic("${0:msg}")
|
||||
# print
|
||||
snippet pr
|
||||
fmt.Printf("%${1:s}\n", ${2:var})
|
||||
# println
|
||||
snippet pl
|
||||
fmt.Println("${1:s}")
|
||||
# range
|
||||
snippet rn
|
||||
range ${0}
|
||||
@ -193,8 +180,6 @@ snippet sl
|
||||
select {
|
||||
case ${1:v1} := <-${2:chan1}
|
||||
${3}
|
||||
case ${4:v2} := <-${5:chan2}
|
||||
${6}
|
||||
default:
|
||||
${0}
|
||||
}
|
||||
@ -225,16 +210,15 @@ snippet t
|
||||
# goroutine named function
|
||||
snippet g
|
||||
go ${1:funcName}(${0})
|
||||
# goroutine anonymous function
|
||||
# goroutine anonymous function
|
||||
snippet ga
|
||||
go func(${1} ${2:type}) {
|
||||
${3:/* code */}
|
||||
}(${0})
|
||||
snippet test test function
|
||||
func Test${1:name}(t *testing.T) {
|
||||
${2}
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
${0}
|
||||
snippet bench benchmark function
|
||||
func Benchmark${1:name}(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
|
@ -27,11 +27,11 @@ snippet mts
|
||||
= mail_to ${1:email_address}, ${2:name}, :subject => ${3}, :body => ${4}
|
||||
snippet ife
|
||||
- if ${1:condition}
|
||||
${2}
|
||||
${2:${VISUAL}}
|
||||
- else
|
||||
${0}
|
||||
snippet ifp
|
||||
- if ${1:condition}.presence?
|
||||
${0}
|
||||
${0:${VISUAL}}
|
||||
snippet ntc
|
||||
= number_to_currency(${1})
|
||||
|
14
sources_non_forked/vim-snippets/snippets/handlebars.snippets
Normal file
14
sources_non_forked/vim-snippets/snippets/handlebars.snippets
Normal file
@ -0,0 +1,14 @@
|
||||
snippet if # {{#if value}} ... {{/if}}
|
||||
{{#if ${1:value}}}
|
||||
${0:${VISUAL}}
|
||||
{{/if}}
|
||||
snippet ifn # {{#unless value}} ... {{/unless}}
|
||||
{{#unless ${1:value}}}
|
||||
${0:${VISUAL}}
|
||||
{{/unless}}
|
||||
snippet ife # {{#if value}} ... {{else}} .. {{/if}}
|
||||
{{#if ${1:value}}}
|
||||
${2:${VISUAL}}
|
||||
{{else}}
|
||||
${3}
|
||||
{{/if}}
|
@ -2,9 +2,13 @@ snippet lang
|
||||
{-# LANGUAGE ${0:OverloadedStrings} #-}
|
||||
snippet haddock
|
||||
{-# OPTIONS_HADDOCK ${0:hide} #-}
|
||||
snippet ghc
|
||||
{-# OPTIONS_GHC ${0:-fno-warn-unused-imports} #-}
|
||||
snippet inline
|
||||
{-# INLINE ${0:name} #-}
|
||||
snippet info
|
||||
-- |
|
||||
-- Module : ${1:Module.Namespace}
|
||||
-- Module : ${1:`substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')`}
|
||||
-- Copyright : ${2:Author} ${3:2011-2012}
|
||||
-- License : ${4:BSD3}
|
||||
--
|
||||
@ -38,9 +42,12 @@ snippet class
|
||||
${0}
|
||||
snippet module
|
||||
module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` (
|
||||
) where
|
||||
`expand('%') =~ 'Main' ? "\n\nmain = do\n print \"hello world\"" : ""`
|
||||
) where
|
||||
`expand('%') =~ 'Main' ? "\nmain :: IO ()\nmain = undefined" : ""`
|
||||
|
||||
snippet main
|
||||
main :: IO ()
|
||||
main = ${0:undefined}
|
||||
snippet const
|
||||
${1:name} :: ${2:a}
|
||||
$1 = ${0:undefined}
|
||||
@ -50,25 +57,21 @@ snippet fn
|
||||
snippet fn2
|
||||
${1:fn} :: ${2:a} -> ${3:a} -> ${4:a}
|
||||
$1 ${5} = ${0:undefined}
|
||||
snippet fn3
|
||||
${1:fn} :: ${2:a} -> ${3:a} -> ${4:a} -> ${5:a}
|
||||
$1 ${6} = ${0:undefined}
|
||||
snippet => "Type constraint"
|
||||
(${1:Class} ${2:a}) => $2
|
||||
snippet ap
|
||||
${1:map} ${2:fn} ${0:list}
|
||||
snippet do
|
||||
do
|
||||
|
||||
snippet λ
|
||||
\\${1:x} -> ${0:expression}
|
||||
snippet \
|
||||
\\${1:x} -> ${0:expression}
|
||||
snippet (\
|
||||
(\\${1:x} -> ${0:expression})
|
||||
snippet <-
|
||||
${1:a} <- ${0:m a}
|
||||
snippet ←
|
||||
${1:a} <- ${0:m a}
|
||||
snippet ->
|
||||
${1:m a} -> ${0:a}
|
||||
snippet →
|
||||
${1:m a} -> ${0:a}
|
||||
snippet tup
|
||||
(${1:a}, ${0:b})
|
||||
snippet tup2
|
||||
@ -88,3 +91,25 @@ snippet let
|
||||
snippet where
|
||||
where
|
||||
${1:fn} = ${0:undefined}
|
||||
snippet spec
|
||||
module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` (main, spec) where
|
||||
|
||||
import Test.Hspec
|
||||
import Test.QuickCheck
|
||||
|
||||
main :: IO ()
|
||||
main = hspec spec
|
||||
|
||||
spec :: Spec
|
||||
spec =
|
||||
describe "${1}" $ do
|
||||
$0
|
||||
snippet desc
|
||||
describe "${1}" $ do
|
||||
$0
|
||||
snippet it
|
||||
it "${1}" $
|
||||
$0
|
||||
snippet itp
|
||||
it "${1}" $ property $
|
||||
$0
|
||||
|
@ -254,11 +254,11 @@ snippet colgroup+
|
||||
col+${0}
|
||||
</colgroup>
|
||||
snippet command
|
||||
<command type="command" label="${1}" icon="${0}" />
|
||||
<command type="command" label="${1}" icon="${0}">
|
||||
snippet command:c
|
||||
<command type="checkbox" label="${1}" icon="${0}" />
|
||||
<command type="checkbox" label="${1}" icon="${0}">
|
||||
snippet command:r
|
||||
<command type="radio" radiogroup="${1}" label="${2}" icon="${0}" />
|
||||
<command type="radio" radiogroup="${1}" label="${2}" icon="${0}">
|
||||
snippet datagrid
|
||||
<datagrid>
|
||||
${0}
|
||||
@ -550,8 +550,6 @@ snippet ins
|
||||
<ins>${0}</ins>
|
||||
snippet kbd
|
||||
<kbd>${0}</kbd>
|
||||
snippet keygen
|
||||
<keygen>${0}</keygen>
|
||||
snippet label
|
||||
<label for="${0:$1}">${1}</label>
|
||||
snippet label:i
|
||||
@ -592,6 +590,10 @@ snippet link:rss
|
||||
<link rel="alternate" href="${1:rss.xml}" title="RSS" type="application/atom+xml" />
|
||||
snippet link:touch
|
||||
<link rel="apple-touch-icon" href="${1:favicon.png}" />
|
||||
snippet main
|
||||
<main role="main">
|
||||
${0}
|
||||
</main>
|
||||
snippet map
|
||||
<map name="${1}">
|
||||
${0}
|
||||
@ -702,6 +704,10 @@ snippet output
|
||||
<output>${0}</output>
|
||||
snippet p
|
||||
<p>${0}</p>
|
||||
snippet p.
|
||||
<p class="${1}">${0}</p>
|
||||
snippet p#
|
||||
<p id="${1}">${0}</p>
|
||||
snippet param
|
||||
<param name="${1}" value="${2}" />
|
||||
snippet pre
|
||||
@ -727,7 +733,7 @@ snippet samp
|
||||
${0}
|
||||
</samp>
|
||||
snippet script
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
<script charset="utf-8">
|
||||
${0}
|
||||
</script>
|
||||
snippet scripts
|
||||
@ -737,7 +743,7 @@ snippet scriptt
|
||||
${0}
|
||||
</script>
|
||||
snippet scriptsrc
|
||||
<script src="${0}.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="${0}.js" charset="utf-8"></script>
|
||||
snippet section
|
||||
<section>
|
||||
${0}
|
||||
@ -845,7 +851,7 @@ snippet tr+
|
||||
td+${0}
|
||||
</tr>
|
||||
snippet track
|
||||
<track src="${1}" srclang="${2}" label="${3}" default="${4:default}>${5}</track>
|
||||
<track src="${1}" srclang="${2}" label="${3}" default="${4:default} />${5}
|
||||
snippet ul
|
||||
<ul>
|
||||
${0}
|
||||
@ -869,3 +875,5 @@ snippet video
|
||||
<video src="${1} height="${2}" width="${3}" preload="${5:none}" autoplay="${6:autoplay}>${7}</video>
|
||||
snippet wbr
|
||||
<wbr />
|
||||
snippet viewport
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
@ -1,5 +1,7 @@
|
||||
# Generic tags
|
||||
|
||||
extends html
|
||||
|
||||
snippet %
|
||||
{% ${1} %}
|
||||
snippet %%
|
||||
@ -138,4 +140,3 @@ snippet urlizetrunc
|
||||
urlizetrunc:${0}
|
||||
snippet wordwrap
|
||||
wordwrap:${0}
|
||||
|
||||
|
@ -43,7 +43,7 @@ snippet set
|
||||
{% set ${1:x} = ${0:y} %}
|
||||
snippet try
|
||||
{% try %}
|
||||
${1}
|
||||
${1:${VISUAL}}
|
||||
{% except %}
|
||||
${2}
|
||||
{% finallly %}
|
||||
|
@ -163,12 +163,12 @@ snippet ths
|
||||
throws ${0}
|
||||
snippet try
|
||||
try {
|
||||
${0}
|
||||
${0:${VISUAL}}
|
||||
} catch(${1:Exception} ${2:e}) {
|
||||
}
|
||||
snippet tryf
|
||||
try {
|
||||
${0}
|
||||
${0:${VISUAL}}
|
||||
} catch(${1:Exception} ${2:e}) {
|
||||
} finally {
|
||||
}
|
||||
@ -214,18 +214,28 @@ snippet wh
|
||||
while (${1}) ${0}
|
||||
##
|
||||
## Main method
|
||||
snippet psvm
|
||||
public static void main (String[] args) {
|
||||
${0}
|
||||
}
|
||||
snippet main
|
||||
public static void main (String[] args) {
|
||||
${0}
|
||||
}
|
||||
##
|
||||
## Print Methods
|
||||
snippet sout
|
||||
System.out.println(${0});
|
||||
snippet serr
|
||||
System.err.println(${0});
|
||||
snippet print
|
||||
System.out.print("${0:Message}");
|
||||
snippet printf
|
||||
System.out.printf("${1:Message}", ${0:args});
|
||||
snippet println
|
||||
System.out.println(${0});
|
||||
snippet printlna
|
||||
System.out.println(Arrays.toString(${0}));
|
||||
##
|
||||
## Render Methods
|
||||
snippet ren
|
||||
|
@ -0,0 +1,52 @@
|
||||
# Snippet for bemjson. https://en.bem.info/platform/bemjson/
|
||||
|
||||
# Blocks
|
||||
snippet b
|
||||
{
|
||||
block : '${1:name}',
|
||||
content : [
|
||||
'${2:content}'
|
||||
]
|
||||
}
|
||||
|
||||
# btc - BEM block with text content
|
||||
snippet btc
|
||||
{
|
||||
block : '${1:name}',
|
||||
content: '${2:content}'
|
||||
}
|
||||
|
||||
# bwm - BEM block with modifier.
|
||||
snippet bwm
|
||||
{
|
||||
block : '${1:name}',
|
||||
mods: { ${2:modName}: '${3:modVal}' },
|
||||
content : [
|
||||
'${4:content}'
|
||||
]
|
||||
}
|
||||
|
||||
# Elems
|
||||
|
||||
# e - BEM elem
|
||||
snippet e
|
||||
{
|
||||
elem : '${1:name}',
|
||||
content : [
|
||||
'${2:content}'
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
# mo - Mods
|
||||
snippet mo
|
||||
mods : { ${1:modName} : '${2:modVal}' },
|
||||
|
||||
# mi - BEM mix mod
|
||||
snippet mi
|
||||
mix : [ { ${1:block} : '${2:block}' } ],
|
||||
|
||||
# a - BEM attrs mod
|
||||
snippet a
|
||||
attrs : { ${1:attr} : '${2:val}' },
|
||||
|
@ -16,8 +16,8 @@ snippet marginconvention
|
||||
var ${8:height} = ${9:500} - $1.top - $1.bottom;
|
||||
|
||||
var ${10:svg} = d3.select("${11}").append("svg")
|
||||
.attr("width", $6)
|
||||
.attr("height", $8)
|
||||
.attr("width", $6 + $1.left + $1.right)
|
||||
.attr("height", $8 + $1.top + $1.bottom)
|
||||
.append("g")
|
||||
.attr("transform", "translate(" + $1.left + "," + $1.top + ")")
|
||||
snippet nest
|
@ -0,0 +1,34 @@
|
||||
snippet des "describe('thing', () => { ... })" b
|
||||
describe('${1:}', () => {
|
||||
${0:${VISUAL}}
|
||||
});
|
||||
snippet it "it('should do', () => { ... })" b
|
||||
it('${1:}', () => {
|
||||
${0:${VISUAL}}
|
||||
});
|
||||
snippet xit "xit('should do', () => { ... })" b
|
||||
xit('${1:}', () => {
|
||||
${0:${VISUAL}}
|
||||
});
|
||||
snippet bef "before(() => { ... })" b
|
||||
before(() => {
|
||||
${0:${VISUAL}}
|
||||
});
|
||||
snippet befe "beforeEach(() => { ... })" b
|
||||
beforeEach(() => {
|
||||
${0:${VISUAL}}
|
||||
});
|
||||
snippet aft "after(() => { ... })" b
|
||||
after(() => {
|
||||
${0:${VISUAL}}
|
||||
});
|
||||
snippet afte "afterEach(() => { ... })" b
|
||||
afterEach(() => {
|
||||
${0:${VISUAL}}
|
||||
});
|
||||
snippet exp "expect(...)" b
|
||||
expect(${1:})${0};
|
||||
snippet expe "expect(...).to.equal(...)" b
|
||||
expect(${1:}).to.equal(${0});
|
||||
snippet expd "expect(...).to.deep.equal(...)" b
|
||||
expect(${1:}).to.deep.equal(${0});
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user