1
0
Fork 0
mirror of synced 2024-11-23 01:05:34 -05:00
ultimate-vim/sources_non_forked/vim-snippets/UltiSnips/html.snippets
2017-02-11 14:01:38 +01:00

244 lines
5.1 KiB
Text

priority -50
###########################################################################
# TextMate Snippets #
###########################################################################
global !p
def x(snip):
if snip.ft.startswith("x"):
snip.rv = '/'
else:
snip.rv = ""
endglobal
snippet doctype "HTML - 5.0 (doctype)" b
<!DOCTYPE html>
endsnippet
#############
# Shortcuts #
#############
snippet down "Down (down)"
&#x2193;
endsnippet
snippet enter "Enter (enter)"
&#x2305;
endsnippet
snippet escape "Escape (escape)"
&#x238B;
endsnippet
snippet shift "Shift (shift)"
&#x21E7;
endsnippet
snippet tab "Tab (tab)"
&#x21E5;
endsnippet
snippet up "Up (up)"
&#x2191;
endsnippet
snippet return "Return (return)"
&#x21A9;
endsnippet
snippet right "Right (right)"
&#x2192;
endsnippet
snippet left "Left (left)"
&#x2190;
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 "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 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}"}}>
${0:${VISUAL}}
</select>
endsnippet
snippet textarea "HTML <textarea>" w
<textarea name="${1:Name}" rows="${2:8}" cols="${3:40}">$0</textarea>
endsnippet
snippet mailto "HTML <a mailto: >" w
<a href="mailto:${1:joe@example.com}?subject=${2:feedback}">${3:email me}</a>
endsnippet
snippet base "HTML <base>" w
<base href="$1"${2: target="$3"}`!p x(snip)`>
endsnippet
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:${VISUAL}}
</div>
endsnippet
snippet div# "<div> with ID & class" w
<div`!p snip.rv=' id="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""``!p snip.rv=' class="' if t[2] else ""`${2:name}`!p snip.rv = '"' if t[2] else ""`>
${0:${VISUAL}}
</div>
endsnippet
snippet form "XHTML <form>" w
<form action="${1:`!p
snip.rv = (snip.basename or 'unnamed') + '_submit'
`}" method="${2:get}" accept-charset="utf-8">
${0:${VISUAL}}
</form>
endsnippet
snippet h1 "XHTML <h1>" w
<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:${VISUAL}}
</head>
endsnippet
snippet link "XHTML <link>" w
<link rel="${1:stylesheet}" href="${2:/css/master.css}" type="text/css" media="${3:screen}" title="${4:no title}" charset="${5:utf-8}"`!p x(snip)`>
endsnippet
snippet meta "XHTML <meta>" w
<meta name="${1:name}" content="${2:content}"`!p x(snip)`>
endsnippet
snippet scriptsrc "HTML <script src...>" w
<script src="$1" charset="${3:utf-8}"></script>
endsnippet
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:${VISUAL}}
</style>
endsnippet
snippet table "XHTML <table>" w
<table>
${0:${VISUAL}}
</table>
endsnippet
snippet a "Link" w
<a href="${1:http://www.${2:url.com}}"${3: target="_blank"}>${4:Anchor Text}</a>
endsnippet
snippet p "paragraph" w
<p>${0:${VISUAL}}</p>
endsnippet
snippet li "list item" w
<li>${0:${VISUAL}}</li>
endsnippet
snippet ul "unordered list" w
<ul>
${0:${VISUAL}}
</ul>
endsnippet
snippet td "table cell" w
<td>${0:${VISUAL}}</td>
endsnippet
snippet th "table header" w
<th>${0:${VISUAL}}</th>
endsnippet
snippet tr "table row" w
<tr>${0:${VISUAL}}</tr>
endsnippet
snippet title "XHTML <title>" w
<title>${1:`!p snip.rv = snip.basename or "Page Title"`}</title>
endsnippet
snippet fieldset "Fieldset" w
<fieldset id="${1/[\w\d]+|( )/(?1:_:\L$0\E)/g}" ${2:class="${3:}"}>
<legend>$1</legend>
${0:${VISUAL}}
</fieldset>
endsnippet
snippet viewport "Responsive viewport meta" w
<meta name="viewport" content="width=device-width, initial-scale=1">
endsnippet
# vim:ft=snippets: