diff --git a/UltiSnips/all.snippets b/UltiSnips/all.snippets
index 1df4297..0a0aa3d 100644
--- a/UltiSnips/all.snippets
+++ b/UltiSnips/all.snippets
@@ -4,41 +4,40 @@
##############
# NICE BOXES #
##############
+global !p
+def cs(snip):
+ c = '#'
+ cs = snip.opt("&commentstring")
+ if len(cs) == 3:
+ c = cs[0]
+ return c
+endglobal
+
snippet box "A nice box with the current comment symbol" b
`!p
-c = '#'
-cs = vim.eval("&commentstring")
-if len(cs) == 3:
- c = cs[0]
-snip.locals["c"] = c
+c = cs(snip)
snip.rv = (len(t[1])+4)*c
-snip.locals["bar"] = snip.rv
+bar = snip.rv
snip += c + ' '`${1:content}`!p
-c = snip.locals["c"]
snip.rv = ' ' + c
-snip += snip.locals["bar"]`
+snip += bar`
$0
endsnippet
snippet bbox "A nice box over the full width" b
`!p
-c = '#'
-cs = vim.eval("&commentstring")
-if len(cs) == 3:
- c = cs[0]
-snip.locals["c"] = c
-snip.locals["bar"] = 75*c
+c = cs(snip)
+bar = 75*c
-snip.rv = snip.locals["bar"]
+snip.rv = bar
snip += c + " " + (71-len(t[1]))/2*' '
`${1:content}`!p
-c = snip.locals["c"]
a = 71-len(t[1])
snip.rv = (a/2 + a%2) * " " + " " + c
-snip += snip.locals["bar"]`
+snip += bar`
$0
endsnippet
diff --git a/UltiSnips/help.snippets b/UltiSnips/help.snippets
index 0a002e1..ad28431 100644
--- a/UltiSnips/help.snippets
+++ b/UltiSnips/help.snippets
@@ -1,35 +1,28 @@
# Snippets for VIM Help Files
+global !p
+def sec_title(snip, t):
+ file_start = snip.fn.split('.')[0]
+ sec_name = t[1].strip("1234567890. ").lower().replace(' ', '-')
+ return ("*%s-%s*" % (file_start, sec_name)).rjust(77-len(t[1]))
+endglobal
+
snippet sec "Section marker" b
=============================================================================
-${1:SECTION}`!p
-file_start = snip.fn.split('.')[0]
-sec_name = t[1].strip("1234567890. ").lower().replace(' ', '-')
-
-snip.rv = ("*%s-%s*" % (file_start, sec_name)).rjust(77-len(t[1]))`
+${1:SECTION}`!p snip.rv = sec_title(snip, t)`
$0
endsnippet
snippet ssec "Sub section marker" b
-${1:Subsection}`!p
-file_start = snip.fn.split('.')[0]
-sec_name = t[1].strip("1234567890. ").lower().replace(' ', '-')
-sec_title = ("*%s-%s*" % (file_start, sec_name)).rjust(77-len(t[1]))
-
-snip.rv = sec_title
+${1:Subsection}`!p snip.rv = sec_title(snip, t)
snip += "-"*len(t[1])`
$0
endsnippet
snippet sssec "Subsub Section marker" b
-${1:SubSubsection}:`!p
-file_start = fn.split('.')[0]
-sec_name = t[1].strip("1234567890. ").lower().replace(' ', '-')
-sec_title = ("*%s-%s*" % (file_start, sec_name)).rjust(77-len(t[1]))
-
-snip.rv = sec_title`
+${1:SubSubsection}:`!p snip.rv = sec_title(snip, t)`
$0
endsnippet
diff --git a/UltiSnips/html.snippets b/UltiSnips/html.snippets
index bb1a585..e977be5 100644
--- a/UltiSnips/html.snippets
+++ b/UltiSnips/html.snippets
@@ -2,6 +2,14 @@
# TextMate Snippets #
###########################################################################
+global !p
+def x(snip):
+ if snip.ft.startswith("x"):
+ snip.rv = '/'
+ else:
+ snip.rv = ""
+endglobal
+
############
# Doctypes #
############
@@ -112,12 +120,12 @@ endsnippet
# HTML TAGS #
#############
snippet input "Input with Label"
-
+
endsnippet
snippet input "XHTML "
-
+
endsnippet
@@ -143,7 +151,7 @@ snippet mailto "XHTML "
endsnippet
snippet base "XHTML "
-
+
endsnippet
snippet body "XHTML "
@@ -166,7 +174,7 @@ snip.rv = (snip.basename or 'unnamed') + '_submit'
`}" method="${2:get}" accept-charset="utf-8">
$0
-
+
endsnippet
@@ -176,18 +184,18 @@ endsnippet
snippet head "XHTML "
-
+
${1:`!p snip.rv = snip.basename or "Page Title"`}
$0
endsnippet
snippet link "XHTML "
-
+
endsnippet
snippet meta "XHTML "
-
+
endsnippet
snippet scriptsrc "XHTML