Move of Snippets into repository
This commit is contained in:
parent
a7cf65baf4
commit
a323c503b5
|
@ -0,0 +1,68 @@
|
|||
snippet string "Assembler string definition"
|
||||
${1:Name} db ${2:"Hello World!"} ; string $1 = $2
|
||||
len_$1 equ $ - $1 ; length of string $1
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet \n "Zeilenumbruch" A
|
||||
", 0x0a, "
|
||||
endsnippet
|
||||
|
||||
snippet write "write sys_call"
|
||||
mov eax, 4 ; write sys_call
|
||||
mov ebx, 1 ; write to stdout
|
||||
mov ecx, ${1:string} ; string to write
|
||||
mov edx, len_$1 ; length of $1
|
||||
int 0x80 ; system interrupt
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet exit "exit sys_call"
|
||||
mov eax, 1 ; exit sys_call
|
||||
mov ebx, ${1:0} ; exit Code
|
||||
int 0x80 ; system interrupt$0
|
||||
endsnippet
|
||||
|
||||
snippet template "Template for assembly program"
|
||||
global ${1:_start} ; linker entry point
|
||||
; Author: ${2: Yannick Reiß}
|
||||
; Date: `date`
|
||||
; Description: ${3:Desciption}
|
||||
|
||||
section .data
|
||||
$4
|
||||
|
||||
section .bss
|
||||
$5
|
||||
|
||||
section .text
|
||||
$1:
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet read "read sys call"
|
||||
mov eax, 3 ; read sys call
|
||||
mov ebx, 2 ; stdin file descriptor
|
||||
mov ecx, ${1: variable} ; read input value in $1
|
||||
mov edx, ${2:5} ; read $2 bytes of data
|
||||
int 0x80 ; system interrupt
|
||||
endsnippet
|
||||
|
||||
snippet aprstore "Store all purpose register on stack"
|
||||
; store ap-register
|
||||
push eax
|
||||
push ebx
|
||||
push ecx
|
||||
push edx
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet aprload "Load all purpose register from stack"
|
||||
; load ap-register
|
||||
pop eax
|
||||
pop ebx
|
||||
pop ecx
|
||||
pop edx
|
||||
$0
|
||||
endsnippet
|
||||
|
|
@ -0,0 +1,363 @@
|
|||
snippet for "For-loop head"
|
||||
for (${1:int i} = ${2:0}; ${3:i}; ${4:--i}) {
|
||||
$5
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet fun "New Function"
|
||||
${1:int} ${2:MyFunc} (${3:void}) {
|
||||
`!p
|
||||
if t[1] != "void":
|
||||
snip.rv = f"{t[1]} rv = 0;"
|
||||
else:
|
||||
snip.rv = ""`
|
||||
$5
|
||||
`!p
|
||||
if t[1] != "void":
|
||||
snip.rv = f"return rv;"
|
||||
else:
|
||||
snip.rv = ""`
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet "(\w+)->fun" "Struct function" r
|
||||
${1:int} ${2:Name} (`!p snip.rv = match.group(1)`* self, ${4:void}) {
|
||||
`!p
|
||||
if t[1] != "void":
|
||||
snip.rv = f"{t[1]} rv = 0;"
|
||||
else:
|
||||
snip.rv = ""`
|
||||
$5
|
||||
`!p
|
||||
if t[1] != "void":
|
||||
snip.rv = f"return rv;"
|
||||
else:
|
||||
snip.rv = ""`
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet "self.(\w+)" "Struct call" r
|
||||
`!p snip.rv = match.group(1)`(self$1)$0
|
||||
endsnippet
|
||||
|
||||
snippet pfun "prototype for function" bA
|
||||
/**
|
||||
* $2 -> $1
|
||||
* @return $1
|
||||
* @brief Description:
|
||||
* ${4: Description}
|
||||
* @param Parameter:`!p
|
||||
params = t[3].split(",")
|
||||
rval = ""
|
||||
for param in params:
|
||||
if len(param.split(' ')) >= 2:
|
||||
rval += f"\n *\t\t{param}:\t{t[2]}_{param.split(' ')[1]}"
|
||||
snip.rv = rval`
|
||||
*/
|
||||
${1:int} ${2:MyFunc} (${3:void});
|
||||
endsnippet
|
||||
|
||||
|
||||
snippet exfun "New Function with Documentation"
|
||||
/**
|
||||
* $2 -> $1
|
||||
* @return $1
|
||||
* @brief Description:
|
||||
* ${4: Description}
|
||||
* @param Parameter:`!p
|
||||
params = t[3].split(",")
|
||||
rval = ""
|
||||
for param in params:
|
||||
if len(param.split(' ')) >= 2:
|
||||
rval += f"\n *\t\t{param}:\t{t[2]}_{param.split(' ')[1]}"
|
||||
snip.rv = rval`
|
||||
*/
|
||||
${1:int} ${2:MyFunc} (${3:void}) {
|
||||
`!p
|
||||
if t[1] != "void":
|
||||
snip.rv = f"{t[1]} rv = 0;"
|
||||
else:
|
||||
snip.rv = ""`
|
||||
$5
|
||||
`!p
|
||||
if t[1] != "void":
|
||||
snip.rv = f"return rv;"
|
||||
else:
|
||||
snip.rv = ""`
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet while "while loop head"
|
||||
for (;$1;) {
|
||||
$2
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet "(\w+) = malloc" "Automativ malloc error implementation" rA
|
||||
/* Allocate memory for `!p snip.rv = match.group(1)` */
|
||||
`!p snip.rv = match.group(1)` = malloc(sizeof(${1:int}) * $2);
|
||||
if (!`!p snip.rv = match.group(1)`) {
|
||||
/* Error */
|
||||
perror("malloc error on memory allocation of: `!p snip.rv = match.group(1)`");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet "(\w+) = open" "Automatic open error implementation" rA
|
||||
/* create descriptor `!p snip.rv = match.group(1)` for file $1 */
|
||||
`!p snip.rv = match.group(1)` = open(${1:"Filename"}, ${2:"MODE"});
|
||||
if (-1 == `!p snip.rv = match.group(1)`) {
|
||||
/* Error */
|
||||
perror(${4:"open error"});
|
||||
${5:exit(EXIT_FAILURE);}
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet swapint "Swap two integer or numerical variables"
|
||||
/* Swap Variables $1 and $2 */
|
||||
${1:Var1} = $1 + ${2:Var2};
|
||||
$2 = $1 - $2;
|
||||
$1 = $1 - $2;
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet cast "adds cast" i
|
||||
(${1:void})$0
|
||||
endsnippet
|
||||
|
||||
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 def "Completer for predefined Values"
|
||||
$1`!p snip.rv = complete(t[1], ['EXIT_SUCCESS', 'EXIT_FAILURE', 'INT_MAX', 'INT_MIN'])`
|
||||
endsnippet
|
||||
|
||||
snippet printf "Cast printf result to 'void' if heturn value is unneeded" bA
|
||||
(void)printf("$1"`!p
|
||||
if "%" in t[1]:
|
||||
snip.rv = ", "
|
||||
else:
|
||||
snip.rv = ""`$2);$0
|
||||
endsnippet
|
||||
|
||||
snippet defstruct "define a new type with a struct" A
|
||||
/* define struct $1 ${2:Explaination} */
|
||||
typedef struct $1 $1;
|
||||
struct $1 {
|
||||
$3
|
||||
};
|
||||
endsnippet
|
||||
|
||||
snippet docomment "Meta Comment for Documenation" A
|
||||
/*
|
||||
* Filename: `!p snip.rv = fn`
|
||||
* Author: ${1:Yannick Reiss}
|
||||
* Project: ${2:Project Name}
|
||||
* Copyright: ${3:None}
|
||||
* Description: ${4:Funny module}
|
||||
*
|
||||
*/$0
|
||||
endsnippet
|
||||
|
||||
snippet templatehsrm "Program templte from HSRM" A
|
||||
/* include */
|
||||
$1
|
||||
|
||||
/* makros */
|
||||
$2
|
||||
|
||||
/* typ definitions */
|
||||
$3
|
||||
|
||||
/* local function prototypes */
|
||||
$4
|
||||
|
||||
/* global constants */
|
||||
$5
|
||||
|
||||
/* global variables */
|
||||
$6
|
||||
|
||||
/* local constants */
|
||||
$7
|
||||
|
||||
/* local variables */
|
||||
$8
|
||||
|
||||
/* global and local function implementations */
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet let+ "Declare and initialize Variable" A
|
||||
${1:int} ${2:Variable} = ${3:0}; /* ${4:Description} */
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet let- "Declare Variable" A
|
||||
${1:int} ${2:Variable}; /* ${3:Description} */
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet "close\((\w+)\)" "Automatic close error implementation" brA
|
||||
/* Closing file `!p snip.rv = match.group(1)` */
|
||||
if (close(`!p snip.rv = match.group(1)`)) {
|
||||
/* Error */
|
||||
perror("${1:Could not close file!}");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet write( "Automatic write error check" A
|
||||
/* Write $3 bytes from $2 to file $1 */
|
||||
if (-1 == write(${1:file}, ${2:buffer}, ${3:bytes})) {
|
||||
/* Error */
|
||||
perror("${4:Could not write to file!}");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet /* "comment" A
|
||||
/* $1 */$0
|
||||
endsnippet
|
||||
|
||||
snippet "read\((.+), (.+), (.+)\);" "auto read" brA
|
||||
/* read `!p snip.rv = match.group(3)` from file `!p snip.rv = match.group(1)` intobuffer `!p snip.rv = match.goup(2)` */
|
||||
if (-1 == read(`!p snip.rv = match.group(1)`, `!p snip.rv = match.group(2)`, `!p snip.rv = match.group(3)`)) {
|
||||
/* Error */
|
||||
perror("${1:Could not read to file!})";
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet "fstat\((.+), (.+)\);" "auto stat" brA
|
||||
/* load information about file `!p snip.rv = match.group(1)` into struct `!p snip.rv = match.group(2)` */
|
||||
if (fstat(`!p snip.rv = match.group(1)`, `!p snip.rv = match.group(2)`)) {
|
||||
/* Error */
|
||||
perror("${1:Could not fill struct with information!}");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet "ftruncate\((.+), (.+)\);" "ftruncate auto" brA
|
||||
/* Resize file `!p snip.rv = match.group(1)` to size `!p snip.rv = match.group(2)` */
|
||||
if (ftruncate(`!p snip.rv = match.group(1)`, `!p snip.rv = match.group(2)`)) {
|
||||
/* Error */
|
||||
perror("${1:Could not resize file!}j;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet 'system\("(.+)"\);' "Automatic system error implementation" rA
|
||||
/* run system command `!p snip.rv = match.group(1)` and check for success */
|
||||
if (system("`!p snip.rv = match.group(1)`")) {
|
||||
/* Error */
|
||||
perror(${1:"Could not execute shell command!"});
|
||||
${5:exit(EXIT_FAILURE);}
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet "if \(argc" "automatically add clarg check" A
|
||||
/* check for right number of arguments */
|
||||
if (argc ${1:!=} $2) {
|
||||
/* Error */
|
||||
perror("Wrong number of arguments");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet "(\w+) = fork" "Auto fork error implementation" rA
|
||||
/* create new subproccess `!p snip.rv = match.group(1)` */
|
||||
`!p snip.rv = match.group(1)` = fork();
|
||||
if (`!p snip.rv = match.group(1)` < 0) {
|
||||
/* Error */
|
||||
perror("fork error on creating new subprocess '`!p snip.rv = match.group(1)`'.");
|
||||
exit(EXIT_FAILURE);
|
||||
} else if (!`!p snip.rv = match.group(1)`) {
|
||||
/* fork runs from here */
|
||||
${1:execve(proc, args, NULL)};
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet pthread_create "pthreadcreate auto implement" A
|
||||
/* Creating thread $1 running function $3 */
|
||||
if (pthread_create(${1:thread}, ${2:NULL}, ${3:function}, ${4:args})) {
|
||||
perror("Could not create thread $1.");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet pthread_mutex_unlock "mutex" iA
|
||||
/* Unlock mutex $1 */
|
||||
if ( pthread_mutex_unlock(&${1:mutex}) ) {
|
||||
perror("Could not unlock mutex $1.");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet pthread_cond_wait "condition wait" iA
|
||||
/* wait for condition $1 on mutex $2 */
|
||||
if ( pthread_cond_wait(&${1:Condition}, &${2:mutex}) ) {
|
||||
perror("Could not wait for signal $1 on mutex $2.");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet pthread_cond_signal "condition signal" iA
|
||||
/* Send signal $1 */
|
||||
if ( pthread_cond_signal(&${1:signal}) ) {
|
||||
perror("Could not send signal $1.");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet pthread_mutex_lock "mutex" iA
|
||||
/* lock the mutex $1 */
|
||||
if ( pthread_mutex_lock(&${1:mutex}) ) {
|
||||
perror("Could not lock mutex $1.");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet pthread_join "join thread" iA
|
||||
/* join the thread $1 */
|
||||
if ( pthread_join(${1:thread}, ${2:NULL}) ) {
|
||||
perror("Could not join thread $1.");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet sigaction "signal action" i
|
||||
/* call function $2 on signal $1 */
|
||||
if ( sigaction(${1:SIGINT}, ${2:&act}, ${3:&old}) ) {
|
||||
perror("Could not change function of signal $1 to $2.");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet fflush "flush stdout" iA
|
||||
/* flush stdout */
|
||||
if ( fflush(stdout) ) {
|
||||
perror("Could not flush stdout");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
endsnippet
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
snippet template "template for new program" A
|
||||
*-----------------------------------------------------------------
|
||||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. ${1:Title}.
|
||||
*AUTHOR. ${2:Yannick Reiß}.
|
||||
*CONTENT. ${3:Beschreibung}.
|
||||
*-----------------------------------------------------------------
|
||||
|
||||
*-----------------------------------------------------------------
|
||||
DATA DIVISION.
|
||||
*-------------------------
|
||||
FILE SECTION.
|
||||
|
||||
*-------------------------
|
||||
WORKING-STORAGE SECTION.
|
||||
$4
|
||||
*-----------------------------------------------------------------
|
||||
|
||||
*-----------------------------------------------------------------
|
||||
PROCEDURE DIVISION.
|
||||
$0
|
||||
STOP RUN.
|
||||
*-----------------------------------------------------------------
|
||||
endsnippet
|
||||
|
||||
snippet let "Add new Variable" A
|
||||
${1:01} ${2:Name} PIC ${3:999}${4:(8) }${5:VALUE }.
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet compute "Insert a computation" A
|
||||
COMPUTE ${1:Expression}.
|
||||
endsnippet
|
||||
|
||||
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 calc "Add a Calculation with autocomplete" A
|
||||
$1`!p snip.rv = complete(t[1], ['ADD', 'DIVIDE', 'MULTIPLY', 'SUBTRACT'])` ${2:Var1} `!p
|
||||
try:
|
||||
snip.rv = {'ADD': 'TO', 'DIVIDE': 'INTO', 'MULTIPLY': 'BY', 'SUBTRACT': 'FROM'}[t[1] + complete(t[1], ['ADD', 'DIVIDE', 'MULTIPLY', 'SUBTRACT'])]
|
||||
except KeyError:
|
||||
snip.rv = '---'
|
||||
` ${3:Var2} GIVING ${4:VarResult}.
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet move "Move value to another value" A
|
||||
MOVE ${1:Const/Var} TO ${2:Var}.
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet display "Display a contant or Variable" A
|
||||
DISPLAY ${1:"Hello World!"}.
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet accept "Accept a Value to an uninitialized Variable" A
|
||||
ACCEPT ${1:Variable}.
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet strinit "Initialize an empty String" A
|
||||
INITIALIZE ${1:Stringvariable}.
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet init "Inizialize a numerical Value" A
|
||||
INITIALIZE ${1:Numerical variable} REPLACING NUMERIC DATA BY ${2:ZEROS}.
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet ifthen "If-then-else Clause" A
|
||||
IF ${1:Condition} THEN
|
||||
${2:Do this}
|
||||
ELSE
|
||||
${3:Do that}
|
||||
END-IF.
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet ifis "IF-Condition 'is' POS/NEG" A
|
||||
IS $1`!p snip.rv = complete(t[1], ['POSITIVE', 'NEGATIVE'])` $0
|
||||
endsnippet
|
||||
|
||||
|
|
@ -0,0 +1,181 @@
|
|||
snippet header "Header wrapper" b
|
||||
#ifndef $1
|
||||
#define $1
|
||||
|
||||
$0
|
||||
|
||||
#endif//$1
|
||||
endsnippet
|
||||
|
||||
snippet for "For-loop head"
|
||||
for (${1:int i} = ${2:0}; ${3:i}; ${4:--i}) {
|
||||
$5
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet exfun "New Function with Documentation"
|
||||
/**
|
||||
* $2 -> $1
|
||||
* @return $1
|
||||
* @brief Description:
|
||||
* ${4: Description}
|
||||
*
|
||||
@param `!p
|
||||
params = t[3].split(", ")
|
||||
rval = ""
|
||||
for param in params:
|
||||
if len(param.split(' ')) == 2:
|
||||
rval += f" * {param}:\t{t[2]}_{param.split(' ')[1]}\n"
|
||||
snip.rv = rval`
|
||||
*/
|
||||
${1:int} ${2:MyFunc} (${3:void}) {
|
||||
`!p
|
||||
if t[1] != "void":
|
||||
snip.rv = f"{t[1]} rv = 0;"
|
||||
else:
|
||||
snip.rv = ""`
|
||||
$5
|
||||
`!p
|
||||
if t[1] != "void":
|
||||
snip.rv = f"return rv;"
|
||||
else:
|
||||
snip.rv = ""`
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet fun "Function template"
|
||||
${1:int} ${2:Name} (${3:void}) {
|
||||
$5
|
||||
|
||||
return ${6:`!p
|
||||
if t[1] != "void":
|
||||
snip.rv = f"0"
|
||||
else:
|
||||
snip.rv = ""`};
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet while "while loop head"
|
||||
while (${1:true}) {
|
||||
$2
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet ifelse "If-Clause"
|
||||
if ($1) {
|
||||
$2
|
||||
} else {
|
||||
$3
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet class "Add new class" bA
|
||||
class $1 ${2::} `!p
|
||||
if t[2] == ":":
|
||||
snip.rv = "public"
|
||||
else:
|
||||
snip.rv = ""` $3 {
|
||||
public:
|
||||
$1() {
|
||||
`!p
|
||||
variables = t[4].replace('\n', '').replace('\t', '').split(";");
|
||||
rv = ""
|
||||
for var in variables:
|
||||
name = var.split(' ')
|
||||
if var != "" and len(name) >= 2:
|
||||
name[1] = name[1].split('[')[0]
|
||||
rv += f"\t\t{name[1]} = 0;\n"
|
||||
snip.rv = rv`
|
||||
$5
|
||||
}
|
||||
|
||||
// Methoden
|
||||
$6
|
||||
|
||||
// set-Methods
|
||||
`!p
|
||||
variables = t[4].replace('\n', '').replace('\t', '').split(";");
|
||||
rv = ""
|
||||
for var in variables:
|
||||
name = var.split(' ')
|
||||
if var != "" and len(name) >= 2:
|
||||
name[1] = name[1].split('[')[0]
|
||||
if '[' in var:
|
||||
name[0] += '*'
|
||||
rv += f"\tvoid set{name[1]} ({name[0]} _{name[1]});\n"
|
||||
snip.rv = rv`
|
||||
|
||||
// get-Methods
|
||||
`!p
|
||||
variables = t[4].replace('\n', '').replace('\t', '').split(";");
|
||||
rv = ""
|
||||
for var in variables:
|
||||
name = var.split(' ')
|
||||
if var != "" and len(name) >= 2:
|
||||
name[1] = name[1].split('[')[0]
|
||||
if '[' in var:
|
||||
name[0] += '*'
|
||||
rv += f"\t{name[0]} get{name[1]} ();\n"
|
||||
snip.rv = rv`
|
||||
|
||||
private:
|
||||
$4
|
||||
|
||||
};
|
||||
`!p
|
||||
variables = t[4].replace('\n', '').replace('\t', '').split(";");
|
||||
rv = ""
|
||||
for var in variables:
|
||||
name = var.split(' ')
|
||||
if var != "" and len(name) >= 2:
|
||||
name[1] = name[1].split('[')[0]
|
||||
if '[' in var:
|
||||
name[0] += '*'
|
||||
rv += f"void {t[1]}::set{name[1]} ({name[0]} _{name[1]}) {'{'}{name[1]} = _{name[1]};{'}'}\n"
|
||||
snip.rv = rv`
|
||||
`!p
|
||||
variables = t[4].replace('\n', '').replace('\t', '').split(";");
|
||||
rv = ""
|
||||
for var in variables:
|
||||
name = var.split(' ')
|
||||
if var != "" and len(name) >= 2:
|
||||
name[1] = name[1].split('[')[0]
|
||||
if '[' in var:
|
||||
name[0] += '*'
|
||||
rv += f"{name[0]} {t[1]}::get{name[1]} () {'{'} return {name[1]}; {'}'}\n"
|
||||
snip.rv = rv`
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet defstruct "define a new type with a struct" A
|
||||
typedef struct $1 $1;
|
||||
struct $1{
|
||||
$2
|
||||
};
|
||||
endsnippet
|
||||
|
||||
snippet docomment "Meta Comment" A
|
||||
/*
|
||||
* Filename: `!p snip.rv = fn`
|
||||
* Author: ${1:Yannick Reiss}
|
||||
* Project: ${2:Project Name}
|
||||
* Copyright: ${3:None}
|
||||
* Description: ${4:Helpful description}
|
||||
*/
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet let+ "Declare and initialize Variable" A
|
||||
${1:int} ${2:Variable} = ${3:0}; /* ${4:Description} */
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet let- "Declare Variable" A
|
||||
${1:int} ${2:Variable}; /* ${3:Description} */
|
||||
$0
|
||||
endsnippet
|
|
@ -0,0 +1,65 @@
|
|||
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 classmain "Snippet to create class with main function" A
|
||||
public class `!p snip.rv = fn.replace(".java", "")` {
|
||||
public static void main(String[] args) {
|
||||
${0:Code}
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet class "Snippet to create a class"
|
||||
${1:public} class ${2:ClassName} ${3:extends} $4 {
|
||||
// variables
|
||||
$5
|
||||
|
||||
// contructor
|
||||
public $2 () {
|
||||
$6
|
||||
}
|
||||
|
||||
// methods
|
||||
$7
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet fun "New Function with Documentation"
|
||||
/*
|
||||
* $3: $2
|
||||
* $4
|
||||
* ${5: Description}
|
||||
*/
|
||||
|
||||
$1`!p snip.rv = complete(t[1], ["public", "protected", "private"])` $2`!p snip.rv = complete(t[2], ["int", "float", "String", "char", "boolean", "short", "double", "long"])` ${3:MyFunc} (${4:void}) {
|
||||
`!p
|
||||
if t[2] != "void":
|
||||
snip.rv = f"{t[2]} rv = 0;"
|
||||
else:
|
||||
snip.rv = ""`
|
||||
$6
|
||||
`!p
|
||||
if t[2] != "void":
|
||||
snip.rv = f"return rv;"
|
||||
else:
|
||||
snip.rv = ""`
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet printf "This is JAVA :(" A
|
||||
System.out.println(${1:"Hello World!"});
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet let "Variable Definition" A
|
||||
${1:private} ${2:int} ${3:name};
|
||||
$0
|
||||
endsnippet
|
|
@ -0,0 +1,54 @@
|
|||
snippet fun "New function"
|
||||
function ${1:Name} ($2)
|
||||
$3
|
||||
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
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
snippet javabuild "Build rules for Java" A
|
||||
build:
|
||||
javac $(CLASS)
|
||||
|
||||
run:
|
||||
java $(CLASS)
|
||||
|
||||
.PHONY: build run
|
||||
endsnippet
|
||||
|
||||
snippet "__(\w+) " "This is a variable!" irA
|
||||
\$(`!p snip.rv = match.group(1)`) $0
|
||||
endsnippet
|
||||
|
||||
snippet rule "Add new Rule"
|
||||
${1:all}: $2
|
||||
$0
|
||||
endsnippet
|
|
@ -0,0 +1,42 @@
|
|||
snippet link "Link to something"
|
||||
[${1:${VISUAL:Text}}](${3:http://schnick.duckdns.org}})$0
|
||||
endsnippet
|
||||
|
||||
snippet img "Image"
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet cshell "shell Code"
|
||||
\`\`\`shell
|
||||
$1
|
||||
\`\`\`
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet csql "SQL Code"
|
||||
\`\`\`sql
|
||||
$1
|
||||
\`\`\`
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet cpython "python Code"
|
||||
\`\`\`python
|
||||
$1
|
||||
\`\`\`
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet cobol "Cobol Code"
|
||||
\`\`\`cobol
|
||||
$1
|
||||
\`\`\`
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet bash "bash Code"
|
||||
\`\`\`bash
|
||||
$1
|
||||
\`\`\`
|
||||
$0
|
||||
endsnippet
|
|
@ -0,0 +1,608 @@
|
|||
snippet colx "textcolor"
|
||||
\\textcolor{${1:red}}{$2}$0
|
||||
endsnippet
|
||||
|
||||
snippet tred "text red"
|
||||
\\textcolor{red}{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet tblue "text blue"
|
||||
\\textcolor{blue}{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet tgreen "text green"
|
||||
\\textcolor{green}{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet colb "boxcolor"
|
||||
\\colorbox{${1:blue}!${2:25}}{$3}$0
|
||||
endsnippet
|
||||
|
||||
snippet imth "inlinemath"
|
||||
$ $1 $ $0
|
||||
endsnippet
|
||||
|
||||
snippet fmth "fullmath"
|
||||
\\[
|
||||
$1
|
||||
\\]
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet vec "Vector"
|
||||
\\vec{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet tag "tag and text inbetween"
|
||||
${1:placeholder}
|
||||
$2
|
||||
$1
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet env "Environment"
|
||||
\\begin{$1}
|
||||
$2
|
||||
\\end{$1}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet code "listing without own config"
|
||||
\\begin{lstlisting}
|
||||
$1
|
||||
\\end{lstlisting}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet ccpp "C++ listing configuration"
|
||||
\\lstset{ basicstyle=\\ttfamily\\small, language=C++, keywordstyle=\\color{blue}\\bfseries } $0
|
||||
endsnippet
|
||||
|
||||
snippet casm "Assembler listing configuration"
|
||||
\\lstset{basicstyle=\\ttfamily\\small, language={[${1:x86masm}]Assembler}, keywordstyle=\\color{${2:red}}\\bfseries} $0
|
||||
endsnippet
|
||||
|
||||
snippet cshell "ZSH/BASH config"
|
||||
\\lstset{basicstyle=\\ttfamily\\small, language={bash}, keywordstyle=\\color{${2:green}}\\bfseries} $0
|
||||
endsnippet
|
||||
|
||||
snippet cocode "Free config"
|
||||
\\lstset{basicstyle=\\ttfamily\\small, language={$1}, keywordstyle=\\color{${2:red}}\\bfseries} $0
|
||||
endsnippet
|
||||
|
||||
snippet confbook "Configuration for Lectures"
|
||||
\\documentclass[a4paper]{report}
|
||||
\\usepackage[utf8]{inputenc}
|
||||
\\usepackage[ngerman]{babel}
|
||||
\\usepackage[T1]{fontenc}
|
||||
\\usepackage{amsmath}
|
||||
\\usepackage{amsfonts}
|
||||
\\usepackage{amssymb}
|
||||
\\usepackage{makeidx}
|
||||
\\usepackage[straightvoltages]{circuitikz}
|
||||
\\usepackage[locale=DE]{siunitx}
|
||||
\\usepackage{tikz}
|
||||
\\usepackage[left=1cm, right=2cm, top=3cm, bottom=3cm, bindingoffset=1cm]{geometry}
|
||||
\\usepackage{graphicx}
|
||||
\\usepackage{lmodern}
|
||||
\\usepackage{float}
|
||||
\\usepackage{fancyhdr}
|
||||
\\usepackage{listings}
|
||||
\\usepackage{cancel}
|
||||
\\usepackage{xcolor}
|
||||
\\usepackage{interval}
|
||||
\\usepackage{hyperref}
|
||||
\\author{${1:Yannick Reiß}}
|
||||
\\title{$2}
|
||||
\\pagestyle{fancy}
|
||||
\\fancyhead[C]{}
|
||||
\\fancyhead[L]{$2}
|
||||
\\fancyfoot[C]{\thepage}
|
||||
|
||||
${3:colorset}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet confartcl "Configuration for short articles"
|
||||
\\documentclass[16pt,a4paper]{article}
|
||||
\\usepackage[utf8]{inputenc}
|
||||
\\usepackage[ngerman]{babel}
|
||||
\\usepackage[T1]{fontenc}
|
||||
\\usepackage{amsmath}
|
||||
\\usepackage{amsfonts}
|
||||
\\usepackage{amssymb}
|
||||
\\usepackage{fancyhdr}
|
||||
\\usepackage{makeidx}
|
||||
\\usepackage[straightvoltages]{circuitikz}
|
||||
\\usepackage[locale=DE]{siunitx}
|
||||
\\usepackage{tikz}
|
||||
\\usepackage{graphicx}
|
||||
\\usepackage{lmodern}
|
||||
\\usepackage{float}
|
||||
\\usepackage{cancel}
|
||||
\\usepackage[left=1cm, right=2cm, top=3cm, bottom=3cm, bindingoffset=1cm]{geometry}
|
||||
\\usepackage{listings}
|
||||
\\usepackage{xcolor}
|
||||
\\usepackage{interval}
|
||||
\\usepackage{hyperref}
|
||||
\\author{${1:Yannick Reiß}}
|
||||
\\title{$2}
|
||||
\\pagestyle{fancy}
|
||||
\\fancyhead[C]{}
|
||||
\\fancyhead[L]{$2}
|
||||
\\fancyfoot[C]{\thepage}
|
||||
|
||||
${3:colorset}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet img "Images"
|
||||
\\begin{figure}
|
||||
\\centering
|
||||
\\includegraphics[width=${1:0.7}\\linewidth]{${2}}
|
||||
\\caption{${3:Abbildung}}
|
||||
\\end{figure}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet document "Add document environment"
|
||||
\\begin{document}
|
||||
$0
|
||||
\\end{document}
|
||||
endsnippet
|
||||
|
||||
snippet land "Logical and"
|
||||
\\wedge $0
|
||||
endsnippet
|
||||
|
||||
snippet lor "Logical or"
|
||||
\\vee $0
|
||||
endsnippet
|
||||
|
||||
snippet ubrace "Underbrace"
|
||||
\\underbrace{$1}_{$2} $0
|
||||
endsnippet
|
||||
|
||||
snippet fall "For all"
|
||||
\\forall{$1}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet paragraph "Paragraph"
|
||||
\\paragraph{$1}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet menge "Menge der __ Zahlen"
|
||||
\\mathbb{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet xdelete "Cross out"
|
||||
\\xcancel{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet -> "Right normal Arrow"
|
||||
\\rightarrow $0
|
||||
endsnippet
|
||||
|
||||
snippet larrow "Left normal Arrow"
|
||||
\\leftarrow $0
|
||||
endsnippet
|
||||
|
||||
snippet frac "Fracture"
|
||||
\\frac{$1}{$2}$0
|
||||
endsnippet
|
||||
|
||||
snippet mspace "Math Space"
|
||||
\\quad $0
|
||||
endsnippet
|
||||
|
||||
snippet mmspace "Math double Space"
|
||||
\\qquad $0
|
||||
endsnippet
|
||||
|
||||
snippet sum "Sum"
|
||||
\\sum_{i=${1:0}}^{${2:n}} $3 \\qquad $0
|
||||
endsnippet
|
||||
|
||||
snippet prod "Product"
|
||||
\\prod_{i=${1:1}}^{${2:N}} \\quad $3 \\qquad$0
|
||||
endsnippet
|
||||
|
||||
snippet ltab "Table environment"
|
||||
\\begin{tabular}{${1:c c c}}
|
||||
$0
|
||||
\\end{tabular}
|
||||
endsnippet
|
||||
|
||||
snippet ctab "Table column"
|
||||
$1 & $2 & $3 \\\\\\
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet lltab "Large table environment"
|
||||
\\begin{tabular}{${1:c c c c c}}
|
||||
$0
|
||||
\\end{tabular}
|
||||
endsnippet
|
||||
|
||||
snippet cctab "Large column environment"
|
||||
$1 & $2 & $3 & $4 & $5 \\\\\\
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet setab "Small table environment"
|
||||
\\begin{center}
|
||||
\\begin{tabular}{${1:c c}}
|
||||
$1
|
||||
\\end{tabular}
|
||||
\\end{center}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet sctab "Small table column"
|
||||
$1 & $2 \\\\
|
||||
\\\\
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet lquote "Low Quote"
|
||||
´$1´$0
|
||||
endsnippet
|
||||
|
||||
snippet fquote "Full Quote"
|
||||
´$1´ \\textit{($2)}$0
|
||||
endsnippet
|
||||
|
||||
snippet colorset "std colorset (6 colors)"
|
||||
\\definecolor{red}{RGB}{228, 3, 3}
|
||||
\\definecolor{orange}{RGB}{255, 140, 0}
|
||||
\\definecolor{yellow}{RGB}{255, 237, 0}
|
||||
\\definecolor{green}{RGB}{0, 128, 38}
|
||||
\\definecolor{indigo}{RGB}{36, 64, 142}
|
||||
\\definecolor{blue}{RGB}{36, 64, 142}
|
||||
\\definecolor{violet}{RGB}{115, 41, 130}
|
||||
endsnippet
|
||||
|
||||
snippet href "html reference"
|
||||
\\href{https://${1:link}}{\\underline{\\textcolor{blue}{${2:Text}}}}$0
|
||||
endsnippet
|
||||
|
||||
snippet *_ "Intervall/Isotope-Notation" i
|
||||
^{$1}_{$2}$0
|
||||
endsnippet
|
||||
|
||||
snippet hook "Reference to text"
|
||||
\\hyperref[$1]{$2}$0
|
||||
endsnippet
|
||||
|
||||
snippet curled "{ ... }"
|
||||
\\left\\{ $0 \\right\\}
|
||||
endsnippet
|
||||
|
||||
snippet round "( ... )"
|
||||
\\left( $0 \\right)
|
||||
endsnippet
|
||||
|
||||
snippet menc "Mathmode-text"
|
||||
\\text{ $1 }$0
|
||||
endsnippet
|
||||
|
||||
snippet period "Periodic number"
|
||||
\\overline{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet leq "lesser equal"
|
||||
\\leq
|
||||
endsnippet
|
||||
|
||||
snippet geq "greater equal"
|
||||
\\geq
|
||||
endsnippet
|
||||
|
||||
snippet let "lesser than"
|
||||
<
|
||||
endsnippet
|
||||
|
||||
snippet grt "greater than"
|
||||
>
|
||||
endsnippet
|
||||
|
||||
snippet case "if else mathstyle"
|
||||
\\begin{cases}
|
||||
$1 & \\quad \\text{$2}\\\\\\ $3 & \\quad \\text{$4}\\\\\\ \\end{cases}$0
|
||||
endsnippet
|
||||
|
||||
snippet median "Median"
|
||||
\\overset{\\thicksim}{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet ival "Intervall"
|
||||
\\interval[$1]{$2}{$3}$0
|
||||
endsnippet
|
||||
|
||||
snippet mul "multiplication"
|
||||
\\cdot
|
||||
endsnippet
|
||||
|
||||
snippet root "nth root"
|
||||
\\sqrt[${1:2}]{$2}$0
|
||||
endsnippet
|
||||
|
||||
snippet sdef "Definition"
|
||||
\\colorbox{blue!25}{Definition: $1} \\\\\\$0
|
||||
endsnippet
|
||||
|
||||
snippet mlgs "Lineares Gleichungssytem"
|
||||
\\begin{gather}
|
||||
$0
|
||||
\\end{gather}
|
||||
endsnippet
|
||||
|
||||
snippet cobol "COBOL config"
|
||||
\\lstset{ basicstyle=\\ttfamily\\small, language=COBOL, numbers=left, keywordstyle=\\color{blue}\\bfseries} $0
|
||||
endsnippet
|
||||
|
||||
snippet '(.*)__' "sub" r
|
||||
`!p snip.rv = match.group(1)`_{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet '(.*)\*\*' "upup" r
|
||||
`!p snip.rv = match.group(1)`^{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet ... "dots"
|
||||
\\dots
|
||||
endsnippet
|
||||
|
||||
snippet fsf "text serif"
|
||||
\\textsf{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet fblk "text block"
|
||||
\\texttt{$1}{$0}
|
||||
endsnippet
|
||||
|
||||
snippet fit "text italic"
|
||||
\\textit{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet '//(.+)//' "Make Text italic" rA
|
||||
\\textit{`!p snip.rv = match.group(1)`}$0
|
||||
endsnippet
|
||||
|
||||
snippet fbf "text bold"
|
||||
\\textbf{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet '\*\*(.+)\*\*' "Make Text bold" rA
|
||||
\\textbf{`!p snip.rv = match.group(1)`}$0
|
||||
endsnippet
|
||||
|
||||
snippet bit "itemize"
|
||||
\\begin{itemize}
|
||||
\\item $1
|
||||
\\end{itemize}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet ben "enumerate"
|
||||
\\begin{enumerate}
|
||||
\\item $1
|
||||
\\end{enumerate}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet +ni+ "next item" A
|
||||
|
||||
\\item $1
|
||||
endsnippet
|
||||
|
||||
snippet sch "chapter"
|
||||
\\chapter{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet sse "Section"
|
||||
\\section{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet sss "Subsection"
|
||||
\\subsection{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet ssn "Subsubsection"
|
||||
\\subsubsection{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet par "Paragraph"
|
||||
\\paragraph{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet mquote "max quote"
|
||||
\`$1\` (${2:author} : \\textit{${3:source}}, ${4:year})$0
|
||||
endsnippet
|
||||
|
||||
snippet qed "Quod erat demonstrantum"
|
||||
\\begin{flushright}
|
||||
$\#$
|
||||
\\end{flushright}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet <- "Easy Left"
|
||||
\\leftarrow $0
|
||||
endsnippet
|
||||
|
||||
snippet => "Double Right"
|
||||
\\Rightarrow $0
|
||||
endsnippet
|
||||
|
||||
snippet <= "Double Left"
|
||||
\\Leftarrow $0
|
||||
endsnippet
|
||||
|
||||
snippet circuit "Circuit environment"
|
||||
\\colorbox{blue!10}{
|
||||
\\begin{circuitikz}[european resistors]
|
||||
$1
|
||||
\\end{circuitikz}}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet edraw "Draw into electric circuit"
|
||||
\\draw(${1:0}, ${2:0})
|
||||
$3
|
||||
;
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet 'R "Insert Resistor"
|
||||
to [R=$R_{$1}: $2 \Omega$, ${3:i =$i$}, ${4:*-*}] ($5, $6)
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet 'W "Wire"
|
||||
to [short, ${1:i=$i$}, ${2:*-*}] ($3, $4)
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet 'V "Voltage"
|
||||
to [V, v=$U_{$1}: $2V$, ${3:i=$i$}, ${4:*-*}] ($5, $6)
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet 'L "Coil"
|
||||
to [L=$L_{$1}: $2H$, ${3:i=$i$}, ${4:*-*}] ($3, $4)
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet 'C "Capacitor"
|
||||
to [C=$C_{$1}: $2F$, ${3:i=$i$}, ${4:*-*}] ($3, $4)
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet 'W' "Wired powerline"
|
||||
to [short, ${1:*-*}] ($2, $3)
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet 'G "GROUND"
|
||||
to [short] node[ground] {$1} ($2, $3)
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet 'SA "(Sende)-Antenne"
|
||||
to [short] node[antenna] {$1} ($2, $3)
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet timenow "The current time"
|
||||
`date`
|
||||
endsnippet
|
||||
|
||||
snippet texmeta "Meta with stamp for better documentation"
|
||||
% Bookmark `!p import random as ran
|
||||
if not snip.c:
|
||||
snip.rv = t[1][0] + str(ran.randint(10, 100))` Content ${1:Title} on `date` by `echo $USER`
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet lmth "List math with align" b
|
||||
\\begin{align*}
|
||||
$1
|
||||
\\end{align*}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet lexp "List math expression"
|
||||
$1 &= ${2:First} & ${3:Second} \\\\
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet definition "Box with definition"
|
||||
\\framebox{
|
||||
\\colorbox{blue!25}{
|
||||
\\begin{minipage}{1.0\\textwidth}
|
||||
\\textbf{Definition: $1}\\\\
|
||||
$2
|
||||
\\end{minipage}}}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet attention "Box for attention"
|
||||
\\framebox{
|
||||
\\colorbox{red!25}{
|
||||
\\begin{minipage}{1.0\\textwidth}
|
||||
\\textbf{Achtung: $1}\\\\
|
||||
$2
|
||||
\\end{minipage}}}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet headline "Insert a Headline"
|
||||
\\lhead{}
|
||||
\\chead{\\rightmark}
|
||||
\\rhead{\\date}
|
||||
\\renewcommand{\\headrulewidth}{1pt}
|
||||
endsnippet
|
||||
|
||||
snippet footline "Insert a footer"
|
||||
\\lfoot{}
|
||||
\\cfoot{}
|
||||
\\rfoot{}
|
||||
endsnippet
|
||||
|
||||
global !p
|
||||
def create_table_tabs(snip):
|
||||
anon_snippet_body = ""
|
||||
# get start and end line number of (expanded) snippet
|
||||
start = snip.snippet_start[0]
|
||||
end = snip.snippet_end[0]
|
||||
# Append current line into snippet
|
||||
for i in range(start, end+1):
|
||||
anon_snippet_body += snip.buffer[i]
|
||||
anon_snippet_body += "" if i == end else '\n'
|
||||
# delete expanded snippet line while preserving the line
|
||||
for i in range(start, end):
|
||||
del snip.buffer[start]
|
||||
# Empty last line, while preserving the line
|
||||
snip.buffer[start] = ''
|
||||
# Expand anonymous snippet
|
||||
snip.expand_anon(anon_snippet_body)
|
||||
|
||||
def create_table(cols, rows, sep, start, end, head="##"):
|
||||
res = ""
|
||||
placeholder = 1
|
||||
for _ in range(0, int(rows)):
|
||||
res += start + head.replace("##", f"${placeholder} ")
|
||||
placeholder += 1
|
||||
for _ in range(0, int(cols) - 1):
|
||||
res += sep + head.replace("##", f" ${placeholder} ")
|
||||
placeholder += 1
|
||||
res += end
|
||||
return res[:-1]
|
||||
endglobal
|
||||
|
||||
post_jump "create_table_tabs(snip)"
|
||||
snippet 'table(\d+),(\d+)' "Table with given row and column count" r
|
||||
\begin{center}
|
||||
\begin{tabular}{`!p
|
||||
orient = "c"
|
||||
for _ in range(0, int(match.group(1))): orient += " c"
|
||||
snip.rv = orient`}
|
||||
`!p
|
||||
snip.rv = create_table(match.group(1), match.group(2), "&", "\t", "\\\\\\\\\n")
|
||||
`$0
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
endsnippet
|
||||
|
||||
post_jump "create_table_tabs(snip)"
|
||||
snippet 'matrix(\d+),(\d+)' "Matrix with given row and column count" r
|
||||
\begin{pmatrix}
|
||||
`!p
|
||||
snip.rv = create_table(match.group(1), match.group(2), "&", "\t", "\\\\\\\\\n")
|
||||
`$0
|
||||
\end{pmatrix}
|
||||
endsnippet
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
snippet docmodule "Documentation for modules" A
|
||||
"""
|
||||
File: `!p snip.rv = fn`
|
||||
Author: ${1:Yannick Reiß}
|
||||
Description: ${2:No further description}
|
||||
Created on: `date`
|
||||
"""
|
||||
$0
|
||||
endsnippet
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
snippet fn "function declaration" i
|
||||
fn $1($2) `!p
|
||||
if t[3] == "":
|
||||
snip.rv = ""
|
||||
else:
|
||||
snip.rv = " -> "` $3 {
|
||||
$4
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet struct "struct declaration"
|
||||
// $1
|
||||
// ${2:Description}
|
||||
struct ${1:Name} {
|
||||
$3
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet impl "implement struct"
|
||||
// Implementation of $1
|
||||
// ${2:Desciption}
|
||||
impl ${1:struct} {
|
||||
$3
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
snippet snip "Create new snippet"
|
||||
snippet ${1:Name} "${2:Description}" ${3:Options}
|
||||
$4
|
||||
`echo endsnippet`
|
||||
$0
|
||||
endsnippet
|
|
@ -0,0 +1,690 @@
|
|||
snippet colx "textcolor"
|
||||
\\textcolor{${1:red}}{$2}$0
|
||||
endsnippet
|
||||
|
||||
snippet tred "text red" Ai
|
||||
\\textcolor{red}{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet tblue "text blue" Ai
|
||||
\\textcolor{blue}{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet tgreen "text green" Ai
|
||||
\\textcolor{green}{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet colb "boxcolor"
|
||||
\\colorbox{${1:blue}!${2:25}}{$3}$0
|
||||
endsnippet
|
||||
|
||||
snippet ,m "inlinemath" iA
|
||||
\\( $1 \\)$0
|
||||
endsnippet
|
||||
|
||||
snippet ;M "fullmath" iA
|
||||
\\[
|
||||
$1
|
||||
\\]
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet vec "Vector"
|
||||
\\vec{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet tag "tag and text inbetween"
|
||||
${1:placeholder}
|
||||
$2
|
||||
$1
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet env "Environment" A
|
||||
\\begin{$1}
|
||||
$2
|
||||
\\end{$1}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet code "listing without own config"
|
||||
\\begin{lstlisting}
|
||||
$1
|
||||
\\end{lstlisting}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet ccpp "C++ listing configuration"
|
||||
\\lstset{ basicstyle=\\ttfamily\\small, language=C++, keywordstyle=\\color{blue}\\bfseries, numbers=left } $0
|
||||
endsnippet
|
||||
|
||||
snippet casm "Assembler listing configuration"
|
||||
\\lstset{basicstyle=\\ttfamily\\small, language={[${1:x86masm}]Assembler}, keywordstyle=\\color{${2:red}}\\bfseries, numbers=left} $0
|
||||
endsnippet
|
||||
|
||||
snippet cshell "ZSH/BASH config"
|
||||
\\lstset{basicstyle=\\ttfamily\\small, language={bash}, keywordstyle=\\color{${2:green}}\\bfseries, numbers=left} $0
|
||||
endsnippet
|
||||
|
||||
snippet cocode "Free config"
|
||||
\\lstset{basicstyle=\\ttfamily\\small, language={$1}, keywordstyle=\\color{${2:blue}}\\bfseries, numbers=left} $0
|
||||
endsnippet
|
||||
|
||||
snippet confbook "Configuration for Lectures"
|
||||
\\documentclass[a4paper]{report}
|
||||
\\usepackage[utf8]{inputenc}
|
||||
\\usepackage[ngerman]{babel}
|
||||
\\usepackage[T1]{fontenc}
|
||||
\\usepackage{amsmath}
|
||||
\\usepackage{amsfonts}
|
||||
\\usepackage{amssymb}
|
||||
\\usepackage{makeidx}
|
||||
\\usepackage[straightvoltages]{circuitikz}
|
||||
\\usepackage[locale=DE]{siunitx}
|
||||
\\usepackage{tikz}
|
||||
\\usepackage[left=1cm, right=2cm, top=3cm, bottom=3cm, bindingoffset=1cm]{geometry}
|
||||
\\usepackage{graphicx}
|
||||
\\usepackage{lmodern}
|
||||
\\usepackage{float}
|
||||
\\usepackage{fancyhdr}
|
||||
\\usepackage{listings}
|
||||
\\usepackage{cancel}
|
||||
\\usepackage{xcolor}
|
||||
\\usepackage{interval}
|
||||
\\usepackage{hyperref}
|
||||
\\author{${1:Yannick Reiß}}
|
||||
\\title{$2}
|
||||
\\pagestyle{fancy}
|
||||
\\fancyhead[L]{\\leftmark}
|
||||
\\fancyhead[C]{}
|
||||
\\fancyhead[R]{\\rightmark}
|
||||
\\fancyfoot[L]{$1}
|
||||
\\fancyfoot[R]{\\thepage}
|
||||
\\fancyfoot[C]{$2}
|
||||
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet confartcl "Configuration for short articles"
|
||||
\\documentclass[a4paper]{article}
|
||||
\\usepackage[utf8]{inputenc}
|
||||
\\usepackage[ngerman]{babel}
|
||||
\\usepackage[T1]{fontenc}
|
||||
\\usepackage{amsmath}
|
||||
\\usepackage{amsfonts}
|
||||
\\usepackage{amssymb}
|
||||
\\usepackage{fancyhdr}
|
||||
\\usepackage{makeidx}
|
||||
\\usepackage[straightvoltages]{circuitikz}
|
||||
\\usepackage[locale=DE]{siunitx}
|
||||
\\usepackage{tikz}
|
||||
\\usepackage{graphicx}
|
||||
\\usepackage{lmodern}
|
||||
\\usepackage{float}
|
||||
\\usepackage{cancel}
|
||||
\\usepackage[left=1cm, right=2cm, top=3cm, bottom=3cm, bindingoffset=1cm]{geometry}
|
||||
\\usepackage{listings}
|
||||
\\usepackage{xcolor}
|
||||
\\usepackage{interval}
|
||||
\\usepackage{hyperref}
|
||||
\\author{${1:Yannick Reiß}}
|
||||
\\title{$2}
|
||||
\\pagestyle{fancy}
|
||||
\\fancyhead[L]{\\leftmark}
|
||||
\\fancyhead[C]{}
|
||||
\\fancyhead[R]{\\rightmark}
|
||||
\\fancyfoot[L]{$1}
|
||||
\\fancyfoot[R]{\\thepage}
|
||||
\\fancyfoot[C]{$2}
|
||||
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet img "Images"
|
||||
\\begin{figure}[${1:H}]
|
||||
\\centering
|
||||
\\includegraphics[width=${2:0.8}\\linewidth]{${3}}
|
||||
\\caption{${4:Abbildung}}
|
||||
\\end{figure}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet document "Add document environment"
|
||||
\\begin{document}
|
||||
\\input{~/latex/formulas.tex}
|
||||
\\input{~/latex/units.tex}
|
||||
$0
|
||||
\\end{document}
|
||||
endsnippet
|
||||
|
||||
snippet textemplate "include header" A
|
||||
\\input{~/latex/header.tex}
|
||||
\\header{${1:report/article}}{${2:Yannick Reiß}}{${3:Titel}}
|
||||
|
||||
\\begin{document}
|
||||
\\input{~/latex/init.tex}
|
||||
$0
|
||||
\\end{document}
|
||||
endsnippet
|
||||
|
||||
snippet land "Logical and"
|
||||
\\wedge $0
|
||||
endsnippet
|
||||
|
||||
snippet lor "Logical or"
|
||||
\\vee $0
|
||||
endsnippet
|
||||
|
||||
snippet ubrace "Underbrace"
|
||||
\\underbrace{$2}_{$1} $0
|
||||
endsnippet
|
||||
|
||||
snippet fall "For all"
|
||||
\\forall_{$1} $2
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet paragraph "Paragraph"
|
||||
\\paragraph{$1}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet xdelete "Cross out" i
|
||||
\\xcancel{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet -> "Right normal Arrow"
|
||||
\\rightarrow $0
|
||||
endsnippet
|
||||
|
||||
snippet larrow "Left normal Arrow"
|
||||
\\leftarrow $0
|
||||
endsnippet
|
||||
|
||||
snippet frac "Fracture" i
|
||||
\\frac{$1}{$2}$0
|
||||
endsnippet
|
||||
|
||||
snippet mspace "Math Space"
|
||||
\\quad $0
|
||||
endsnippet
|
||||
|
||||
snippet mmspace "Math double Space"
|
||||
\\qquad $0
|
||||
endsnippet
|
||||
|
||||
snippet sum "Sum" i
|
||||
\\sum_{i${1:=0}}^{${2:n}} $3 $0
|
||||
endsnippet
|
||||
|
||||
snippet prod "Product"
|
||||
\\prod_{i=${1:1}}^{${2:N}} \\quad $3 \\qquad$0
|
||||
endsnippet
|
||||
|
||||
snippet ltab "Table environment"
|
||||
\\begin{tabular}{${1:c c c}}
|
||||
$0
|
||||
\\end{tabular}
|
||||
endsnippet
|
||||
|
||||
snippet ctab "Table column"
|
||||
$1 & $2 & $3 \\\\\\
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet lltab "Large table environment"
|
||||
\\begin{tabular}{${1:c c c c c}}
|
||||
$0
|
||||
\\end{tabular}
|
||||
endsnippet
|
||||
|
||||
snippet cctab "Large column environment"
|
||||
$1 & $2 & $3 & $4 & $5 \\\\\\
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet setab "Small table environment"
|
||||
\\begin{center}
|
||||
\\begin{tabular}{${1:c c}}
|
||||
$1
|
||||
\\end{tabular}
|
||||
\\end{center}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet sctab "Small table column"
|
||||
$1 & $2 \\\\
|
||||
\\\\
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet lquote "Low Quote"
|
||||
\´$1\´$0
|
||||
endsnippet
|
||||
|
||||
snippet fquote "Full Quote"
|
||||
´$1´ \\textit{($2)}$0
|
||||
endsnippet
|
||||
|
||||
snippet colorset "std colorset (6 colors)"
|
||||
\\definecolor{red}{RGB}{228, 3, 3}
|
||||
\\definecolor{orange}{RGB}{255, 140, 0}
|
||||
\\definecolor{yellow}{RGB}{255, 237, 0}
|
||||
\\definecolor{green}{RGB}{0, 128, 38}
|
||||
\\definecolor{indigo}{RGB}{36, 64, 142}
|
||||
\\definecolor{blue}{RGB}{36, 64, 142}
|
||||
\\definecolor{violet}{RGB}{115, 41, 130}
|
||||
endsnippet
|
||||
|
||||
snippet href "html reference"
|
||||
\\href{https://${1:link}}{\\underline{\\textcolor{blue}{${2:Text}}}}$0
|
||||
endsnippet
|
||||
|
||||
snippet *_ "Intervall/Isotope-Notation" i
|
||||
^{$1}_{$2}$0
|
||||
endsnippet
|
||||
|
||||
snippet hook "Reference to text"
|
||||
\\hyperref[$1]{$2}$0
|
||||
endsnippet
|
||||
|
||||
snippet curled "{ ... }"
|
||||
\\left\\{ $1 \\right\\} $0
|
||||
endsnippet
|
||||
|
||||
snippet tacked "[...]"
|
||||
\\left[ $1 \\right] $0
|
||||
endsnippet
|
||||
|
||||
snippet round "( ... )"
|
||||
\\left( $1 \\right) $0
|
||||
endsnippet
|
||||
|
||||
snippet menc "Mathmode-text" iA
|
||||
\\text{ $1 }$0
|
||||
endsnippet
|
||||
|
||||
snippet period "Periodic number" i
|
||||
\\overline{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet leq "lesser equal"
|
||||
\\leq
|
||||
endsnippet
|
||||
|
||||
snippet geq "greater equal"
|
||||
\\geq
|
||||
endsnippet
|
||||
|
||||
snippet let "lesser than"
|
||||
<
|
||||
endsnippet
|
||||
|
||||
snippet grt "greater than"
|
||||
>
|
||||
endsnippet
|
||||
|
||||
snippet case "if else mathstyle"
|
||||
\\begin{cases}
|
||||
$1 & \\quad \\text{$2}\\\\ $3 & \\quad \\text{$4}\\\\ \\end{cases}$0
|
||||
endsnippet
|
||||
|
||||
snippet median "Median"
|
||||
\\overset{\\thicksim}{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet ival "Intervall"
|
||||
\\interval[$1]{$2}{$3}$0
|
||||
endsnippet
|
||||
|
||||
snippet xx "multiplication" i
|
||||
\\cdot
|
||||
endsnippet
|
||||
|
||||
snippet root "nth root"
|
||||
\\sqrt[$1]{$2}$0
|
||||
endsnippet
|
||||
|
||||
snippet sdef "Definition"
|
||||
\\colorbox{blue!25}{Definition: $1} \\\\\\$0
|
||||
endsnippet
|
||||
|
||||
snippet mlgs "Lineares Gleichungssytem"
|
||||
\\begin{gather}
|
||||
$0
|
||||
\\end{gather}
|
||||
endsnippet
|
||||
|
||||
snippet cobol "COBOL config"
|
||||
\\lstset{ basicstyle=\\ttfamily\\small, language=COBOL, numbers=left, keywordstyle=\\color{blue}\\bfseries} $0
|
||||
endsnippet
|
||||
|
||||
snippet '(.*)__' "sub" rA
|
||||
`!p snip.rv = match.group(1)`_{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet '(.*)\*\*' "upup" r
|
||||
`!p snip.rv = match.group(1)`^{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet ... "dots" i
|
||||
\\dots
|
||||
endsnippet
|
||||
|
||||
snippet fsf "text serif"
|
||||
\\textsf{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet fblk "text block"
|
||||
\\texttt{$1}{$0}
|
||||
endsnippet
|
||||
|
||||
snippet fit "text italic"
|
||||
\\textit{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet '//(.+)//' "Make Text italic" rA
|
||||
\\textit{`!p snip.rv = match.group(1)`}$0
|
||||
endsnippet
|
||||
|
||||
snippet '~~(.+)~~' "underline Text" rA
|
||||
\\underline{`!p snip.rv = match.group(1)`} $0
|
||||
endsnippet
|
||||
|
||||
snippet fbf "text bold"
|
||||
\\textbf{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet '\*\*(.+)\*\*' "Make Text bold" rA
|
||||
\\textbf{`!p snip.rv = match.group(1)`}$0
|
||||
endsnippet
|
||||
|
||||
snippet bit "itemize"
|
||||
\\begin{itemize}
|
||||
\\item $1
|
||||
\\end{itemize}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet ben "enumerate"
|
||||
\\begin{enumerate}
|
||||
\\item $1
|
||||
\\end{enumerate}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet +ni+ "next item" A
|
||||
|
||||
\\item $1 % $0
|
||||
endsnippet
|
||||
|
||||
snippet sch "chapter"
|
||||
\\chapter{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet sse "Section"
|
||||
\\section{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet sss "Subsection"
|
||||
\\subsection{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet ssn "Subsubsection"
|
||||
\\subsubsection{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet par "Paragraph"
|
||||
\\paragraph{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet mquote "max quote"
|
||||
\`$1\` (${2:author} : \\textit{${3:source}}, ${4:year})$0
|
||||
endsnippet
|
||||
|
||||
snippet qed "Quod erat demonstrantum"
|
||||
\qed
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet <- "Easy Left"
|
||||
\\leftarrow $0
|
||||
endsnippet
|
||||
|
||||
snippet => "Double Right"
|
||||
\\Rightarrow $0
|
||||
endsnippet
|
||||
|
||||
snippet <= "Double Left"
|
||||
\\Leftarrow $0
|
||||
endsnippet
|
||||
|
||||
snippet circuit "Circuit environment"
|
||||
\\colorbox{blue!10}{
|
||||
\\begin{circuitikz}[european resistors]
|
||||
$1
|
||||
\\end{circuitikz}}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet edraw "Draw into electric circuit"
|
||||
\\draw(${1:0}, ${2:0})
|
||||
$3
|
||||
;
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet 'R "Insert Resistor"
|
||||
to [R=$R_{$1}: $2 \Omega$, ${3:i =$i$}, ${4:*-*}] ($5, $6)
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet 'W "Wire"
|
||||
to [short, ${1:i=$i$}, ${2:*-*}] ($3, $4)
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet 'V "Voltage"
|
||||
to [V, v=$U_{$1}: $2V$, ${3:i=$i$}, ${4:*-*}] ($5, $6)
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet 'L "Coil"
|
||||
to [L=$L_{$1}: $2H$, ${3:i=$i$}, ${4:*-*}] ($4, $5)
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet 'C "Capacitor"
|
||||
to [C=$C_{$1}: $2F$, ${3:i=$i$}, ${4:*-*}] ($3, $4)
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet 'W' "Wired powerline"
|
||||
to [short, ${1:*-*}] ($2, $3)
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet 'G "GROUND"
|
||||
to [short] node[ground] {$1} ($2, $3)
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet 'SA "(Sende)-Antenne"
|
||||
to [short] node[antenna] {$1} ($2, $3)
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet timenow "The current time"
|
||||
`date`
|
||||
endsnippet
|
||||
|
||||
snippet texmeta "Meta with stamp for better documentation"
|
||||
% ${1:Name} `!p import random as ran
|
||||
if not snip.c:
|
||||
snip.rv = t[1][0] + str(ran.randint(10, 100))`: ${2:Content} on `date` by `echo $USER`
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet ;L "List math with align" A
|
||||
\\begin{align}
|
||||
$1
|
||||
\\end{align}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet lexp "List math expression" A
|
||||
$1 &= ${2:First} & ${3:Second} ${4:\\nonumber} \\\\
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet definition "Box with definition"
|
||||
\\framebox{
|
||||
\\colorbox{blue!25}{
|
||||
\\begin{minipage}{1.0\\textwidth}
|
||||
\\textbf{Definition: $1}\\\\
|
||||
$2
|
||||
\\end{minipage}}}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet attention "Box for attention"
|
||||
\\framebox{
|
||||
\\colorbox{red!25}{
|
||||
\\begin{minipage}{1.0\\textwidth}
|
||||
\\textbf{Achtung: $1}\\\\
|
||||
$2
|
||||
\\end{minipage}}}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet headline "Insert a Headline"
|
||||
\\lhead{}
|
||||
\\chead{\\rightmark}
|
||||
\\rhead{\\date}
|
||||
\\renewcommand{\\headrulewidth}{1pt}
|
||||
endsnippet
|
||||
|
||||
snippet footline "Insert a footer"
|
||||
\\lfoot{}
|
||||
\\cfoot{}
|
||||
\\rfoot{}
|
||||
endsnippet
|
||||
|
||||
global !p
|
||||
def create_table_tabs(snip):
|
||||
anon_snippet_body = ""
|
||||
# get start and end line number of (expanded) snippet
|
||||
start = snip.snippet_start[0]
|
||||
end = snip.snippet_end[0]
|
||||
# Append current line into snippet
|
||||
for i in range(start, end+1):
|
||||
anon_snippet_body += snip.buffer[i]
|
||||
anon_snippet_body += "" if i == end else '\n'
|
||||
# delete expanded snippet line while preserving the line
|
||||
for i in range(start, end):
|
||||
del snip.buffer[start]
|
||||
# Empty last line, while preserving the line
|
||||
snip.buffer[start] = ''
|
||||
# Expand anonymous snippet
|
||||
snip.expand_anon(anon_snippet_body)
|
||||
|
||||
def create_table(cols, rows, sep, start, end, head="##"):
|
||||
res = ""
|
||||
placeholder = 1
|
||||
for _ in range(0, int(rows)):
|
||||
res += start + head.replace("##", f"${placeholder} ")
|
||||
placeholder += 1
|
||||
for _ in range(0, int(cols) - 1):
|
||||
res += sep + head.replace("##", f" ${placeholder} ")
|
||||
placeholder += 1
|
||||
res += end
|
||||
return res[:-1]
|
||||
endglobal
|
||||
|
||||
post_jump "create_table_tabs(snip)"
|
||||
snippet 'table(\d+),(\d+)' "Table with given row and column count" r
|
||||
\\begin{center}
|
||||
\\begin{tabular}{`!p
|
||||
orient = " "
|
||||
for _ in range(0, int(match.group(1))): orient += "c "
|
||||
snip.rv = orient`}
|
||||
`!p
|
||||
snip.rv = create_table(match.group(1), match.group(2), "&", "\t", "\\\\\\\\\n")
|
||||
`
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
post_jump "create_table_tabs(snip)"
|
||||
snippet 'matrix(\d+),(\d+)' "Table with given row and column count" r
|
||||
\\begin{pmatrix}
|
||||
`!p
|
||||
snip.rv = create_table(match.group(1), match.group(2), "&", "\t", "\\\\\\\\\n")
|
||||
`
|
||||
\\end{pmatrix}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet colorbox "color box: set own caption and content"
|
||||
\\framebox{
|
||||
\\colorbox{${1:green}!20}{
|
||||
\\begin{minipage}{1.0\\textwidth}
|
||||
\\textbf{$2}\\\\
|
||||
$3
|
||||
\\end{minipage}}}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet "menge_(\w+)" "Menge der X Zahlen" rA
|
||||
\\mathbb{`!p snip.rv = match.group(1)`} $0
|
||||
endsnippet
|
||||
|
||||
snippet pq "pq-formula" i
|
||||
\pq{$1}{$2} $0
|
||||
endsnippet
|
||||
|
||||
snippet idr. "In der Regel" A
|
||||
in der Regel
|
||||
endsnippet
|
||||
|
||||
snippet usw. "und so weiter" A
|
||||
und so weiter
|
||||
endsnippet
|
||||
|
||||
snippet tikzenv "tikzenvironment" A
|
||||
\\begin{tikzpicture}
|
||||
$1
|
||||
\\end{tikzpicture}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet flowstart "insert flowstart"
|
||||
\\flowstart{$1}{$2}$0
|
||||
endsnippet
|
||||
|
||||
snippet flowstop "insert flowstop"
|
||||
\\flowstop{$1}{$2}$0
|
||||
endsnippet
|
||||
|
||||
snippet %% "Percent" iA
|
||||
\%$0
|
||||
endsnippet
|
||||
|
||||
snippet integral "add Integral" i
|
||||
\integral{$1}{$2}{$3}{$4} $0
|
||||
endsnippet
|
||||
|
||||
snippet cotable "create table with code extension" i
|
||||
\table ${1:row} ${2:column} ${3:Title}
|
||||
endsnippet
|
||||
|
||||
snippet solve "Solve a latex equation"
|
||||
${1:1*1}`!p rv = ""
|
||||
try:
|
||||
rv = eval(t[1])
|
||||
except SyntaxError:
|
||||
rv = "?"
|
||||
snip.rv = f" = {rv}"`
|
||||
endsnippet
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
snippet addlib "add new library" A
|
||||
library $1;
|
||||
use $1.${2:package}.${3:all};
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet entity "new entity"
|
||||
-- Entity $1: ${2:$1}
|
||||
entity ${1:Name} is
|
||||
port($3
|
||||
);
|
||||
end $1;
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet addPort "add a new Port to an entity" A
|
||||
${1:name} : ${2:In/Out} ${3:std_logic}; -- ${4:What is this?}$0
|
||||
endsnippet
|
||||
|
||||
snippet architecture "define an architecture"
|
||||
-- Architecture $1 of $2: $3
|
||||
architecture ${1:name} of ${2:Entity_name} is
|
||||
${4:Konstanten, Typen, Signale}
|
||||
begin
|
||||
${5:Code}
|
||||
end $1;
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet process "New Process in arch"
|
||||
-- Process $1 ${3}
|
||||
${1:Name} : process (${2}) -- runs only, when $2 changed
|
||||
begin
|
||||
$4
|
||||
end process;
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet docstring "Header Comment" A
|
||||
-- `!p snip.rv = fn`
|
||||
-- Created on: `date`
|
||||
-- Author(s): ${1:Alexander Graf, Carl Ries, Yannick Reiß}
|
||||
-- Content: ${2: Entity `!p snip.rv = fn.split('.')[0]`}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet _generic "Add a generic instruction" A
|
||||
generic (${1:name} : ${2:integer} := ${3:8});$0
|
||||
endsnippet
|
||||
|
||||
snippet std_logic_vector "Port is a vector" i
|
||||
std_logic_vector(${1:1} downto ${2:0});$0
|
||||
endsnippet
|
||||
|
||||
snippet vhmeta "VHDL Annotation" A
|
||||
-- Comment from `whoami`: ${1:Description} => `date`
|
||||
endsnippet
|
||||
|
||||
snippet vhtodo "VHDL Todo" A
|
||||
-- TODO from `whoami`: ${1: What to do?} => `date`
|
||||
endsnippet
|
||||
|
||||
snippet regflit "reg_idx from literal" iA
|
||||
std_logic_vector(to_unsigned('${1:Literal}', reg_adr_size));
|
||||
endsnippet
|
||||
|
2
init.lua
2
init.lua
|
@ -33,7 +33,7 @@ vim.g.UltiSnipsExpandTrigger="<tab>"
|
|||
vim.g.UltiSnipsJumpForwardTrigger="<tab>"
|
||||
vim.g.UltiSnipsJumpBackwardTrigger="<S-Tab>"
|
||||
vim.g.UltiSnipsEditSplit="vertical"
|
||||
vim.g.UltiSnipsSnippetDirectories={"/home/nick/.vim/UltiSnips"}
|
||||
vim.g.UltiSnipsSnippetDirectories={"~/.config/nvim/UltiSnips"}
|
||||
|
||||
-- indentLine config
|
||||
vim.g.indentLine_char = '▏'
|
||||
|
|
|
@ -13,11 +13,11 @@ if &shortmess =~ 'A'
|
|||
else
|
||||
set shortmess=aoO
|
||||
endif
|
||||
badd +0 ~/Documents/Programming/LaTeX/La/La.tex
|
||||
badd +28 init.lua
|
||||
argglobal
|
||||
%argdel
|
||||
$argadd ~/Documents/Programming/LaTeX/La/La.tex
|
||||
edit ~/Documents/Programming/LaTeX/La/La.tex
|
||||
$argadd init.lua
|
||||
edit init.lua
|
||||
argglobal
|
||||
setlocal fdm=expr
|
||||
setlocal fde=nvim_treesitter#foldexpr()
|
||||
|
@ -27,11 +27,11 @@ setlocal fdl=0
|
|||
setlocal fml=1
|
||||
setlocal fdn=20
|
||||
setlocal nofen
|
||||
let s:l = 1 - ((0 * winheight(0) + 23) / 47)
|
||||
let s:l = 27 - ((26 * winheight(0) + 23) / 47)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
keepjumps exe s:l
|
||||
normal! zt
|
||||
keepjumps 1
|
||||
keepjumps 27
|
||||
normal! 0
|
||||
tabnext 1
|
||||
if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0 && getbufvar(s:wipebuf, '&buftype') isnot# 'terminal'
|
||||
|
|
Loading…
Reference in New Issue