Updated snippets to use new "snip" object.
This commit is contained in:
parent
e6759cd03f
commit
f88076636e
@ -10,14 +10,15 @@ c = '#'
|
|||||||
cs = vim.eval("&commentstring")
|
cs = vim.eval("&commentstring")
|
||||||
if len(cs) == 3:
|
if len(cs) == 3:
|
||||||
c = cs[0]
|
c = cs[0]
|
||||||
|
snip.locals["c"] = c
|
||||||
|
|
||||||
res = (len(t[1])+4)*c + '\n' + c + ' '`${1:content}`!p
|
snip.rv = (len(t[1])+4)*c
|
||||||
c = '#'
|
snip.locals["bar"] = snip.rv
|
||||||
cs = vim.eval("&commentstring")
|
snip += c + ' '`${1:content}`!p
|
||||||
if len(cs) == 3:
|
c = snip.locals["c"]
|
||||||
c = cs[0]
|
|
||||||
|
|
||||||
res = ' ' + c + '\n' + (len(t[1])+4)*c`
|
snip.rv = ' ' + c
|
||||||
|
snip += snip.locals["bar"]`
|
||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
@ -27,15 +28,17 @@ c = '#'
|
|||||||
cs = vim.eval("&commentstring")
|
cs = vim.eval("&commentstring")
|
||||||
if len(cs) == 3:
|
if len(cs) == 3:
|
||||||
c = cs[0]
|
c = cs[0]
|
||||||
|
snip.locals["c"] = c
|
||||||
|
snip.locals["bar"] = 75*c
|
||||||
|
|
||||||
res = 75*c + '\n' + c + " "+ (71-len(t[1]))/2*' '
|
snip.rv = snip.locals["bar"]
|
||||||
|
snip += c + " " + (71-len(t[1]))/2*' '
|
||||||
`${1:content}`!p
|
`${1:content}`!p
|
||||||
c = '#'
|
c = snip.locals["c"]
|
||||||
cs = vim.eval("&commentstring")
|
|
||||||
if len(cs) == 3:
|
|
||||||
c = cs[0]
|
|
||||||
|
|
||||||
a = 71-len(t[1]); res = (a/2 + a%2) * " " + " " + c + '\n' + 75*c`
|
a = 71-len(t[1])
|
||||||
|
snip.rv = (a/2 + a%2) * " " + " " + c
|
||||||
|
snip += snip.locals["bar"]`
|
||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ snippet def "#ifndef … #define … #endif"
|
|||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet inc "#include "" (inc)"
|
snippet inc "#include "" (inc)"
|
||||||
#include "${1:`!p res=fn.split('.')[-2]+'.h'`}"
|
#include "${1:`!p snip.rv = snip.basename + '.h'`}"
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet Inc "#include <> (Inc)"
|
snippet Inc "#include <> (Inc)"
|
||||||
@ -46,11 +46,11 @@ endsnippet
|
|||||||
|
|
||||||
snippet once "Include header once only guard"
|
snippet once "Include header once only guard"
|
||||||
#ifndef ${1:`!p
|
#ifndef ${1:`!p
|
||||||
if not len(cur):
|
if not len(snip.c):
|
||||||
import random, string
|
import random, string
|
||||||
name = re.sub(r'[^A-Za-z0-9]+','_', fn).upper()
|
name = re.sub(r'[^A-Za-z0-9]+','_', snip.fn).upper()
|
||||||
rand = ''.join(random.sample(string.ascii_letters+string.digits, 8))
|
rand = ''.join(random.sample(string.ascii_letters+string.digits, 8))
|
||||||
res = ('%s_%s' % (name,rand)).upper()`}
|
snip.rv = ('%s_%s' % (name,rand)).upper()`}
|
||||||
#define $1
|
#define $1
|
||||||
|
|
||||||
${0}
|
${0}
|
||||||
@ -85,8 +85,7 @@ printf("${1:%s}\n"${1/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$2${1/([^%]|%%)*(%.)?.*/(?2
|
|||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet st "struct"
|
snippet st "struct"
|
||||||
struct ${1:`!p if fn != "": res = fn.split(".")[-2].lower()+"_t"
|
struct ${1:`!p snip.rv = (snip.basename or "name") + "_t"`}
|
||||||
else: res = "name"`}
|
|
||||||
{
|
{
|
||||||
${0:/* data */}
|
${0:/* data */}
|
||||||
};
|
};
|
||||||
|
@ -8,11 +8,7 @@ ${1:v}${1/^.*?(-)?(>)?$/(?2::(?1:>:.))/}begin(), $1${1/^.*?(-)?(>)?$/(?2::(?1:>:
|
|||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet cl "class .. (class)"
|
snippet cl "class .. (class)"
|
||||||
class ${1:`!p
|
class ${1:`!p snip.rv = snip.basename or "name"`}
|
||||||
if len(fn):
|
|
||||||
res = fn.split(".")[-2].lower()+ '_t'
|
|
||||||
else:
|
|
||||||
res = "name"`}
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
${1/(\w+).*/$1/} (${2:arguments});
|
${1/(\w+).*/$1/} (${2:arguments});
|
||||||
@ -24,9 +20,7 @@ private:
|
|||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ns "namespace .. (namespace)"
|
snippet ns "namespace .. (namespace)"
|
||||||
namespace${1/.+/ /m}${1:`!p
|
namespace${1/.+/ /m}${1:`!p snip.rv = snip.basename or "name"`}
|
||||||
if len(fn): res = fn.split(".")[-2].lower()
|
|
||||||
else: res ="name"`}
|
|
||||||
{
|
{
|
||||||
$0
|
$0
|
||||||
}${1/.+/ \/* /m}$1${1/.+/ *\/ /m}
|
}${1/.+/ \/* /m}$1${1/.+/ *\/ /m}
|
||||||
|
@ -3,32 +3,33 @@
|
|||||||
snippet sec "Section marker" b
|
snippet sec "Section marker" b
|
||||||
=============================================================================
|
=============================================================================
|
||||||
${1:SECTION}`!p
|
${1:SECTION}`!p
|
||||||
file_start = fn.split('.')[0]
|
file_start = snip.fn.split('.')[0]
|
||||||
sec_name = t[1].strip("1234567890. ").lower().replace(' ', '-')
|
sec_name = t[1].strip("1234567890. ").lower().replace(' ', '-')
|
||||||
|
|
||||||
res = ("*%s-%s*" % (file_start, sec_name)).rjust(77-len(t[1]))`
|
snip.rv = ("*%s-%s*" % (file_start, sec_name)).rjust(77-len(t[1]))`
|
||||||
|
|
||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ssec "Sub section marker" b
|
snippet ssec "Sub section marker" b
|
||||||
${1:Subsection}`!p
|
${1:Subsection}`!p
|
||||||
file_start = fn.split('.')[0]
|
file_start = snip.fn.split('.')[0]
|
||||||
sec_name = t[1].strip("1234567890. ").lower().replace(' ', '-')
|
sec_name = t[1].strip("1234567890. ").lower().replace(' ', '-')
|
||||||
sec_title = ("*%s-%s*" % (file_start, sec_name)).rjust(77-len(t[1]))
|
sec_title = ("*%s-%s*" % (file_start, sec_name)).rjust(77-len(t[1]))
|
||||||
|
|
||||||
res = sec_title + "\n" + "-"*len(t[1])`
|
snip.rv = sec_title
|
||||||
|
snip += "-"*len(t[1])`
|
||||||
|
|
||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet sssec "Subsub Section marker" b
|
snippet sssec "Subsub Section marker" b
|
||||||
${1:SubSubsection}:`!p
|
${1:SubSubsection}:`!p
|
||||||
file_start = fn.split('.')[0]
|
file_start = fn.split('.')[0]
|
||||||
sec_name = t[1].strip("1234567890. ").lower().replace(' ', '-')
|
sec_name = t[1].strip("1234567890. ").lower().replace(' ', '-')
|
||||||
sec_title = ("*%s-%s*" % (file_start, sec_name)).rjust(77-len(t[1]))
|
sec_title = ("*%s-%s*" % (file_start, sec_name)).rjust(77-len(t[1]))
|
||||||
|
|
||||||
res = sec_title`
|
snip.rv = sec_title`
|
||||||
|
|
||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
@ -112,12 +112,12 @@ endsnippet
|
|||||||
# HTML TAGS #
|
# HTML TAGS #
|
||||||
#############
|
#############
|
||||||
snippet input "Input with Label"
|
snippet input "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}"}`!p if vim.eval("&filetype").startswith("x"): res = '/'`>
|
<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 if snip.ft.startswith("x"): snip.rv = '/'`>
|
||||||
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet input "XHTML <input>"
|
snippet input "XHTML <input>"
|
||||||
<input type="${1:text/submit/hidden/button}" name="${2:some_name}" value="$3"${4: id="${5:$2}"}`!p if vim.eval("&filetype").startswith("x"): res = '/'`>
|
<input type="${1:text/submit/hidden/button}" name="${2:some_name}" value="$3"${4: id="${5:$2}"}`!p if snip.ft.startswith("x"): snip.rv = '/'`>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
@ -143,15 +143,12 @@ snippet mailto "XHTML <a mailto: >"
|
|||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet base "XHTML <base>"
|
snippet base "XHTML <base>"
|
||||||
<base href="$1"${2: target="$3"}`!p if vim.eval("&filetype").startswith("x"): res = '/'`>
|
<base href="$1"${2: target="$3"}`!p if snip.ft.startswith("x"): snip.rv = '/'`>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet body "XHTML <body>"
|
snippet body "XHTML <body>"
|
||||||
<body id="${1:`!p
|
<body id="${1:`!p
|
||||||
if len(fn):
|
snip.rv = snip.fn and 'Hallo' or 'Nothin'
|
||||||
res = "Hallo"
|
|
||||||
else:
|
|
||||||
res = "Nothin"
|
|
||||||
`}"${2: onload="$3"}>
|
`}"${2: onload="$3"}>
|
||||||
$0
|
$0
|
||||||
</body>
|
</body>
|
||||||
@ -164,14 +161,12 @@ snippet div "XHTML <div>"
|
|||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet form "XHTML <form>"
|
snippet form "XHTML <form>"
|
||||||
<form action="${1:`!p if len(fn):
|
<form action="${1:`!p
|
||||||
res = fn.split('.')[-2]
|
snip.rv = (snip.basename or 'unnamed') + '_submit'
|
||||||
else:
|
`}" method="${2:get}" accept-charset="utf-8">
|
||||||
res = "unnamed"
|
|
||||||
res += '_submit'`}" method="${2:get}" accept-charset="utf-8">
|
|
||||||
$0
|
$0
|
||||||
|
|
||||||
<p><input type="submit" value="Continue →"`!p if vim.eval("&filetype").startswith("x"): res = '/'`></p>
|
<p><input type="submit" value="Continue →"`!p if snip.ft.startswith("x"): snip.rv = '/'`></p>
|
||||||
</form>
|
</form>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
@ -181,21 +176,18 @@ endsnippet
|
|||||||
|
|
||||||
snippet head "XHTML <head>"
|
snippet head "XHTML <head>"
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8"`!p if vim.eval("&filetype").startswith("x"): res = '/'`>
|
<meta http-equiv="Content-type" content="text/html; charset=utf-8"`!p if snip.ft.startswith("x"): snip.rv = '/'`>
|
||||||
<title>${1:`!p if len(fn):
|
<title>${1:`!p snip.rv = snip.basename or "Page Title"`}</title>
|
||||||
res = fn.split('.')[-2]
|
|
||||||
else:
|
|
||||||
res = "Page Title"`}</title>
|
|
||||||
$0
|
$0
|
||||||
</head>
|
</head>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet link "XHTML <link>"
|
snippet link "XHTML <link>"
|
||||||
<link rel="${1:stylesheet}" href="${2:/css/master.css}" type="text/css" media="${3:screen}" title="${4:no title}" charset="${5:utf-8}"`!p if vim.eval("&filetype").startswith("x"): res = '/'`>
|
<link rel="${1:stylesheet}" href="${2:/css/master.css}" type="text/css" media="${3:screen}" title="${4:no title}" charset="${5:utf-8}"`!p if snip.ft.startswith("x"): snip.rv = '/'`>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet meta "XHTML <meta>"
|
snippet meta "XHTML <meta>"
|
||||||
<meta name="${1:name}" content="${2:content}"`!p if vim.eval("&filetype").startswith("x"): res = '/'`>
|
<meta name="${1:name}" content="${2:content}"`!p if snip.ft.startswith("x"): snip.rv = '/'`>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet scriptsrc "XHTML <script src...>"
|
snippet scriptsrc "XHTML <script src...>"
|
||||||
@ -222,10 +214,7 @@ snippet table "XHTML <table>"
|
|||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet title "XHTML <title>"
|
snippet title "XHTML <title>"
|
||||||
<title>${1:`!p if len(fn):
|
<title>${1:`!p snip.rv = snip.basename or "Page Title"`}</title>
|
||||||
res = fn.split('.')[-2]
|
|
||||||
else:
|
|
||||||
res = "Page Title"`}</title>
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet fieldset "Fieldset"
|
snippet fieldset "Fieldset"
|
||||||
@ -238,15 +227,15 @@ endsnippet
|
|||||||
|
|
||||||
snippet movie "Embed QT movie (movie)" b
|
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">
|
<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 snip['xhtml'] = vim.eval("&filetype").startswith("x") and "/" or ""; res = snip['xhtml']`>
|
<param name="src" value="$1"`!p snip.locals['xhtml'] = snip.ft.startswith("x") and "/" or ""; snip.rv = snip.locals['xhtml']`>
|
||||||
<param name="controller" value="$4"`!p res = snip['xhtml']`>
|
<param name="controller" value="$4"`!p snip.rv = snip.locals['xhtml']`>
|
||||||
<param name="autoplay" value="$5"`!p res = snip['xhtml']`>
|
<param name="autoplay" value="$5"`!p snip.rv = snip.locals['xhtml']`>
|
||||||
<embed src="${1:movie.mov}"
|
<embed src="${1:movie.mov}"
|
||||||
width="${2:320}" height="${3:240}"
|
width="${2:320}" height="${3:240}"
|
||||||
controller="${4:true}" autoplay="${5:true}"
|
controller="${4:true}" autoplay="${5:true}"
|
||||||
scale="tofit" cache="true"
|
scale="tofit" cache="true"
|
||||||
pluginspage="http://www.apple.com/quicktime/download/"
|
pluginspage="http://www.apple.com/quicktime/download/"
|
||||||
`!p res = snip['xhtml']`>
|
`!p snip.rv = snip.locals['xhtml']`>
|
||||||
</object>
|
</object>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -27,10 +27,8 @@ catch (${1:Exception} ${2:e}) {
|
|||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet cl "class" b
|
snippet cl "class" b
|
||||||
class ${1:`!p if len(fn):
|
class ${1:`!p
|
||||||
res = fn.split('.')[-2]
|
snip.rv = snip.basename or "untitled"`} ${2:extends ${3:Parent} }${4:implements ${5:Interface} }{
|
||||||
else:
|
|
||||||
res = "untitled"`} ${2:extends ${3:Parent} }${4:implements ${5:Interface} }{
|
|
||||||
$0
|
$0
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
@ -92,10 +90,7 @@ import
|
|||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet in "interface" b
|
snippet in "interface" b
|
||||||
interface ${1:`!p if len(fn):
|
interface ${1:`!p snip.rv = snip.basename or "untitled"`} ${2:extends ${3:Parent} }{
|
||||||
res = fn.split('.')[-2]
|
|
||||||
else:
|
|
||||||
res = "untitled"`} ${2:extends ${3:Parent} }{
|
|
||||||
$0
|
$0
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
@ -176,10 +171,7 @@ synchronized
|
|||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet tc "test case"
|
snippet tc "test case"
|
||||||
public class ${1:`!p if len(fn):
|
public class ${1:`!p snip.rv = snip.basename or "untitled"`} extends ${2:TestCase} {
|
||||||
res = fn.split('.')[-2]
|
|
||||||
else:
|
|
||||||
res = "untitled"`} extends ${2:TestCase} {
|
|
||||||
$0
|
$0
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
@ -24,52 +24,52 @@ class ${1:MyClass}(${2:object}):
|
|||||||
|
|
||||||
def __init__(self$4):
|
def __init__(self$4):
|
||||||
""" ${5:TODO: Fill me in}`!p
|
""" ${5:TODO: Fill me in}`!p
|
||||||
res = ""
|
snip.rv = ""
|
||||||
snip.reset_indent()
|
snip >> 2
|
||||||
snip.shift(2)
|
|
||||||
|
|
||||||
args = [arg.split('=')[0].strip() for arg in t[4].split(',') if arg]
|
args = [arg.split('=')[0].strip() for arg in t[4].split(',') if arg]
|
||||||
args = [arg for arg in args if arg and arg != "self"]
|
args = [arg for arg in args if arg and arg != "self"]
|
||||||
|
|
||||||
if args:
|
if args:
|
||||||
res += snip.mkline('\n')
|
snip += ""
|
||||||
|
|
||||||
for arg in args:
|
for arg in args:
|
||||||
res += snip.mkline(":%s: description" % arg)
|
snip += ":%s: description" % arg
|
||||||
|
|
||||||
if args:
|
if args:
|
||||||
res += snip.mkline('"""')
|
snip += '"""'
|
||||||
else:
|
else:
|
||||||
res += snip.mkline(' """', '')
|
snip.rv += ' """'
|
||||||
|
|
||||||
if t[2] != "object":
|
for sup in t[2].split(","):
|
||||||
res += snip.mkline(t[2] + ".__init__(self)\n")
|
sup = sup.strip()
|
||||||
|
snip += sup + ".__init__(self)"
|
||||||
|
|
||||||
for arg in args:
|
for arg in args:
|
||||||
res += snip.mkline("self._%s = %s" % (arg, arg))
|
snip += "self._%s = %s" % (arg, arg)
|
||||||
`
|
`
|
||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet def "smart def" b
|
snippet def "smart def" b
|
||||||
def ${1:function}(${2:self}):
|
def ${1:function}(${2:self}):
|
||||||
""" ${3:TODO: Docstring for $1}
|
""" ${3:TODO: Docstring for $1}`!p
|
||||||
`!p res = ""
|
snip.rv = ""
|
||||||
snip.reset_indent()
|
snip >> 1
|
||||||
|
|
||||||
args = [arg.split('=')[0].strip() for arg in t[2].split(',') if arg.strip()]
|
args = [arg.split('=')[0].strip() for arg in t[2].split(',') if arg]
|
||||||
args = [arg for arg in args if arg and arg != "self"]
|
args = [arg for arg in args if arg and arg != "self"]
|
||||||
|
|
||||||
if args:
|
if args:
|
||||||
res += snip.mkline()
|
snip += ""
|
||||||
|
|
||||||
snip.shift()
|
|
||||||
for arg in args:
|
for arg in args:
|
||||||
res += snip.mkline(":%s: description" % arg)
|
snip += ":%s: description" % arg
|
||||||
|
|
||||||
`
|
`${4:
|
||||||
:returns: description
|
|
||||||
"""
|
:returns: ${5:description}
|
||||||
|
}"""
|
||||||
${0:pass}
|
${0:pass}
|
||||||
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
@ -1,30 +1,30 @@
|
|||||||
|
|
||||||
|
|
||||||
snippet part "Part" b
|
snippet part "Part" b
|
||||||
`!p res=len(t[1])*'*'`
|
`!p snip.rv = len(t[1])*'*'`
|
||||||
${1:Part name}
|
${1:Part name}
|
||||||
`!p res=len(t[1])*'*'`
|
`!p snip.rv = len(t[1])*'*'`
|
||||||
|
|
||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet sec "Section" b
|
snippet sec "Section" b
|
||||||
${1:Section name}
|
${1:Section name}
|
||||||
`!p res=len(t[1])*'='`
|
`!p snip.rv = len(t[1])*'='`
|
||||||
|
|
||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet ssec "Subsection" b
|
snippet ssec "Subsection" b
|
||||||
${1:Section name}
|
${1:Section name}
|
||||||
`!p res=len(t[1])*'-'`
|
`!p snip.rv = len(t[1])*'-'`
|
||||||
|
|
||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet sssec "Subsubsection" b
|
snippet sssec "Subsubsection" b
|
||||||
${1:Section name}
|
${1:Section name}
|
||||||
`!p res=len(t[1])*'^'`
|
`!p snip.rv = len(t[1])*'^'`
|
||||||
|
|
||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
@ -13,9 +13,9 @@ snippet !env "#!/usr/bin/env (!env)"
|
|||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet temp "Tempfile"
|
snippet temp "Tempfile"
|
||||||
${1:TMPFILE}="$(mktemp -t ${2:`!p res = re.sub(r'[^a-zA-Z]', '_', fn)
|
${1:TMPFILE}="$(mktemp -t ${2:`!p
|
||||||
if not len(res):
|
snip.rv = re.sub(r'[^a-zA-Z]', '_', snip.fn) or "untitled"
|
||||||
res = "untitled"`})"
|
`})"
|
||||||
${3:${4/(.+)/trap "/}${4:rm -f '$${1/.*\s//}'}${4/(.+)/" 0 # EXIT\n/}${5/(.+)/trap "/}${5:rm -f '$${1/.*\s//}'; exit 1}${5/(.+)/" 2 # INT\n/}${6/(.+)/trap "/}${6:rm -f '$${1/.*\s//}'; exit 1}${6/(.+)/" 1 15 # HUP TERM\n/}}
|
${3:${4/(.+)/trap "/}${4:rm -f '$${1/.*\s//}'}${4/(.+)/" 0 # EXIT\n/}${5/(.+)/trap "/}${5:rm -f '$${1/.*\s//}'; exit 1}${5/(.+)/" 2 # INT\n/}${6/(.+)/trap "/}${6:rm -f '$${1/.*\s//}'; exit 1}${6/(.+)/" 1 15 # HUP TERM\n/}}
|
||||||
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
# We use a little hack so that the snippet is expanded
|
# We use a little hack so that the snippet is expanded
|
||||||
# and parsed correctly
|
# and parsed correctly
|
||||||
snippet snip "Snippet definition" !
|
snippet snip "Snippet definition" !
|
||||||
`!p res="snippet"` ${1:Tab_trigger} "${2:Description}" ${3:!b}
|
`!p snip.rv = "snippet"` ${1:Tab_trigger} "${2:Description}" ${3:!b}
|
||||||
$0
|
$0
|
||||||
`!p res="endsnippet"`
|
`!p snip.rv = "endsnippet"`
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ endif
|
|||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet guard
|
snippet guard
|
||||||
if exists('${1:did_`!p res=fn.replace('.','_')`}') || &cp${2: || version < 700}
|
if exists('${1:did_`!p snip.rv = snip.fn.replace('.','_')`}') || &cp${2: || version < 700}
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let $1 = 1${3}
|
let $1 = 1${3}
|
||||||
|
Loading…
Reference in New Issue
Block a user