vim/UltiSnips/html.snippets

53 lines
830 B
Plaintext

global !p
def complete(t, opts):
if t:
opts = [m[len(t):] for m in opts if m.startswith(t)]
if len(opts) == 1:
return opts[0]
elif len(opts) == 0:
return "-error"
return '(' + '|'.join(opts) + ')'
endglobal
# html snippets
snippet class "HTML class tag"
class="$1"$0
endsnippet
snippet img "HTML img tag"
<img src="$1"${2: alt="$3"}/>
endsnippet
snippet span "HTML span tag" i
<span>$0</span>
endsnippet
snippet code "HTML code tab" i
<code>$0</code>
endsnippet
snippet section "HTML section tag"
<section$1>
$0
</section>
endsnippet
snippet table "HTML table"
<table>
<thead>
<tr>
<th>$1</th>
</tr>
</thead>
<tbody>
<tr>
<td>$0</td>
</tr>
</tbody>
</table>
endsnippet
snippet text-align "CSS text-align"
style="text-align:$1`!p snip.rv=complete(t[1], ['left', 'center', 'right'])`"
endsnippet