fuck yeah ultisnips

main
Steffen Becker 12 years ago
parent 06732c16cb
commit 634c521646

@ -0,0 +1,187 @@
# This file contains snippets that are always defined. I personally
# have snippets for signatures and often needed texts
##############
# 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 = i.next().split(':', 1)
if len(flags) == 0:
if len(text) == 1:
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 = i.next().split(':', 1)
assert(flags[0] == 'm')
ctriple.append(text)
flags,text = i.next().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. """
ft = vim.eval("&filetype")
# check if the comment dict has the format for the current file
if _commentDict.has_key(ft):
return _commentDict[ft]
# otherwise parse vim's comments and add it for later use
commentformat = _parse_comments(vim.eval("&comments"))[0]
_commentDict[ft] = commentformat
return commentformat
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 + 2 * m
nspaces = (bwidth_inner - twidth) // 2
mlines = i + m + " " + " " * nspaces
mlinee = " " + " "*(bwidth_inner - twidth - nspaces) + m
eline = i + 2 * m + bwidth_inner * m + m + e
return sline, mlines, mlinee, eline
endglobal
##############################################################################
##############################################################################
##############################################################################
# the box snippet
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
box = make_box(len(t[1]))
snip.rv = box[2] + '\n' + box[3]`
$0
endsnippet
# general comments
snippet / "Comment"
/* ${1} */
endsnippet
snippet // "large comment block"
/* ${1:your comment}
====================================================================== */
$0
endsnippet
snippet /// "even larger comment block"
/* ${1:your comment}
----------------------------------------------------------------------
---------------------------------------------------------------------- */
$0
endsnippet
# lorem ipsum
snippet lrm1 "Lorem Ipsum - 50 Words" b
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.
endsnippet
snippet lrm2 "Lorem Ipsum - deutsch, 3 Absätze" b
Dies ist ein Typoblindtext. An ihm kann man sehen, ob alle Buchstaben da sind
und wie sie aussehen. Manchmal benutzt man Worte wie Hamburgefonts, Rafgenduks
oder Handgloves, um Schriften zu testen.
Manchmal Sätze, die alle Buchstaben des Alphabets enthalten - man nennt
diese Sätze »Pangrams«. Sehr bekannt ist dieser: The quick brown fox jumps
over the lazy old dog. Oft werden in Typoblindtexte auch fremdsprachige
Satzteile eingebaut (AVAIL® and Wefox™ are testing aussi la Kerning),
um die Wirkung in anderen Sprachen zu testen. In Lateinisch sieht zum
Beispiel fast jede Schrift gut aus.
Quod erat demonstrandum. Seit 1975 fehlen in den meisten Testtexten die Zahlen,
weswegen nach TypoGb. 204 § ab dem Jahr 2034 Zahlen in 86 der Texte zur
Pflicht werden. Nichteinhaltung wird mit bis zu 245 € oder 368 $ bestraft.
Genauso wichtig in sind mittlerweile auch Âçcèñtë, die in neueren Schriften
aber fast immer enthalten sind. Ein wichtiges aber schwierig zu integrierendes
Feld sind OpenType-Funktionalitäten.
endsnippet
snippet mfg "Mit freundlichen Grüßen" b
Mit freundlichen Grüßen,
Steffen Becker
endsnippet
snippet lg "Liebe Grüße" b
Liebe Grüße, Steffen.
endsnippet
snippet sig "Signature"
--
Mit freundlichen Grüßen,
Steffen Becker
Webentwicklung
+49 177 55 33 074
kontakt@webgefrickel.de
http://webgefrickel.de
endsnippet
snippet sigk "Signature Kreuzer"
--
Mit freundlichen Grüßen,
Steffen Becker
Kreuzer Leipzig
webmaster@kreuzer-leipzig.de
endsnippet
# vim:ft=snippets:

@ -0,0 +1,502 @@
#############################
# scss / compass snippets #
#############################
snippet imp "import a file" !b
@import "$1";$0
endsnippet
snippet ext "extend a placeholder-class" !b
@extend %$1;$0
endsnippet
snippet inc "include a mixin" !b
@include ${1:mixinname}(${2:parameters});$0
endsnippet
snippet mix "create a mixin" !b
@mixin ${1:mixinname}(${2:parameters}) {
$0
}
endsnippet
#########################################
# css3 stuff and using compass mixins #
#########################################
snippet rad "border radius"
border-radius: ${1:\$radius-width};$0
endsnippet
snippet bsh "box shadow"
box-shadow: ${1:0} ${2:0} ${3:\$shadow-width} ${4:0} ${4:rgba($color-default, 0.5)};$0
endsnippet
snippet tsh "text shadow"
text-shadow: ${1:1}px ${2:1}px ${3:3}px ${4:\$color-main};$0
endsnippet
snippet imu "compass image url"
image-url('${1:img}.png')$0
endsnippet
snippet imw "compass image width"
image-width('${1:img}.png')$0
endsnippet
snippet imh "compass image height"
image-height('${1:img}.png')${2}
endsnippet
snippet face "compass font-face"
@include font-face('${1:fontname}', font-files('${2:fontfile}.woff', '$2.ttf'), '$2.eot', normal, normal);$0
endsnippet
snippet tra "compass transitions"
@include transition(all ${1:0.3}s ease-in-out);$0
endsnippet
snippet frm "compass transforms"
@include transform(${1:scale}(${2:1.1})); $0
endsnippet
snippet grd "compass gradients"
@include background-image(linear-gradient(${1:\$color-one}, ${2:\$color-two}));$0
endsnippet
##############################
# custom css/scss snippets #
##############################
# backgrounds
snippet bga "background-attachment"
background-attachment: ${1:scroll/fixed};$0
endsnippet
snippet bgc "background-color"
background-color: ${1:\$color-background-default};$0
endsnippet
snippet bgt "background-color: transparent"
background-color: transparent;$0
endsnippet
snippet bgi "background-image"
background-image: url(../img/$1);$0
endsnippet
snippet bgp "background-position"
background-position: ${1:0}px ${2:0}px;$0
endsnippet
snippet bgr "background-repeat"
background-repeat: ${1:repeat/repeat-x/repeat-y/no-repeat};$0
endsnippet
snippet bgf "background: complete"
background:${6: ${1:\$color-main}} url(../img/$2) ${3:no-repeat} ${4:scroll/fixed} ${5:top left};$0
endsnippet
# borders
snippet bd "border"
border: ${1:1}px solid ${2:\$color-main};$0
snippet bdt "border-top"
border-top: ${1:1}px ${2:solid} ${3:\$color-main};$0
endsnippet
snippet bdb "border-right"
border-right: ${1:1}px ${2:solid} ${3:\$color-main};$0
endsnippet
snippet bdb "border-bottom"
border-bottom: ${1:1}px ${2:solid} ${3:\$color-main};$0
endsnippet
snippet bdl "border-left"
border-left: ${1:1}px ${2:solid} ${3:\$color-main};$0
endsnippet
snippet bdc "border-color"
border-color: ${1:\$color-main};$0
endsnippet
snippet ol "outline"
outline: ${1:0};$0
endsnippet
# position and box model
snippet ps "position"
position: ${1:static/relative/absolute/fixed};$0
endsnippet
snippet ps:a "position absolute"
position: absolute;$0
endsnippet
snippet ps:r "position relative"
position: relative;$0
endsnippet
snippet ps:s "position static"
position: static;$0
endsnippet
snippet ps:f "position fixed"
position: fixed;$0
endsnippet
snippet t "top"
top: $1;$0
endsnippet
snippet r "right"
right: $1;$0
endsnippet
snippet b "bottom"
bottom: $1;$0
endsnippet
snippet l "left"
left: $1;$0
endsnippet
snippet w "width"
width: $1;$0
endsnippet
snippet h "height"
height: $1;$0
endsnippet
snippet d:b "display: block"
display: block;$0
endsnippet
snippet d:n "display: none"
display: none;$0
endsnippet
snippet d:i "display: inline"
display: inline;$0
endsnippet
snippet d:ib "display: inline-block"
display: inline-block;$0
endsnippet
snippet d:t "display: table-types"
display: ${1:table/inline-table/table-row-group/table-header-group/table-footer-group/table-row/table-column-group/table-column/table-cell/table-caption};$0
endsnippet
# colors
snippet c "color"
color: ${1:$color-main};$0
endsnippet
snippet rgba "rgba front color"
rgba(${1:\$color-main}, 0.${2:5})$0
endsnippet
# floats and stuff
snippet cf "extend the clearfix"
@extend %clearfix;$0
endsnippet
snippet cl "clear: value (clear)"
clear: ${1:left/right/both/none};$0
endsnippet
snippet cl:b "clear: both"
clear: both;$0
endsnippet
snippet fl "float"
float: ${1:left/right/none};$0
endsnippet
snippet fl:l "float: left"
float: left;$0
endsnippet
snippet fl:r "float: right"
float: right;$0
endsnippet
snippet fl:n "float: none"
float: none;$0
endsnippet
snippet ov "overflow"
overflow: ${1:visible/hidden/scroll/auto};$0
endsnippet
snippet ov:h "overflow: hidden"
overflow: hidden;$0
endsnippet
snippet ov:a "overflow: auto"
overflow: auto;$0
endsnippet
# cursors
snippet cr "cursor"
cursor: ${1:default/auto/crosshair/pointer/move/*-resize/text/wait/help};$0
endsnippet
snippet cr:p "cursor"
cursor: pointer;$0
endsnippet
snippet cr:d "cursor"
cursor: default;$0
endsnippet
# fonts and text
snippet ff "font-family"
font-family: ${1:Arial}, ${2:sans-}serif;$0
endsnippet
snippet fz "font-size"
font-size: ${1:100%};$0
endsnippet
snippet fs "font-style"
font-style: ${1:normal/italic/oblique};$0
endsnippet
snippet fs:i "font-style: italic"
font-style: italic;$0
endsnippet
snippet fs:n "font-style: normal"
font-style: normal;$0
endsnippet
snippet fv "font-variant"
font-variant: ${1:normal/small-caps};$0
endsnippet
snippet fw "font-weight"
font-weight: ${1:normal/bold};$0
endsnippet
snippet fw:b "font-weight: bold"
font-weight: bold;$0
endsnippet
snippet fw:n "font-weight: normal"
font-weight: normal;$0
endsnippet
snippet font "font: complete"
font: ${1:normal/italic} ${3:normal/bold} ${4:#\{\$font-size\}}/${5:#\{\$font-line-height\}} ${6:Arial}, ${7:sans-}serif;$0
endsnippet
snippet lsp "letter-spacing"
letter-spacing: $1px;$0
endsnippet
snippet lh "line-height"
line-height: ${1:\$font-line-height};$0
endsnippet
snippet ta "text-align"
text-align: ${1:left/right/center/justify};$0
endsnippet
snippet ta:c "text-align center"
text-align: center;$0
endsnippet
snippet ta:l "text-align left"
text-align: left;$0
endsnippet
snippet ta:r "text-align right"
text-align: right;$0
endsnippet
snippet ta:j "text-align justifyy"
text-align: justify;$0
endsnippet
snippet td "text-decoration"
text-decoration: ${1:none/underline/overline/line-through/blink};$0
endsnippet
snippet td:u "text-decoration: underline"
text-decoration: underline;$0
endsnippet
snippet td:n "text-decoration: none"
text-decoration: none;$0
endsnippet
snippet ti "text-indent: length"
text-indent: ${1:10px};$0
endsnippet
snippet tt "text-transform"
text-transform: ${1:capitalize/uppercase/lowercase};$0
endsnippet
snippet tt:u "text-transform: uppercase"
text-transform: uppercase;$0
endsnippet
snippet tt:l "text-transform: lowercase"
text-transform: lowercase;$0
endsnippet
snippet tt:n "text-transform: none"
text-transform: none;$0
endsnippet
# lists
snippet li "list-style"
list-style: ${1:none/disc/circle/square/decimal/zero};$0
endsnippet
snippet li:n "list-style: none"
list-style: none;$0
endsnippet
snippet li:d "list-style: disc"
list-style: disc;$0
endsnippet
# margins and paddings
snippet m "margin"
margin: ${1:\$margin-default};$0
endsnippet
snippet mt "margin-top"
margin-top: ${1:\$margin-default};$0
endsnippet
snippet mr "margin-right"
margin-right: ${1:\$margin-default};$0
endsnippet
snippet mb "margin-bottom"
margin-bottom: ${1:\$margin-default};$0
endsnippet
snippet ml "margin-left"
margin-left: ${1:\$margin-default};$0
endsnippet
snippet mm "margin: T R B L"
margin: ${1:20px} ${2:0px} ${3:40px} ${4:0px};$0
endsnippet
snippet p "padding"
padding: ${1:\$margin-default};$0
endsnippet
snippet pt "padding-top: length"
padding-top: ${1:\$margin-default};$0
endsnippet
snippet pr "padding-right: length"
padding-right: ${1:\$margin-default};$0
endsnippet
snippet pb "padding-bottom: length"
padding-bottom: ${1:\$margin-default};$0
endsnippet
snippet pl "padding-left: length"
padding-left: ${1:\$margin-default};$0
endsnippet
snippet pp "padding: T R B L"
padding: ${1:20px} ${2:0px} ${3:40px} ${4:0px};$0
endsnippet
# others
snippet mah "max-height"
max-height: ${1:100%};$0
endsnippet
snippet maw "max-width"
max-width: ${1:100%};$0
endsnippet
snippet mih "min-height"
min-height: ${1:100%};$0
endsnippet
snippet mah "min-width"
min-width: ${1:100%};$0
endsnippet
snippet ! "!important CSS (!)"
${1:!important}
endsnippet
snippet sel "selection"
$1::-moz-selection,
$1::selection {
color: ${2:inherit};
background: ${3:inherit};
}
endsnippet
snippet va "vertical-align: type"
vertical-align: ${1:baseline/sub/super/top/text-top/middle/bottom/text-bottom/length/%};$0
endsnippet
snippet va:t "vertical-align: top"
vertical-align: top;$0
endsnippet
snippet va:m "vertical-align: middle"
vertical-align: middle;$0
endsnippet
snippet va:b "vertical-align: bottom"
vertical-align: bottom;$0
endsnippet
snippet vis "visibility: type (visibility)"
visibility: ${1:visible/hidden/collapse};$0
endsnippet
snippet wsp "white-space: normal:pre:nowrap (white)"
white-space: ${1:normal/pre/nowrap};$0
endsnippet
snippet z "z-index: index (z)"
z-index: ${1:10};$0
endsnippet
# vim:ft=snippets:

@ -0,0 +1,359 @@
###########################################################################
# TextMate Snippets #
###########################################################################
# HEAD stuff
snippet doc "HTML - 5.0 (doctype)" b
<!DOCTYPE html>
endsnippet
snippet ! "IE Conditional Comment: NOT Internet Explorer"
<!--[if !IE]><!-->${1: CC - NOT IE }<!-- <![endif]-->$0
endsnippet
snippet !! "All useful conditionals"
<!--[if lt IE 8]> <html class="no-js lt-ie8" lang="de"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8" lang="de"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="de"> <!--<![endif]-->$0
endsnippet
snippet // "Description"
<!-- ${0:your comment here} -->
endsnippet
snippet base "HTML <base>"
<base href="$1"${2: target="$3"}`!p x(snip)`>
endsnippet
snippet body "HTML <body>"
<body class="${1:bodyclass}">
$0
</body>
endsnippet
snippet tit "HTML <title>"
<title>${1:PageTitle}</title>
endsnippet
snippet head "HTML <head>"
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"`!p x(snip)`>
<title>${1:`!p snip.rv = snip.basename or "Page Title"`}</title>
$0
</head>
endsnippet
snippet link "HTML <link>"
<link rel="${1:stylesheet}" href="${2:/css/main.css}" />
endsnippet
snippet meta "HTML <meta>"
<meta name="${1:name}" content="${2:content}" />
endsnippet
snippet srcs "HTML <script src...>"
<script src="$1"></script>
endsnippet
snippet scr "HTML <script>"
<script>
$0
</script>
endsnippet
snippet sty "HTML <style>"
<style>
$0
</style>
endsnippet
# inputs and form stuff
snippet linp "Input with Label"
<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}"} />
endsnippet
snippet inp "Input"
<input type="${1:text/submit/hidden/button}" name="${2:some_name}" value="$3"${4: id="${5:$2}"} />
endsnippet
snippet opt "Option"
<option${1: value="${2:option}"}>${3:$2}</option>
endsnippet
snippet sel "Select Box"
<select name="${1:some_name}" id="${2:$1}">
<option${9: value="${10:option1}"}>${11:$10}</option>
<option${12: value="${13:option2}"}>${14:$13}</option>${15:}
$0
</select>
endsnippet
snippet area "HTML <textarea>"
<textarea name="${1:Name}" rows="${2:8}" cols="${3:40}">$0</textarea>
endsnippet
snippet btn "HTML button"
<button id="${1:someid}" class="${2:btn}">${3:Senden}</button>$0
snippet fset "Fieldset"
<fieldset class="${1:class}"}>
<legend>$2</legend>
$0
</fieldset>
endsnippet
snippet form "HTML <form>"
<form action="$1" method="${2:get}" accept-charset="utf-8">
$0
<p><input type="submit" value="Senden" /></p>
</form>
endsnippet
# headings
snippet h1 "HTML <h1>"
<h1></h1>
endsnippet
snippet h1 "HTML <h1>"
<h2></h2>
endsnippet
snippet h1 "HTML <h1>"
<h3></h3>
endsnippet
snippet h1 "HTML <h1>"
<h4></h4>
endsnippet
snippet h1 "HTML <h1>"
<h5></h5>
endsnippet
snippet h1 "HTML <h1>"
<h6></h6>
endsnippet
# General stuff and html5 stuff
snippet t "general HTML tag"
<${1:div}${2: class="class"}>
$0
</$1>
endsnippet
snippet div "HTML <div>"
<div class="${1:class}">
$0
</div>
endsnippet
snippet hd "HTML <header>"
<header class="${1:header}">
$0
</header>
endsnippet
snippet sec "HTML <section>"
<section class="${1:content}">
$0
</section>
endsnippet
snippet art "HTML <article>"
<article class="${1:article}">
$0
</article>
endsnippet
snippet foot "HTML <footer>"
<footer class="${1:footer}">
$0
</footer>
endsnippet
snippet main "HTML <main>"
<main class="${1:main}">
$0
</main>
endsnippet
snippet asi "HTML <aside>"
<aside class="${1:sidebar}">
$0
</aside>
endsnippet
snippet nav "HTML <nav>"
<nav class="${1:nav}">
$0
</nav>
endsnippet
# links
snippet mail "HTML <a mailto: >"
<a href="mailto:${1:joe@example.com}?subject=${2:feedback}">${3:email me}</a>
endsnippet
snippet a "Link"
<a href="${1:http://www.${2:url.com}}" class="${3:class}">${4:Anchor Text}</a>
endsnippet
# default text
snippet p "paragraph"
<p>$0</p>
endsnippet
snippet em "em"
<em>$0</em>
endsnippet
snippet str "strong"
<strong>$0</strong>
endsnippet
snippet pre "pre"
<pre>$0</pre>
endsnippet
snippet span "paragraph"
<span class="${class}">$0</span>
endsnippet
snippet br "break"
<br />
$0
endsnippet
snippet li "list item"
<li>$0</li>
endsnippet
snippet ul "unordered list"
<ul>
$0
</ul>
endsnippet
snippet ol "ordered list"
<ol>
$0
</ol>
endsnippet
snippet fig "HTML5 figure"
<figure class="figure">
<img src="${1:image.jpg}" alt="$2" class="figure__image" />
<figcaption class="figure__caption"></figcaption>
</figure>$0
endsnippet
snippet bq "blockquote"
<blockquote>${1:text or more tags}</blockquote>$0
endsnippet
# tables stuff
snippet tab "HTML <table>"
<table class="${1:class}">
<thead>
<tr><th>${5:Header}</th></tr>
</thead>
<tbody>
<tr><td>${0:Data}</td></tr>
</tbody>
</table>
endsnippet
snippet td "table cell"
<td>$0</td>
endsnippet
snippet tr "table row"
<tr>$0</tr>
endsnippet
# init base
snippet init "HTML5 Template" b
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8" />
<title>${1}</title>
<link href="/css/${2:main.css}" rel="stylesheet" />
</head>
<body>
<header>
${3}
</header>
<main role="main">
${4}
</main>
<footer>
${5}
</footer>
<script src="/js/${6:script.js}"></script>
</body>
</html>
endsnippet
# vim:ft=snippets:
# special html5 stuff
snippet vid
<video width="1280" height="720" poster="${1:posterimage}.jpg" controls="controls">
<source type="video/mp4" src="${2:filename}.mp4" />
<source type="video/webm" src="$2.webm" />
<source type="video/ogg" src="$2.ogv" />
<object type="application/x-shockwave-flash" data="${3:/path/to/}mediaelement/flashmediaelement.swf">
<param name="movie" value="$3mediaelement/flashmediaelement.swf" />
<param name="flashvars" value="controls=true&file=$2.mp4" />
<!-- Image as a last resort -->
<img src="$1.jpg" title="No video playback capabilities" />
</object>
</video>
$0
endsnippet
snippet aud
endsnippet
snippet scrb "Default bottom modernizr load script block" b
<script src="//ajax.googleapis.com/ajax/libs/jquery/${1:1.9.1}/jquery.min.js"></script>
<script>
Modernizr.load({
test : window.jQuery,
yep : ['/assets/js/script.min.js'],
nope : ['/assets/js/jquery.min.js',
'/assets/js/script.min.js']
});
</script>
endsnippet

@ -0,0 +1,168 @@
snippet :, "Object Value JS"
${1:value_name}: ${0:value},
endsnippet
snippet v "general var assignment"
var ${1:sth} = ${2:value};
endsnippet
snippet for "for (...) {...}"
for (var ${2:i} = 0; $2 <= ${1:var}.lenth; $2 += 1) {
${3:$1[$2]}${VISUAL}$0
};
endsnippet
snippet fun "function (fun)"
var ${1:functionname} = function(${2:argument}) {
${VISUAL}$0
}
endsnippet
snippet iif "Immediately-Invoked Function Expression (iife)"
(function (${1:argument}) {
${VISUAL}$0
}(${2:$1}));
endsnippet
snippet ife "if ___ else"
if (${1:condition}) {
${2://code}
} else {
${3://code}
}
endsnippet
snippet if "if"
if (${1:condition}) {
${VISUAL}$0
}
endsnippet
snippet ifl "if item has length"
if (\$${1:('.selector')}.length > 0) {
$0
}
endsnippet
snippet sw "Switch statement"
switch(${1:expression}) {
case '${3:case}':
${4:// code}
break;
${5}
default:
${2:// code}
break;
}
endsnippet
snippet case
case '${1:case}':
${2:// code}
break;
$0
endsnippet
# debugging and stuff
snippet cl "console.log"
console.log(${1:"${2:value}"});
endsnippet
snippet cw "console.warn"
console.warn(${1:"${2:value}"});
endsnippet
snippet ce "console.error"
console.error(${1:"${2:value}"});
endsnippet
snippet ca "console.assert"
console.assert(${1:assertion}, ${2:"${3:message}"});
endsnippet
# jquery snippets, yeah
snippet $ "general jquery var assignment"
var \$${1:varname} = \$('${2:.selector}');
endsnippet
snippet f "find"
\$${1:('.selector')}.find('.${2:selector}');
endsnippet
snippet p "parent"
\$${1:('.selector')}.parent(${2:'.selector'});
endsnippet
snippet ch "children"
\$${1:('.selector')}.children(${2:'.selector'});
endsnippet
snippet on "on / event handler"
\$${1:('.selector')}.on('${3:click}', function(e) {
e.preventDefault();
$0
});
endsnippet
snippet each "each for elements"
\$${1:('.selector')}.each(function(i) {
var \$item = \$(this);
$0
});
endsnippet
snippet app "append stuff"
\$${1:('.selector')}.append(\$${2:item});
endsnippet
snippet html "change html"
\$${1:('.selector')}.html(\$${2:htmlstring});
endsnippet
snippet css "css"
\$${1:('.selector')}.css({
${2:display}: "${3:none}",
${4:position}: "${5:absolute}"
});
endsnippet
snippet acl "addClass"
\$${1:('.selector')}.addClass('${2:class}');
endsnippet
snippet rcl "removeClass"
\$${1:('.selector')}.removeClass('${2:class}');
endsnippet
snippet tcl "toggleClass"
\$${1:('.selector')}.toggleClass('${2:class}');
endsnippet
snippet ajax "ajax request"
$.ajax({
type: "${1:GET}",
url: ${2:window.location.href},
data: ${3:\$form.serialize()},
success: function(response) {
$0
}
});
endsnippet
snippet drd "document ready snippet"
jQuery(document).ready(function(\$) {
$0
}); // end documentready
endsnippet

@ -0,0 +1,19 @@
snippet s "String" b
"${1:key}": "${0:value}",
endsnippet
snippet n "number" b
"${1:key}": ${0:value},
endsnippet
snippet a "Array" b
[
${VISUAL}$0
],
endsnippet
snippet o "Object" b
{
${VISUAL}$0
},
endsnippet

@ -0,0 +1,44 @@
###########################################################################
# SNIPPETS for MARKDOWN #
###########################################################################
###########################
# Sections and Paragraphs #
###########################
snippet s "Section" b
# ${1:Section Name} #
$0
endsnippet
snippet ss "Sub Section" b
## ${1:Section Name} ##
$0
endsnippet
snippet sss "SubSub Section" b
### ${1:Section Name} ###
$0
endsnippet
snippet par "Paragraph" b
#### ${1:Paragraph Name} ####
$0
endsnippet
snippet spar "Paragraph" b
##### ${1:Paragraph Name} #####
$0
endsnippet
################
# Common stuff #
################
snippet link "Link to something"
[${1:${VISUAL:Text}}](${3:http://${2:www.url.com}})$0
endsnippet
snippet img "Image"
![${1:pic alt}](${2:path}${3/.+/ "/}${3:opt title}${3/.+/"/})$0
endsnippet
# vim:ft=snippets:

@ -0,0 +1,183 @@
snippet arr "array"
$${1:arrayName} = array('${2}' => ${3});${4}
endsnippet
snippet dcf "doc function"
/**
* $2
* @return ${4:void}
* @author ${5:`!v g:snips_author`}
**/
${1:public }function ${2:someFunc}(${3})
{${6}
}
endsnippet
snippet else "else"
else {
${1:// code...}
}
endsnippet
snippet for "for"
for ($${2:i} = 0; $$2 < ${1:count}; $$2${3: += 1}) {
${4:// code...}
}
endsnippet
snippet fek "foreach with key"
foreach ($${1:variable} as $${2:key} => $${3:value}){
${4:// code...}
}
endsnippet
snippet fe "foreach without key"
foreach ($${1:variable} as $${2:value}){
${4:// code...}
}
endsnippet
snippet get "get"
$_GET['${1}']${2}
endsnippet
snippet if "if"
if (${1:/* condition */}) {
${2:// code...}
}
endsnippet
snippet inc "inc"
include '${1:file}';${2}
endsnippet
snippet bug "bug statement with pre"
echo '<pre>' . print_r($${1:var}, 1) . '</pre>';$0
endsnippet
snippet post "post"
$_POST['${1}']${2}
endsnippet
snippet req1 "req1"
require_once '${1:file}';${2}
endsnippet
snippet sss "session"
$_SESSION['${1}']${2}
endsnippet
snippet t "t"
$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};${5}
endsnippet
snippet pub "Public function" !b
public function ${1:name}(${2:$param}) {
${VISUAL}${3:return null;}
}
$0
endsnippet
snippet pro "Protected function" !b
protected function ${1:name}(${2:$param}) {
${VISUAL}${3:return null;}
}
$0
endsnippet
snippet pri "Private function" !b
private function ${1:name}(${2:$param}) {
${VISUAL}${3:return null;}
}
$0
endsnippet
snippet pubs "Public static function" !b
public static function ${1:name}(${2:$param}) {
${VISUAL}${3:return null;}
}
$0
endsnippet
snippet pros "Protected static function" !b
protected static function ${1:name}(${2:$param}) {
${VISUAL}${3:return null;}
}
$0
endsnippet
snippet pris "Private static function" !b
private static function ${1:name}(${2:$param}) {
${VISUAL}${3:return null;}
}
$0
endsnippet
snippet fun "Function snip" !b
function ${1:name}(${2:$param}) {
${VISUAL}${3:return null;}
}
$0
endsnippet
snippet ife "if else"
if (${1:/* condition */}) {
${2:// code...}
} else {
${3:// code...}
}
$0
endsnippet
snippet cls "Class declaration template" !b
/**
* Class ${1:`!p snip.rv=snip.fn.capitalize().split('.')[0]`}
*/
class $1 {
public function ${3:__construct}(${4:$options}) {
${4:// code}
}
}
$0
endsnippet
snippet ph "begin php block" b
<?php
$0
endsnippet
snippet phi "begin php inline block"
<?php $0 ?>
endsnippet
snippet sw "switch statement"
switch ($${1:variable}) {
case '${2:value}':
${3:// code...}
break;
${5}
default:
${4:// code...}
break;
}
endsnippet
snippet case
case '${1:value}':
${2:// code...}
break;${3}
endsnippet
# :vim:ft=snippets:

@ -0,0 +1,61 @@
###########################################################################
# General Stuff #
###########################################################################
snippet part "Part" b
`!p snip.rv = len(t[1])*'#'`
${1:Part name}
`!p snip.rv = len(t[1])*'#'`
$0
endsnippet
snippet s "Section" b
${1:Section name}
`!p snip.rv = len(t[1])*'='`
$0
endsnippet
snippet ss "Subsection" b
${1:Section name}
`!p snip.rv = len(t[1])*'-'`
$0
endsnippet
snippet sss"Subsubsection" b
${1:Section name}
`!p snip.rv = len(t[1])*'^'`
$0
endsnippet
snippet chap "Chapter" b
`!p snip.rv = len(t[1])*'*'`
${1:Chapter name}
`!p snip.rv = len(t[1])*'*'`
$0
endsnippet
snippet para "Paragraph" b
${1:Paragraph name}
`!p snip.rv = len(t[1])*'"'`
$0
endsnippet
###########################################################################
# More Specialized Stuff. #
###########################################################################
snippet cb "Code Block" b
.. code-block:: ${1:lua}
${2:code}
$0
endsnippet
# vim:ft=snippets:

@ -0,0 +1,23 @@
#########################
# SNIPPETS for SNIPPETS #
#########################
# We use a little hack so that the snippet is expanded
# and parsed correctly
snippet snip "Snippet definition" !
`!p snip.rv = "snippet"` ${1:Tab_trigger} "${2:Description}" ${3:!b}
$0
`!p snip.rv = "endsnippet"`
endsnippet
snippet global "Global snippet" !
`!p snip.rv = "global"` !p
$0
`!p snip.rv = "endglobal"`
endsnippet
snippet vis "${VISUAL}" i
\$\{VISUAL${1:${2:default}${3:/transform/}}\}
endsnippet
# vim:ft=snippets:

28
vimrc

@ -209,7 +209,7 @@ nnoremap <leader>- <C-w>s<C-w>j
nnoremap <leader>e :e <C-R>=expand("%:p:h") . "/" <CR>
" start a new document-wide seach-replace using abolish
nnoremap <leader>f :%S/\v
nnoremap <leader>f :%S/
" dont use the arrow keys in insert mode
inoremap <up> <nop>
@ -292,6 +292,32 @@ let g:EasyMotion_leader_key = '<leader>m'
" YouCompleteMe Options
let g:ycm_complete_in_comments = 1
let g:ycm_min_num_of_chars_for_completion = 5
let g:ycm_key_list_select_completion = ['<TAB>']
let g:ycm_key_list_previous_completion = ['<S-TAB>']
" UltiSnips ctrl-n if ycm is active
function! g:UltiSnips_Complete()
call UltiSnips_ExpandSnippet()
if g:ulti_expand_res == 0
if pumvisible()
return "\<C-n>"
else
call UltiSnips_JumpForwards()
if g:ulti_jump_forwards_res == 0
return "\<TAB>"
endif
endif
endif
return ""
endfunction
au BufEnter * exec "inoremap <silent> " . g:UltiSnipsExpandTrigger . " <C-R>=g:UltiSnips_Complete()<cr>"
let g:UltiSnipsSnippetDirectories=["snippets"]
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
" Enable syntastic syntax checking
" no checking for xhtml/html -- because of fluidtemplate for TYPO3

Loading…
Cancel
Save