Compare commits

..

No commits in common. "566763638d640548fc6858856ce2255f2e9f6cfe" and "db450d73a0300cc4579d88c8115be9589319bad1" have entirely different histories.

4 changed files with 81 additions and 35 deletions

View File

@ -0,0 +1,16 @@
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]
return '(' + '|'.join(opts) + ')'
endglobal
snippet !! "Standard message" bA
$1`!p snip.rv=complete(t[1], ["BUG", "INFO", "UPDATE", "FEATURE", "ADD"])`: $2`!p snip.rv=complete(t[2], ["OPEN", "CLOSE", "FIX", "WARNING", "ERROR", "ADD", "REMOVED", "TODO", "NEW"])` `!p
if t[3] == "":
snip.rv = ""
else:
snip.rv = "=>"` $3
endsnippet

View File

@ -1,19 +1,4 @@
snippet helloworld "A little hello world example." b
<!DOCTYPE html>
<html>
<head>
<title>Hello world example</title>
</head>
<body>
<h1 align=center>Hello World</h1>
</body>
</html>
endsnippet
snippet << "Tag for html" bA
<${1:p}>$2</${1/(\w+).*/$1/}>$0
<$1>$2</${1/(\w+).*/$1/}>$0
endsnippet
snippet >> "Line break / closing tag"
</${1:br}>$0
endsnippet

View File

@ -0,0 +1,3 @@
snippet pack "This is the package." bA
(package! $1)$0
endsnippet

View File

@ -1,3 +1,64 @@
snippet fun "New function"
-- @name $1
`!p
param = ""
for i in t[2].split(","):
param += f"-- @param {i.replace(' ', '')}\n"
snip.rv = param
`-- @short ${3:Description}
function ${1:Name} (${2:})
$4
end;
$0
endsnippet
snippet while "while-loop"
while (${1:true})
do
$1
end;
$0
endsnippet
snippet for "for loop"
for ${1:i = 0}, ${2:target}, ${3:1}
do
$4
end;
$0
endsnippet
snippet repeat "repeat until loop"
repeat
$2
until (${1:Condition});
$0
endsnippet
snippet ifthen "normal if clause"
if (${1:Condition})
then
$2
end;
$0
endsnippet
snippet ifelse "if and else clause"
if (${1:Condition})
then
$1
else
$2
end;
$0
endsnippet
snippet "= fun" "Assign a function" rA
= function(${1:Parameter})
$2
end;$0
endsnippet
snippet docstring "Document string" b
-- Filename: `!p snip.rv = fn`
-- Author: ${1:Yannick Reiß}
@ -5,22 +66,3 @@ snippet docstring "Document string" b
-- Description: ${3:Funny lua script}
$0
endsnippet
snippet fun "New function"
-- @name $2
`!p
lines = t[5].split('\n')
for line in lines:
if line.startswith("return"):
snip.rv = f"-- @return {line.replace('return', '').replace(' ', '')}\n"
``!p
param = ""
for i in t[3].split(","):
param += f"-- @param {i.replace(' ', '')}\n"
snip.rv = param
`-- @short ${4:Description}
${1:local }function ${2:Name} (${3:})
$5
end;
$0
endsnippet