Compare commits

..

2 Commits

Author SHA1 Message Date
Yannick Reiß 2d47c184fd update 2024-02-22 12:11:09 +01:00
Yannick Reiß f29beb74cf 4.4 Init 2024-02-22 11:05:13 +01:00
58 changed files with 1494 additions and 1671 deletions

View File

@ -1,29 +0,0 @@
name: Test Neovim config on push
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-20.04]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install required packages
run: |
apt-get update -qy
apt-get install -y git
apt-get install -y neovim
apt-get install -y python3-neovim
- name: Clone neovim repository
run: |
git clone https://git.nickr.eu/yannickreiss/nvim
- name: Syntax check the configuration
run: |
cd nvim && nvim -l init.lua

4
.gitignore vendored
View File

@ -1,6 +1,2 @@
lastSession.vim lastSession.vim
plugin/ plugin/
spell/
./mail_password
./lua/irc.lua
./lazy-lock.json

3
.netrwhist Normal file
View File

@ -0,0 +1,3 @@
let g:netrw_dirhistmax =10
let g:netrw_dirhistcnt =1
let g:netrw_dirhist_1='/home/nick/.config/nvim'

View File

@ -1,3 +1,52 @@
snippet textio "Insert Textio import" b
with Ada.Text_IO;$0
endsnippet
snippet procedure "insert procedure" b
-- @name $1
-- @return
`!p
snip.rv = ""
if t[2].startswith("l"):
parameters = []
else:
parameters = t[2].replace("\n", "").split(";");
for parameter in parameters:
if not parameter == "" and not parameter.startswith("typ"):
paramless = parameter.replace("\t", "")
snip.rv += f"-- @variable {paramless}\n"
`-- @description $3
procedure ${1:Name} is
$2
begin
$4
end $1;$0
endsnippet
snippet function "insert function" b
-- @name $1
-- @return $3
-- @param $2
`!p
snip.rv = ""
if t[4].startswith("l"):
parameters = []
else:
parameters = t[4].replace("\n", "").split(";")
for parameter in parameters:
if not parameter.startswith("typ") and not parameter == "":
paramless = parameter.replace("\t", "")
snip.rv += f"-- @variable {paramless}\n"
`-- @description $5
function ${1:Name}($2`!p if (t[2] == ""):
t[2] = "a, b: Integer"`) return ${3:Integer} is
$4
begin
$7
return ${6:`!p snip.rv = t[3]`};
end $1;$0
endsnippet
global !p global !p
def complete(t, opts): def complete(t, opts):
if t: if t:
@ -7,188 +56,56 @@ def complete(t, opts):
if len(opts) > 5: if len(opts) > 5:
opts = opts[0:5] opts = opts[0:5]
return "(" + "|".join(opts) + ")" return "(" + "|".join(opts) + ")"
def find_candidate(tabstop, search_type):
# Split up the tabstop on semicolons
items = tabstop.replace("\n", "").replace(" ", "").split(";")
# find multiple same time assignments (a, b : Integer)
single_items = []
for item in items:
if (len(item.split(",")) > 1) and (len(item.split(":")) > 1):
variables = item.split(":")[0]
multi_type = item.split(":")[1]
for variable in variables.split(","):
single_items.append(f"{variable}:{multi_type}")
else:
single_items.append(item)
for candidate in single_items:
if len(candidate.split(":")) > 1:
name = candidate.split(":")[0]
candidate_type = candidate.split(":")[1]
else:
name = "None"
candidate_type = ""
if candidate_type == search_type:
return name
return "None"
endglobal endglobal
snippet helloworld "Hello world example to test features" b snippet if "If condition" b
-- `!p snip.rv = fn` if $1 then
-- Created on: `date` $2
-- Author(s): Yannick Reiss <yannick.reiss@nickr.eu> $3`!p snip.rv = complete(t[3], ["elsif", "else", "end if;"])` ${4:`!p if t[3] == "elsif":
-- Content: Hello world example snip.rv = "condition"
with Ada.Text_IO; use Ada.Text_IO;
-- @name ${1:`!p snip.rv = fn[0].upper() + fn[1:].split('.')[0]`}
-- @return
-- @description Function printing hello world.
procedure $1 is
begin
${2:Put_Line ("Hello world!");}
end $1;$0
endsnippet
snippet docstring "Document String with most important information" b
-- `!p snip.rv = fn`
-- Created on: `date`
-- Author(s): ${1:Yannick Reiß}
-- Description: ${2:`!p snip.rv = fn.split('.')[0]`}
$0
endsnippet
snippet procedure "insert procedure" b
-- @name $1
-- @return
`!p
snip.rv = ""
if t[2].startswith("l"):
parameters = []
else: else:
parameters = t[2].replace("; ", ";").replace('in ', '').replace('out ', '') snip.rv = ""`} `!p
parameters = parameters.replace(' ', '').split(";"); if t[3] == "elsif":
parameter_list = [] snip.rv = "then"`
for parameter in parameters:
if len(parameter.split(',')) == 1:
parameter_list.append(parameter)
else:
try:
list_type = parameter.split(':')[1]
except:
list_type = "???"
list_parameters = parameter.split(':')[0].replace(' ', '').split(',')
for sub_parameter in list_parameters:
parameter_list.append(f"{sub_parameter}\t:\t{list_type}")
for parameter in parameter_list:
if not parameter == "" and not parameter.startswith("typ"):
parameterless = parameter.replace("\t", "")
snip.rv += f"-- @parameter {parameterless}\n"
``!p
snip.rv = ""
if t[3].startswith("l"):
variables = []
else:
variables = t[3].replace("\n", "").split(";");
for variable in variables:
if not variable == "" and not variable.startswith("typ"):
variableless = variable.replace("\t", "").replace (" ", "")
snip.rv += f"\t-- @variable {variableless}\n"
`-- @description $4
procedure ${1:`!p snip.rv = fn.split('.')[0].capitalize()`} `!p snip.rv = "" if t[2] == "" else "("`${2:N : Natural}`!p snip.rv = "" if t[2] == "" else ")"` is
$3
begin
$5 $5
end $1;$0 `!p if t[3] == "end if;":
snip.rv = ""
else:
snip.rv = "end if;"`$0
endsnippet endsnippet
snippet function "insert function" b snippet for "For loop" b
-- @name $1 for ${1:i} ${2:in ${3:1}..${4:10}} loop
-- @return $3 $5
`!p end loop;$0
snip.rv = "" endsnippet
if t[2].startswith("l"):
parameters = []
else:
parameters = t[2].replace("; ", ";").replace('in ', '').replace('out ', '')
parameters = parameters.replace(' ', '').split(";");
parameter_list = []
for parameter in parameters:
if len(parameter.split(',')) == 1:
parameter_list.append(parameter)
else:
try:
list_type = parameter.split(':')[1]
except:
list_type = "???"
list_parameters = parameter.split(':')[0].replace(' ', '').split(',')
for sub_parameter in list_parameters:
parameter_list.append(f"{sub_parameter}\t:\t{list_type}")
for parameter in parameter_list:
if not parameter == "" and not parameter.startswith("typ"):
parameterless = parameter.replace("\t", "")
snip.rv += f"\t-- @parameter {parameterless}\n"
``!p
snip.rv = ""
if t[4].startswith("l"):
variables = []
else:
variables = t[4].replace("\n", "").split(";");
for variable in variables:
if not variable == "" and not variable.startswith("typ") and not variable.startswith("--"):
variableless = variable.replace("\t", "").replace (" ", "")
snip.rv += f"\t-- @variable {variableless}\n"
` -- @description $5
function ${1:`!p snip.rv = fn.split('.')[0].capitalize()`} `!p snip.rv = "" if t[2] == "" else "("`${2:N : Natural}`!p snip.rv = "" if t[2] == "" else ")"` return ${3:Natural} is
$4
begin
$6
return `!p snippet while "While loop" b
candidate = find_candidate(t[4], t[3]) while ${1:Condition} loop
if candidate == "None": $2
candidate = find_candidate(t[2], t[3]) end loop;$0
if candidate == "None": endsnippet
candidate = t[1]
snip.rv = candidate snippet let "Create new Variable" bA
`; ${1:letName}`!p if not t[1].startswith("let"):
end $1;$0 t[1] = t[1].capitalize()``!p snip.rv = "\t:\t"`${2}`!p if t[2].startswith("!"):
snip.rv = ""
else:
snip.rv = complete(t[2], ["Integer", "Boolean", "Float", "Natural", "Positive", "Negative", "Long_Float", "String"])
``!p if t[3] == "":
snip.rv = ""
else:
snip.rv = " := "
`$3;
endsnippet endsnippet
snippet type "declare a new type" bA snippet type "declare a new type" bA
type ${1:TypeName} is ${2:array($3..$4) of }`!p type ${1:TypeName} is ${2:array($3..$4)} of ${5:Integer};$0
if t[2] == "record":
snip.rv = "\n\t\t"
else:
snip.rv = ""`$5`!p
if t[2] == "record":
snip.rv = "\n\tend record"
else:
snip.rv = ""
`;$0
endsnippet endsnippet
snippet project "Project" b snippet docstring "Document String with most important infor" b
project ${1:Default} is -- `!p snip.rv = fn`
for Source_Dirs use ("${2:src}"); -- Created on: `date`
for Object_Dir use "${3:obj}"; -- Author(s): ${1:Yannick Reiß}
for Exec_Dir use "${4:bin}"; -- Content: ${2: Function `!p snip.rv = fn.split('.')[0]`}
for Main use ("${5:main.adb}");
for Languages use ("Ada");
end $1;
-- Create dir? (y/): ${6:no}`!p
from os import system
if t[6] == "y":
system(f"mkdir -p {t[2]}")
system(f"mkdir -p {t[3]}")
system(f"mkdir -p {t[4]}")`
endsnippet
snippet package "Create package configuration" b
package ${1:body }${2:`!p package_name = fn.split('.')[0]
snip.rv = package_name[0].upper() + package_name[1:]`} is
$0
end $2;
endsnippet endsnippet

View File

@ -1,55 +1,21 @@
snippet cred "My private Credentials"
Yannick Reiss <yannick.reiss@nickr.eu>
endsnippet
snippet solve "Solve a python equation"
${1:1*1}`!p rv = ""
from math import *
try:
rv = eval(t[1])
except:
rv = "?"
snip.rv = f" = {rv}"`
endsnippet
snippet dd "Date and Time" i snippet dd "Date and Time" i
`date` `date`
endsnippet endsnippet
snippet crednick "My private Credentials"
Yannick Reiss <yannick.reiss@nickr.eu>
endsnippet
snippet credhsrm "Credentials HSRM" snippet credhsrm "Credentials HSRM"
Yannick Reiß <yannick.reiss@student.hs-rm.de> Yannick Reiß (yareissx/yreis001) <yannick.reiss@student.hs-rm.de>
endsnippet
global !p
from datetime import datetime
def get_datetime():
now = datetime.now()
now_as_list = [
now.strftime("%d"),
now.strftime("%m"),
now.strftime("%Y"),
now.strftime("%H"),
now.strftime("%M")
]
return now_as_list
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]
else:
return "(" + '|'.join(opts) + ")"
endglobal
snippet mail "Template for a new delayed Mail" b
time:${1:`!p snip.rv = get_datetime()[0]`}.${2:`!p snip.rv = get_datetime()[1]`}.${3:`!p snip.rv = get_datetime()[2]`} ${4:`!p snip.rv = get_datetime()[3]`}:${5:`!p snip.rv = get_datetime()[4]`}
from:$6`!p snip.rv = complete(t[6], ['yannick.reiss@nickr.eu', 'schnick@nickr.eu'])`
to:${7:schnick@nickr.eu}
subject:${8:Subject}
${9:Message}
${10:`cat ~/.signature.txt`}
endsnippet
snippet crednina "My true credentials"
Nina Chloé Kassandra Reiß <nina.reiss@nickr.eu>
endsnippet
snippet pwd "Print the current working directory"
`echo $(pwd)`
endsnippet endsnippet

View File

@ -1,10 +1,14 @@
snippet string86 "Assembler string definition" snippet string "Assembler string definition"
${1:Name} db ${2:"Hello World!"} ; string $1 = $2 ${1:Name} db ${2:"Hello World!"} ; string $1 = $2
len_$1 equ $ - $1 ; length of string $1 len_$1 equ $ - $1 ; length of string $1
$0 $0
endsnippet endsnippet
snippet write86 "write sys_call" snippet \n "Zeilenumbruch" A
", 0x0a, "
endsnippet
snippet write "write sys_call"
mov eax, 4 ; write sys_call mov eax, 4 ; write sys_call
mov ebx, 1 ; write to stdout mov ebx, 1 ; write to stdout
mov ecx, ${1:string} ; string to write mov ecx, ${1:string} ; string to write
@ -13,7 +17,7 @@ int 0x80 ; system interrupt
$0 $0
endsnippet endsnippet
snippet exit86 "exit sys_call" snippet exit "exit sys_call"
mov eax, 1 ; exit sys_call mov eax, 1 ; exit sys_call
mov ebx, ${1:0} ; exit Code mov ebx, ${1:0} ; exit Code
int 0x80 ; system interrupt$0 int 0x80 ; system interrupt$0
@ -36,7 +40,33 @@ $1:
$0 $0
endsnippet endsnippet
snippet functionGCC "GCC conform function implementation" b 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
snippet gcc_function "GCC conform function implementation" b
$1: $1:
push %ebp push %ebp
mov %esp, %ebp mov %esp, %ebp

View File

@ -18,9 +18,9 @@ endsnippet
snippet article "Add article reference" b snippet article "Add article reference" b
@article{${1:ref_name}, @article{${1:ref_name},
title = {${2:Titel}}, title={${2:Titel}},
author = {${3:Autor}}, author={${3:Autor}},
journal = {${4:Journal}},`!p journal={${4:Journal}},`!p
if t[5] != "": if t[5] != "":
snip.rv = "\n\tvolume\t= {" snip.rv = "\n\tvolume\t= {"
else: else:
@ -45,9 +45,8 @@ if t[7] != "":
snip.rv = "}," snip.rv = "},"
else: else:
snip.rv = ""` snip.rv = ""`
year = {${8:2023}}, year={${8:2023}},
doi = {${9:DOI_NUM}} publisher={${9:Verlag}}
publisher = {${10:Verlag}}
} }
$0 $0
endsnippet endsnippet

View File

@ -1,32 +1,10 @@
extends cpp snippet hello "Hello World"
Hallo
priority 200
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 helloworld "Hello World"
#include <stdio.h>
int main(void){(void)printf("Hello World!\n");return 0;}
endsnippet endsnippet
snippet for "For-loop head" snippet for "For-loop head"
for (${1:int ${2:i}} = ${3:0}; ${4:$2 < $5}; ${6:$2++}) { for (${1:int i} = ${2:0}; ${3:i}; ${4:--i}) {
$7 $5
}
$0
endsnippet
snippet while "while loop head"
for (;$1;) {
$2
} }
$0 $0
endsnippet endsnippet
@ -48,6 +26,27 @@ else:
$0 $0
endsnippet endsnippet
snippet "(\w+)->fun" "Struct function" r
${1:int} ${2:Name} (`!p snip.rv = match.group(1)`* self, ${4:void}) {
`!p
if t[1].replace('static ', '') != "void":
snip.rv = f"{t[1].replace('static ', '')} rv = 0;"
else:
snip.rv = ""`
$5
`!p
if t[1].replace('static ', '') != "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 snippet pfun "prototype for function" bA
/** /**
* @name $2 * @name $2
@ -78,33 +77,50 @@ for param in params:
snip.rv = rval` snip.rv = rval`
*/ */
${1:int} ${2:MyFunc} (${3:void}) { ${1:int} ${2:MyFunc} (${3:void}) {
/* Returns ${5:void} */
`!p `!p
if t[1].replace('static ', '') != "void": if t[1].replace('static ', '') != "void":
snip.rv = f"{t[1].replace('static ', '')} {t[5]} = 0;" snip.rv = f"{t[1].replace('static ', '')} rv = 0;"
else: else:
snip.rv = ""` snip.rv = ""`
$6 $5
`!p `!p
if t[1].replace('static ', '') != "void": if t[1].replace('static ', '') != "void":
snip.rv = f"return {t[5]};" snip.rv = f"return rv;"
else: else:
snip.rv = ""` snip.rv = ""`
} }
$0 $0
endsnippet endsnippet
snippet while "while loop head"
for (;$1;) {
$2
}
$0
endsnippet
snippet "(\w+) = malloc" "Automativ malloc error implementation" rA snippet "(\w+) = malloc" "Automativ malloc error implementation" rA
/* Allocate memory for `!p snip.rv = match.group(1)` */ /* Allocate memory for `!p snip.rv = match.group(1)` */
`!p snip.rv = match.group(1)` = ($1*)malloc(sizeof(${1:int}) * $2); `!p snip.rv = match.group(1)` = ($1*)malloc(sizeof(${1:int}) * $2);
if (!`!p snip.rv = match.group(1)`) { if (!`!p snip.rv = match.group(1)`) {
/* Error */ /* Error */
(void)printf("ERROR: malloc error on memory allocation of: `!p snip.rv = match.group(1)`!\n"); (void)printf("malloc error on memory allocation of: `!p snip.rv = match.group(1)`!\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
$0 $0
endsnippet 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 swap "Swap two integer or numerical variables" snippet swap "Swap two integer or numerical variables"
/* Swap Variables $1 and $2 */ /* Swap Variables $1 and $2 */
${1:Var1} = $1 + ${2:Var2}; ${1:Var1} = $1 + ${2:Var2};
@ -113,6 +129,27 @@ $1 = $1 - $2;
$0 $0
endsnippet 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 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 snippet defstruct "define a new type with a struct" A
/* define struct $1 ${2:Explaination} */ /* define struct $1 ${2:Explaination} */
typedef struct $1 $1; typedef struct $1 $1;
@ -121,11 +158,10 @@ struct $1 {
}; };
endsnippet endsnippet
snippet docstring "Meta Comment for Documenation" A snippet docomment "Meta Comment for Documenation" A
/* /*
* Filename: `!p snip.rv = fn` * Filename: `!p snip.rv = fn`
* Author: ${1:Yannick Reiss} * Author: ${1:Yannick Reiss}
* Date: `date`
* Project: ${2:Project Name} * Project: ${2:Project Name}
* Copyright: ${3:None} * Copyright: ${3:None}
* Description: ${4:Funny module} * Description: ${4:Funny module}
@ -162,10 +198,158 @@ $8
$0 $0
endsnippet 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 snippet /* "comment" A
/* $1 */$0 /* $1 */$0
endsnippet 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 snippet fflush "flush stdout" iA
/* flush stdout */ /* flush stdout */
if ( fflush(stdout) ) { if ( fflush(stdout) ) {
@ -173,13 +357,3 @@ if ( fflush(stdout) ) {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
endsnippet endsnippet
snippet switch "Classic C switch statement" b
switch(${1:Expression}) {
case $3:
$4
break;$5
default:
$2
}$0
endsnippet

View File

@ -1,12 +1,3 @@
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 template "template for new program" A snippet template "template for new program" A
*----------------------------------------------------------------- *-----------------------------------------------------------------
IDENTIFICATION DIVISION. IDENTIFICATION DIVISION.
@ -32,7 +23,70 @@ snippet template "template for new program" A
*----------------------------------------------------------------- *-----------------------------------------------------------------
endsnippet 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 snippet display "Display a contant or Variable" A
DISPLAY ${1:"Hello World!"}. DISPLAY ${1:"Hello World!"}.
$0 $0
endsnippet 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

View File

@ -1,6 +1,3 @@
extends c
priority 100
snippet header "Header wrapper" b snippet header "Header wrapper" b
#ifndef $1 #ifndef $1
#define $1 #define $1
@ -10,6 +7,72 @@ $0
#endif//$1 #endif//$1
endsnippet 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"
/**
* @name $2
* @return `!p t[1].replace("static ", "")`
* @brief ${4: Description}
*
`!p
params = t[3].split(", ")
rval = ""
for param in params:
if len(param.split(' ')) == 2:
rval += f" * @param {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].replace('static ', '')} rv = 0;"
else:
snip.rv = ""`
$5
`!p
if t[1].replace("static ", "") != "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].replace("static ", "") != "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 snippet class "Add new class" bA
class $1 ${2::} `!p class $1 ${2::} `!p
if t[2] == ":": if t[2] == ":":
@ -87,3 +150,47 @@ for var in variables:
snip.rv = rv` snip.rv = rv`
$0 $0
endsnippet 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
snippet pfun "prototype for function" bA
/**
* @name $2
* @return $1
* @brief ${4: Description}
* `!p
params = t[3].split(", ")
rval = ""
for param in params:
if len(param.split(' ')) >= 2:
rval += f"\n *\t@param {param}:\t{t[2]}_{param.split(' ')[1]}"
snip.rv = rval`
*/
${1:int} ${2:MyFunc} (${3:void});
endsnippet

32
UltiSnips/csv.snippets Normal file
View File

@ -0,0 +1,32 @@
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]
else:
return f"({'|'.join(opts)})"
endglobal
snippet mv "Mitglied DLRG Neuaufnahme" bA
${1}`!p
snip.rv = complete(t[1], ["Herr", "Frau", "Ohne"])
`,${2:Vorname},${3:Nachname},${4:63165}`!p
snip.rv = complete(t[4], ["63165"])`,${5:Adresse},${6:Telefonnummer},${7:Email},${8:Geburtsdatum}`!p
if t[8] != "Geburtsdatum" and len(t[8]) == 8:
if len(t[8]) > 2:
t[8] = f"{t[8][0:2]}.{t[8][2:]}"
if len(t[8]) > 4:
t[8] = f"{t[8][:5]}.{t[8][5:]}"
`,${9:Eintrittsdatum}`!p
if t[9] != "Eintrittsdatum" and len(t[9]) == 8:
if len(t[9]) > 2:
t[9] = f"{t[9][0:2]}.{t[9][2:]}"
if len(t[9]) > 4:
t[9] = f"{t[9][:5]}.{t[9][5:]}"
`,DE${10:IBAN}`!p
if len(t[10]) >= 25:
t[10] = t[10].replace(' ', '')
`,${11:Kontoinhaber*in}
$0
endsnippet

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,3 +0,0 @@
snippet ß "Add backslash" A
\\
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 snippet << "Tag for html" bA
<${1:p}>$2</${1/(\w+).*/$1/}>$0 <$1>$2</${1/(\w+).*/$1/}>$0
endsnippet endsnippet
snippet >> "Line break / closing tag"
</${1:br}>$0
endsnippet

View File

@ -1,7 +0,0 @@
snippet ff "Freunde (fast)" A
.freunde
endsnippet
snippet wild "Widi Schild update"
widi: Schildupdate?
endsnippet

View File

@ -1,37 +0,0 @@
snippet ß "Backslash" A
\\
endsnippet
snippet <> "Add sharp brackets"
⟨$1⟩$0
endsnippet
snippet | "dvd"
endsnippet
snippet () "Braces"
($1)$0
endsnippet
# Mengen
snippet N "Natural number"
endsnippet
snippet Z "Whole numbers"
endsnippet
snippet R "Real"
endsnippet
# Quantoren
snippet E "Exists"
endsnippet
snippet A "All"
endsnippet

3
UltiSnips/lisp.snippets Normal file
View File

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

View File

@ -1,3 +1,57 @@
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
snippet docstring "Document string" b snippet docstring "Document string" b
-- Filename: `!p snip.rv = fn` -- Filename: `!p snip.rv = fn`
-- Author: ${1:Yannick Reiß} -- Author: ${1:Yannick Reiß}
@ -5,22 +59,3 @@ snippet docstring "Document string" b
-- Description: ${3:Funny lua script} -- Description: ${3:Funny lua script}
$0 $0
endsnippet 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

View File

@ -1,35 +0,0 @@
global !p
from datetime import datetime
def get_datetime():
now = datetime.now()
now_as_list = [
now.strftime("%d"),
now.strftime("%m"),
now.strftime("%Y"),
now.strftime("%H"),
now.strftime("%M")
]
return now_as_list
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]
else:
return "(" + '|'.join(opts) + ")"
endglobal
snippet mail "Template for a new delayed Mail" b
time:${1:`!p snip.rv = get_datetime()[0]`}.${2:`!p snip.rv = get_datetime()[1]`}.${3:`!p snip.rv = get_datetime()[2]`} ${4:`!p snip.rv = get_datetime()[3]`}:${5:`!p snip.rv = get_datetime()[4]`}
from:$6`!p snip.rv = complete(t[6], ['yannick.reiss@nickr.eu', 'schnick@nickr.eu'])`
to:${7:schnick@nickr.eu}
subject:${8:Subject}
${9:Message}
${10:`cat ~/.signature.txt`}
endsnippet

View File

@ -108,9 +108,3 @@ snippet rule "Add new Rule"
${1:all}: $2 ${1:all}: $2
$0 $0
endsnippet endsnippet
snippet clean "Clean the object files and binary file" b
.PHONY: clean
clean:
${1:rm *.o $(BIN)}
endsnippet

View File

@ -35,15 +35,15 @@ $1
$0 $0
endsnippet endsnippet
snippet bash "bash Code" snippet cobol "Cobol Code"
\`\`\`bash \`\`\`cobol
$1 $1
\`\`\` \`\`\`
$0 $0
endsnippet endsnippet
snippet cjson "json code" snippet bash "bash Code"
\`\`\`json \`\`\`bash
$1 $1
\`\`\` \`\`\`
$0 $0
@ -53,16 +53,35 @@ snippet ,m "Math equation" A
\$$1\$ $0 \$$1\$ $0
endsnippet endsnippet
snippet bookshelf "Tagline for bookshelf" b snippet entry "Add new entry" bA
`!p -----------------------------------------------------------
if t[1] != "": ## $1 ##
snip.rv = "[CW: " ### Date: ${2:`date`} ###
else: ### Author: ${3:`whoami`} ###
snip.rv = ""`$1`!p ### Host: `hostname` ###
if t[1] != "": -----------------------------------------------------------
snip.rv = "]" Tags: $4
else:
snip.rv = ""` $5
${2:Title} by ${3:Author}
${4:Description} -----------------------------------------------------------
$0
endsnippet
snippet info "The Markdown Information panel" b
---
${1:Info}
Tags: $2
$0
endsnippet
snippet cite "Cite from a paper" b
---
> ${1:Citation}`!p t[1].replace('\n', '\n> ')`
Tags: $2
$0
endsnippet endsnippet

View File

View File

@ -1,91 +0,0 @@
snippet prog "Add new program template" b
Program ${1:Name}`!p snip.rv = "" if t[2] == "" else " ("`${2:FileList}`!p snip.rv = "" if t[2] == "" else ")"`;`!p
if t[3] == "":
snip.rv = ""
else:
snip.rv = "\nconst\n (* Constant declarations *)\n "`${3:Const}`!p
if t[4] == "":
snip.rv = ""
else:
snip.rv = "\ntype\n (* Type declarations *)\n "`${4:Types}`!p
if t[5] == "":
snip.rv = ""
else:
snip.rv = "\nvar\n (* Variable declarations *)\n "`${5:Variables}
Begin
$0
End.
endsnippet
snippet procedure "Add a new procedure" b
{ Procedure
@name: $1`!p
if t[2] == "":
snip.rv = "\n\t"
else:
snip.rv = "\n"
groups = t[2].split(";");
for group in groups:
snip.rv += f"\t@param {group}\n"
snip.rv += "\t"
`@description: $3 }
Procedure ${1:name}`!p
if not (t[2] == ""):
snip.rv = " ("
else:
snip.rv = ""`$2`!p
if not (t[2] == ""):
snip.rv = ")"
else:
snip.rv = ""`;`!p
if t[4] == "":
snip.rv = ""
else:
snip.rv = "\nVar\n\t"`$4
Begin
$0
End;
endsnippet
snippet function "Add a new function" b
{ Procedure
@name: $1`!p
if t[2] == "":
snip.rv = "\n\t"
else:
snip.rv = "\n"
groups = t[2].split(";");
for group in groups:
snip.rv += f"\t@param {group}\n"
snip.rv += "\t"
`@return $3
@description: $4 }
Function ${1:name}`!p
if not (t[2] == ""):
snip.rv = " ("
else:
snip.rv = ""`$2`!p
if not (t[2] == ""):
snip.rv = ")"
else:
snip.rv = ""` : ${3:Integer};`!p
if t[5] == "":
snip.rv = ""
else:
snip.rv = "\nVar\n\t"`$5
Begin
$0
End;
endsnippet
snippet -- "Add comment"
(* $1 *)$0
endsnippet
snippet begin "Create Code Block" b
begin
$1
end;
$0
endsnippet

View File

@ -1 +1,608 @@
extends latex 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

View File

@ -1,6 +0,0 @@
global !p
def print_hello():
print("Hello")
endglobal

View File

@ -1,17 +1,4 @@
snippet helloworld "Hello world example" b snippet docmodule "Documentation for modules" A
"""
File: `!p snip.rv = fn`
Author: Nicki
Created on: `date`
Description: Hello world python example
"""
if __name__ == "__main__":
print("Hello world!")
$0
endsnippet
snippet docmodule "Documentation for modules"
""" """
File: `!p snip.rv = fn` File: `!p snip.rv = fn`
Author: ${1:Yannick Reiß} Author: ${1:Yannick Reiß}
@ -21,26 +8,25 @@ Description: ${2:No further description}
$0 $0
endsnippet endsnippet
snippet def "Python Function" snippet def "Python Function" A
def ${1:function}(${2}): def ${1:function}(${2}):
""" """
@name $1 @name $1
@brief ${3:function description} @brief ${3:function description}
Args: Args:
`!p `!p
params = t[2].replace(", ", ",").split(",") params = t[2].replace(", ", ",").split(",")
snip.rv = "" snip.rv = ""
for param in params: for param in params:
snip.rv += f"\t\t@param {param}\n" snip.rv += f"@param {param}"
` `
Returns: Returns:
@return $4 $4 ${5:description}
""" """
$5 $6
`!p `!p
if t[4] != "" and len(t[4].split(":")) > 1: if t[4] != "":
snip.rv = f"return {t[4].split(':')[0]}"` snip.rv = f"\n\treturn {t[4]}"`
$0 $0
endsnippet endsnippet

View File

@ -1,14 +1,3 @@
snippet helloworld "Hello world example" b
// @name main
// @return
// @brief Hello world example.
// @param
fn main() {
println!("Hello World!");
}
$0
endsnippet
snippet fn "function declaration" i snippet fn "function declaration" i
// @name $1 // @name $1
// @return $3 // @return $3
@ -24,6 +13,13 @@ else:
$0 $0
endsnippet endsnippet
snippet doxygen "Doxygen comment" b
// @name ${1:name}
// @return ${2:Return type}
// @param ${3:Parameter}
// @brief ${4:Description}
endsnippet
snippet struct "struct declaration" snippet struct "struct declaration"
// $1 // $1
// ${2:Description} // ${2:Description}
@ -54,6 +50,28 @@ while $1 {
} $0 } $0
endsnippet endsnippet
global !p
import re
def create_parameter_placeholders(snip):
placeholders_amount = int(snip.buffer[snip.line].strip())
snip.buffer[snip.line] = ''
anon_snippet_body = 'println!("' + '{}'.join(['$' + str(i+1) for i in range(placeholders_amount)]) + f"${placeholders_amount}" + '"'
if placeholders_amount > 0:
anon_snippet_body = anon_snippet_body + ', '
anon_snippet_body = anon_snippet_body + ', '.join(['$' + str(i+1) for i in range(placeholders_amount, 2*placeholders_amount)]) + ");"
snip.expand_anon(anon_snippet_body)
endglobal
post_jump "create_parameter_placeholders(snip)"
snippet "print\d+" "println" rA
`!p snip.rv = match.group(1)`
endsnippet
snippet println "println" A snippet println "println" A
println!("$1");$0 println!("$1");$0
endsnippet endsnippet

View File

@ -4,9 +4,3 @@ $4
`!p snip.rv = "endsnippet"` `!p snip.rv = "endsnippet"`
$0 $0
endsnippet endsnippet
snippet helloworld "A simple hello world snippet" b
${0:`!p
if not snip.c:
snip.rv = f'snippet helloworld "A simple hello world snippet" b\n{t[0]}\nendsnippet'`}
endsnippet

View File

@ -1,9 +1,3 @@
extends pyenv
snippet cc "Add Citation" i
\\cite{$1}$0
endsnippet
snippet colx "textcolor" snippet colx "textcolor"
\\textcolor{${1:red}}{$2}$0 \\textcolor{${1:red}}{$2}$0
endsnippet endsnippet
@ -70,7 +64,6 @@ snippet img "Images"
\\centering \\centering
\\includegraphics[width=${2:0.8}\\linewidth]{${3}} \\includegraphics[width=${2:0.8}\\linewidth]{${3}}
\\caption{${4:Abbildung}} \\caption{${4:Abbildung}}
\\label{img:`!p snip.rv = t[4].lower().replace(" ", "_")`}
\\end{figure} \\end{figure}
$0 $0
endsnippet endsnippet
@ -271,28 +264,23 @@ snippet - "new item" b
endsnippet endsnippet
snippet sch "chapter" snippet sch "chapter"
\\chapter{$1} \\chapter{$1}$0
\\label{chapter:`!p snip.rv = get_label(t[1])`}$0
endsnippet endsnippet
snippet sse "Section" snippet sse "Section"
\\section{$1} \\section{$1}$0
\\label{section:`!p snip.rv = get_label(t[1])`}$0
endsnippet endsnippet
snippet sss "Subsection" snippet sss "Subsection"
\\subsection{$1} \\subsection{$1}$0
\\label{subsection:`!p snip.rv = get_label(t[1])`}$0
endsnippet endsnippet
snippet ssn "Subsubsection" snippet ssn "Subsubsection"
\\subsubsection{$1} \\subsubsection{$1}$0
\\label{subsubsection:`!p snip.rv = get_label(t[1])`}$0
endsnippet endsnippet
snippet par "Paragraph" snippet par "Paragraph"
\\paragraph{$1} \\paragraph{$1}$0
\\label{paragraph:`!p snip.rv = get_label(t[1])`}$0
endsnippet endsnippet
snippet mquote "max quote" snippet mquote "max quote"
@ -385,16 +373,6 @@ def create_table(cols, rows, sep, start, end, head="##"):
placeholder += 1 placeholder += 1
res += end res += end
return res[:-1] return res[:-1]
def get_label(title):
return_label = title.lower()
return_label = return_label.replace(" ", "_")
return_label = return_label.replace("ä", "ae")
return_label = return_label.replace("ö", "oe")
return_label = return_label.replace("ü", "ue")
return_label = return_label.replace("-", "__")
return return_label
endglobal endglobal
post_jump "create_table_tabs(snip)" post_jump "create_table_tabs(snip)"
@ -481,7 +459,7 @@ snippet _- "Escape _ easier" iA
\\_ \\_
endsnippet endsnippet
snippet bsp "Beispielsweise" A snippet bsp "Beispielsweise" iA
beispielsweise beispielsweise
endsnippet endsnippet
@ -489,12 +467,23 @@ snippet ß "Backslash" A
\\ \\
endsnippet endsnippet
snippet \0 "Add another Backslash" iA snippet bibbook "Add a new book/journal/paper reference" b
\\\\ \\bibitem{${1:Reference_name}}
${2:Author}. (${3:2023}) \`${4:Title}'. ${5:Extension} `!p
if t[6] == "":
snip.rv = ""
elif "-" in t[6]:
snip.rv = "Seiten "
else:
snip.rv = "Seite"
`$6`!p
if t[6] == "":
snip.rv = ""
else:
snip.rv = "."`
$0
endsnippet endsnippet
snippet setenv "Set Environment around Text" b snippet cc "Cite" A
\\begin{$1} \\cite{$1}$0
${VISUAL}
\\end{$1}$0
endsnippet endsnippet

60
UltiSnips/text.snippets Normal file
View File

@ -0,0 +1,60 @@
snippet entry "Add new entry" bA
-----------------------------------------------------------
--- Title: $1
--- Date: ${2:`date`}
--- Author: ${3:`whoami`}
--- Host: `hostname`
-----------------------------------------------------------
Tags: $4
$5
-----------------------------------------------------------
$0
endsnippet
snippet 1) "Enumerated List" b
1) $1
`!p
if t[1] == "":
index = 2
if " \n" in t[1]:
t[1] = t[1].replace(" \n", f"\n{index})")
index += 1`
$0
endsnippet
snippet - "Itemized List" b
- $1
`!p
t[1] = t[1].replace(" \n", f"\n-")`
$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]
else:
return f"({'|'.join(opts)})"
endglobal
snippet mgl "DLRG neues Mitglied" b
${1:Num}|${2:Eintrittsdatum}`!p
if t[2] != "Eintrittsdatum" and len(t[2]) == 8:
if len(t[2]) > 2:
t[2] = f"{t[2][0:2]}.{t[2][2:]}"
if len(t[2]) > 4:
t[2] = f"{t[2][:5]}.{t[2][5:]}"
`|${3:Geburtsdatum}`!p
if t[3] != "Geburtsdatum" and len(t[3]) == 8:
if len(t[3]) > 2:
t[3] = f"{t[3][0:2]}.{t[3][2:]}"
if len(t[3]) > 4:
t[3] = f"{t[3][:5]}.{t[3][5:]}"
`|${4:PLZ}|${5}`!p snip.rv= complete(t[5], ['Offenbach', 'Hanau', 'Mühlheim', 'Frankfurt'])`|${6:Adresse}|${7:Nachname}`!p t[7] = t[7].upper()`, ${8:Vorname}
endsnippet

View File

@ -61,7 +61,3 @@ snippet def "Definition/Constant" b
\`define ${1:NAME} ${2:VALUE} \`define ${1:NAME} ${2:VALUE}
$0 $0
endsnippet endsnippet
snippet filename "Get Filename" b
// `pwd`/`!p snip.rv = fn`
endsnippet

View File

@ -49,7 +49,7 @@ endsnippet
snippet docstring "Header Comment" A snippet docstring "Header Comment" A
-- `!p snip.rv = fn` -- `!p snip.rv = fn`
-- Created on: `date` -- Created on: `date`
-- Author(s): ${1:Nina Chloé Reiß} -- Author(s): ${1:Alexander Graf, Carl Ries, Yannick Reiß}
-- Content: ${2: Entity `!p snip.rv = fn.split('.')[0]`} -- Content: ${2: Entity `!p snip.rv = fn.split('.')[0]`}
$0 $0
endsnippet endsnippet
@ -73,7 +73,3 @@ endsnippet
snippet regflit "reg_idx from literal" iA snippet regflit "reg_idx from literal" iA
std_logic_vector(to_unsigned('${1:Literal}', reg_adr_size)); std_logic_vector(to_unsigned('${1:Literal}', reg_adr_size));
endsnippet endsnippet
snippet fillvec "Stdout to fill a vector" A
(others => '0')
endsnippet

View File

@ -1,3 +1,5 @@
snippet nnoremap "Normal mode remap" b snippet fun "Lua function" b
nnoremap ${1:<leader>key} $2$0 function ${1:name}()
$2
endfunction$0
endsnippet endsnippet

View File

@ -1,5 +0,0 @@
snippet << "automated tag insertion" A
<${1:tag}>
$2
</${1/(\w+).*/$1/}>$0
endsnippet

View File

@ -1,22 +0,0 @@
-- Basic setup configuration
require("vanilla")
vim.cmd("source ~/.config/nvim/viml/automacro.vim")
-- Lazy plugin setup
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup("plugins")
require("plugconfig")

4
init.vim Normal file
View File

@ -0,0 +1,4 @@
source ~/.config/nvim/vim/init.vim
source ~/.config/nvim/vim/plug.vim
lua require('plug')

View File

@ -1,67 +0,0 @@
-- Lua vim-dummy variable
if vim == nil then
local vim = {}
end
-- @name Prove
-- @param
-- @short Run gnatprove
function Prove()
vim.cmd("new")
local run_cmd = { "alr gnatprove" }
vim.api.nvim_buf_set_lines(0, 0, -1, false, run_cmd)
vim.cmd(":%!bash")
buffer_loaded = true
end
-- @name Run
-- @param
-- @short Run program using alire
function Run()
vim.cmd("new")
local run_cmd = { "alr run" }
vim.api.nvim_buf_set_lines(0, 0, -1, false, run_cmd)
vim.cmd(":%!bash")
buffer_loaded = true
end
function Close_Prove()
if buffer_loaded then
buffer_loaded = false
vim.cmd("bd!")
end
end
vim.keymap.set("n", "pp", ":lua Close_Prove()<cr>")
vim.keymap.set("n", "<leader>pp", ":lua Prove()<cr>")
vim.keymap.set("n", "<leader>op", ":lua Run()<cr>")
-- @name setup_ada
-- @param
-- @short Verify installation of ada tools or install them.
local function setup_ada()
vim.keymap.set("n", "<leader>cb", ":!gnatpp %<cr>")
vim.opt.tabstop = 3
vim.opt.shiftwidth = 3
end
-- Setup and verify ada tools when opening a ada file
vim.api.nvim_create_autocmd({ "BufEnter" }, {
pattern = { "*.adb", "*.ads" },
callback = setup_ada,
})
-- @name leave_ada
-- @param
-- @short Leave ada and reverse any changes to my editor defaults
local function leave_ada()
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
end
vim.api.nvim_create_autocmd({ "BufLeave" }, {
pattern = { "*.adb", "*.ads" },
callback = leave_ada,
})

View File

@ -1,130 +0,0 @@
-- menuone: show also for just one code suggestion
-- noinsert: only insert text when selection confirmed
-- noselect: force to select from suggestion
-- preview: show more details
vim.opt.completeopt = { "menu", "menuone" }
-- shortmess is used to reduce verbocity
-- vim.opt.shortmess = vim.opt.shortmess + { c = true }
local cmp = require("cmp")
cmp.setup({
-- configuration
snippet = {
expand = function(args)
vim.fn["UltiSnips#Anon"](args.body)
end,
},
-- Add borders to the windows
view = {
entries = "custom",
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
-- experimental settings
experimental = {
ghost_text = {},
},
-- mapping
mapping = cmp.mapping.preset.insert({
-- Shift+TAB to go to the Previous Suggested item
["<C-k>"] = cmp.mapping.select_prev_item(),
-- Tab to go to the next suggestion
["<C-j>"] = cmp.mapping.select_next_item(),
-- CTRL+SHIFT+f to scroll backwards in description
["<C-S-f>"] = cmp.mapping.scroll_docs(-4),
-- CTRL+F to scroll forwards in the description
["<C-f>"] = cmp.mapping.scroll_docs(4),
-- CTRL+SPACE to bring up completion at current Cursor location
["<C-Space>"] = cmp.mapping.complete(),
-- CTRL+e to exit suggestion and close it
["<C-d>"] = cmp.mapping.close(), -- TODO: Search better option
-- CR (enter or return) to CONFIRM the currently selection suggestion
-- We set the ConfirmBehavior to insert the Selected suggestion
["<CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert,
select = true,
}),
}),
-- installed sources for code suggestion
sources = cmp.config.sources({
{ name = "ultisnips", keyword_length = 1 },
{ name = "path" },
{ name = "nvim_lsp", keyword_length = 2 },
{ name = "nvim_lsp_signature_help" },
{ name = "nvim_lua", keyword_length = 2 },
{ name = "buffer", keyword_length = 2 },
{ name = "calc" },
{ name = "lua-latex-symbols", option = { cache = true } },
{ name = "cmp_tabnine", keyword_length = 20 },
-- { name = "fuzzy_buffer", keyword_length = 4 },
}),
-- add formatting of the different sources
formatting = {
fields = { "menu", "abbr", "kind" },
format = function(entry, item)
local menu_icon = {
ultisnips = "Φ",
nvim_lsp = "λ",
path = "󰴠",
calc = "Σ",
buffer = "",
lualatexsymbols = "󰿈",
spell = "󰘝",
fuzzy_buffer = "",
cmp_tabnine = "🖳",
}
item.menu = menu_icon[entry.source.name]
return item
end,
},
})
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline({ "/", "?" }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "buffer" },
{ name = "fuzzy_path", keyword_length = 4 },
},
formatting = {
fields = { "menu", "abbr", "kind" },
format = function(entry, item)
local menu_icon = {
buffer = "󰱼",
fuzzy_path = "",
}
item.menu = menu_icon[entry.source.name]
return item
end,
},
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" },
{ name = "cmdline_history", keyword_length = 24 },
}, {
{ name = "cmdline", keyword_length = 1 },
}),
formatting = {
fields = { "menu", "abbr", "kind" },
format = function(entry, item)
local menu_icon = {
path = "󰙅",
cmdline = "",
cmdline_history = "󰂺 ",
}
item.menu = menu_icon[entry.source.name]
return item
end,
},
})

View File

@ -1,92 +0,0 @@
-- Utilities for creating configurations
local util = require("formatter.util")
-- Provides the Format, FormatWrite, FormatLock, and FormatWriteLock commands
require("formatter").setup({
-- Enable or disable logging
logging = true,
-- Set the log level
log_level = vim.log.levels.WARN,
-- All formatter configurations are opt-in
filetype = {
-- Formatter configurations for filetype "lua" go here
-- and will be executed in order
lua = {
require("formatter.filetypes.lua").stylua,
},
c = {
require("formatter.filetypes.c").astyle,
},
cpp = {
require("formatter.filetypes.cpp").astyle,
},
html = {
require("formatter.filetypes.html").htmlbeautifier,
},
latex = {
require("formatter.filetypes.latex").latexindent,
},
markdown = {
require("formatter.filetypes.markdown").prettier,
},
tex = {
require("formatter.filetypes.latex").latexindent,
},
rust = {
require("formatter.filetypes.rust").rustfmt,
},
haskell = {
function()
-- Full specification of configurations is down below and in Vim help
-- files
return {
exe = "fourmolu",
args = {
util.escape_path(util.get_current_buffer_file_path()),
},
stdin = true,
}
end,
},
vhdl = {
function()
-- Full specification of configurations is down below and in Vim help
-- files
return {
exe = "vhdlfmt",
args = {
util.escape_path(util.get_current_buffer_file_path()),
},
stdin = true,
}
end,
},
-- Use the special "*" filetype for defining formatter configurations on
-- any filetype
["*"] = {
-- "formatter.filetypes.any" defines default configurations for any
-- filetype
require("formatter.filetypes.any").remove_trailing_whitespace,
},
},
})
-- Formatter autocommands
vim.cmd([[
augroup FormatAutogroup
autocmd!
autocmd BufWritePost * FormatWrite
augroup END
autocmd BufWritePost *.v lua vim.lsp.buf.format({ async = false })
]])

View File

@ -1,34 +0,0 @@
-- Ale configuration
vim.g.ale_linters_explicit = 0
local linters = {
python = { "pylint" },
vim = { "vint" },
cpp = { "clang" },
c = { "clang" },
markdown = { "languagetool" },
latex = { "proselint" },
tex = { "proselint" },
plaintex = { "proselint" },
ada = { "gnat", "gcc", "adals", "cspell" },
}
local fixers = {
ada = { "gnatpp" },
asm = { "gcc" },
bash = { "bashate" },
c = { "astyle" },
latex = { "texlab", "textlint" },
tex = { "textlint" },
lua = { "stylua" },
markdown = { "prettier", "pandoc" },
python = { "yapf" },
pascal = { "ptop" },
haskell = { "fourmolu" },
}
vim.g.ale_linters = linters
vim.g.ale_fix_on_save = 0
vim.g.ale_fixers = fixers
vim.keymap.set("n", "<leader>lf", ":ALEFix<CR>")
vim.keymap.set("n", "<leader>lp", ":ALEFindReferences<CR>")

View File

@ -1,90 +0,0 @@
-- Mason setup
require("mason").setup(require("mason").setup({
ui = {
icons = {
package_installed = "",
package_pending = "󰔟",
package_uninstalled = "",
},
},
}))
require("mason-lspconfig").setup({
ensure_installed = {
"lua_ls",
},
})
-- require("mason-lspconfig").setup_handlers({
-- function(asm_lsp)
-- require("lspconfig")[asm_lsp].setup({})
-- end,
-- function(clangd)
-- require("lspconfig")[clangd].setup({})
-- end,
-- function(lua_ls)
-- require("lspconfig")[lua_ls].setup({})
-- end,
-- function(hls)
-- require("lspconfig")[hls].setup({})
-- end,
-- function(rust_analyzer)
-- require("lspconfig")[rust_analyzer].setup({})
-- end,
-- function(vhdl_ls)
-- require("lspconfig")[vhdl_ls].setup({})
-- end,
-- function(verible)
-- require("lspconfig")[verible].setup({})
-- end,
-- function(vimls)
-- require("lspconfig")[vimls].setup({})
-- end,
-- function(texlab)
-- require("lspconfig")[texlab].setup({})
-- end,
-- function(als)
-- require("lspconfig")[als].setup({})
-- end,
-- })
require("lspconfig").verible.setup({
cmd = { "verible-verilog-ls", "--rules_config_search" },
})
-- @name file_exists
-- @param (name
-- @short Check if a file does exists (i. e. an ada project file)
local function file_exists(name)
local f = io.open(name, "r")
return f ~= nil and io.close(f)
end
-- @name get_config_file
-- @param
-- @short Get the configuration file.
local function get_config_file()
local filename = vim.api.nvim_buf_get_name(0)
local basedirectory = filename:gsub("/[^%/]-$", "")
local currentdirectory = filename:match("[^%/]-$")
if file_exists(basedirectory .. currentdirectory .. ".gpr") then
return basedirectory .. currentdirectory .. ".gpr"
else
basedirectory = basedirectory:gsub("/[^%/]-$", "")
currentdirectory = filename:match("[^%/]-$")
if file_exists(basedirectory .. currentdirectory .. ".gpr") then
return basedirectory .. currentdirectory .. ".gpr"
else
return "default.gpr"
end
end
end
require("lspconfig").als.setup({
settings = {
ada = {
projectFile = get_config_file(),
},
},
})

View File

@ -1,24 +0,0 @@
-- Bufstop
vim.keymap.set("n", "<M-w>", ":bdelete<CR>")
vim.keymap.set("n", "<C-y>", ":BufstopFast<CR>")
-- NERDTree Config
vim.g.NERDTreeShowHidden = 1
vim.keymap.set("n", "<C-e>", ":NERDTreeToggle<CR>")
-- Telescope snippet
local builtin = require("telescope.builtin")
vim.keymap.set("n", "<leader>ff", builtin.find_files, {})
vim.keymap.set("n", "<leader>fg", builtin.live_grep, {})
vim.keymap.set("n", "<c-f>", builtin.current_buffer_fuzzy_find, {})
vim.keymap.set("n", "<leader>fh", builtin.help_tags, {})
vim.keymap.set("n", "<leader>fc", builtin.commands, {})
-- Telescope + Ultisnips
require("telescope").load_extension("ultisnips")
vim.keymap.set("n", "<leader>fs", require("telescope").extensions.ultisnips.ultisnips, {})
-- Tagbar
vim.keymap.set("n", "<F8>", ":TagbarToggle<CR>") -- permanent window
vim.keymap.set("n", "<C-j>", ":TagbarOpenAutoClose<CR>") -- select, jump, close
vim.g.tagbar_autoclose = 0 -- do not autoclose after selection

View File

@ -1,56 +0,0 @@
-- Lua vim-dummy variable
if vim == nil then
local vim = {}
end
-- @name setup_pascal
-- @param
-- @short Verify installation of pascal tools or install them.
local function setup_pascal()
local check_ptop = { os.execute("which ptop") }
-- if return value is 1, get ptop
if check_ptop == 1 then
os.execute("wget -O ~/.local/bin/ptop https://www.nickr.eu/data/ptop64")
os.execute("chmod +x ~/.local/bin/ptop")
end
vim.opt.spell = false
end
-- Setup and verify pascal tools when opening a pascal file
vim.api.nvim_create_autocmd({ "BufEnter" }, {
pattern = { "*.pas" },
callback = setup_pascal,
})
-- @name leave_pascal
-- @param
-- @short Leave pascal and reverse any changes to my editor defaults
local function leave_pascal()
vim.opt.spell = true
end
vim.api.nvim_create_autocmd({ "BufLeave" }, {
pattern = { "*.pas" },
callback = leave_pascal,
})
-- @name auto_format
-- @param
-- @short The format function for pascal.
local function auto_format()
vim.cmd("checktime %")
local write_cmd = "ptop -i 4 -c ~/.config/nvim/ptop.conf "
.. vim.api.nvim_buf_get_name(0)
.. " "
.. vim.api.nvim_buf_get_name(0)
os.execute(write_cmd)
vim.cmd("checktime %")
end
-- Add formatter command
--vim.api.nvim_create_autocmd({ "BufWritePost" }, {
-- pattern = { "*.pas" },
-- callback = auto_format,
--})

6
lua/plug.lua Normal file
View File

@ -0,0 +1,6 @@
local builtin = require("telescope.builtin")
--vim.keymap.set("n", "<leader>ff", builtin.find_files, {})
--vim.keymap.set("n", "<leader>fg", builtin.live_grep, {})
--vim.keymap.set("n", "<c-f>", builtin.current_buffer_fuzzy_find, {})
--vim.keymap.set("n", "<leader>fh", builtin.help_tags, {})
--vim.keymap.set("n", "<leader>fc", builtin.commands, {})

View File

@ -1,60 +0,0 @@
-- VHDL mode (Vanilla with shell interaction)
require("vhdl_mode")
-- Formatter configuration
require("formatterconfiguration")
-- Code completion
require("code-completion")
-- Snippet configuration (Ultisnips)
require("snippetconfiguration")
-- ALE configuration
require("linterconfiguration")
-- Navigation and jumping configuration
require("navigation")
-- Mason and builtin lsp configuration
require("lspconfiguration")
-- Pascal mode (supported by plugins)
require("pascal_mode")
-- Ada mode (supported by plugins)
require("ada_mode")
-- Markdown Preview
vim.g.mkdp_auto_start = 0
vim.g.mkdp_browser = "epiphany"
vim.g.mkdp_echo_preview_url = 1
-- Misc configuration
if vim == nil then
vim = {}
end
-- Update function and call
function Update_Sys()
--vim.cmd("TSUpdate")
vim.cmd("MasonUpdate")
vim.cmd("Lazy sync")
end
vim.keymap.set("n", "<M-u>", ":lua Update_Sys()<CR>")
-- Lexima
vim.g.lexima_enable_basic_rules = 1
vim.g.lexima_enable_newline_rules = 1
-- Git-Blame configuration
vim.g.gitblame_message_template = " => <author> • <date> • <summary>"
vim.g.gitblame_date_format = "%r"
-- Floating terminal
vim.keymap.set("n", "<C-t>", ":FloatermNew --height=0.9 --width=0.9 --wintype=float --name=terminal <CR>")
-- Set default colorscheme
-- vim.cmd("colo vim-monokai-tasty")
vim.cmd("colo vim-monokai-tasty")

View File

@ -1,154 +0,0 @@
return {
-- Behavior
"tpope/vim-surround",
"tpope/vim-speeddating",
"mg979/vim-visual-multi",
"SirVer/UltiSnips",
"cohama/lexima.vim",
"voldikss/vim-floaterm",
"https://git.nickr.eu/yannickreiss/nvim-sourcer.git",
-- Navigation
"preservim/nerdtree",
"Xuyuanp/nerdtree-git-plugin",
"mihaifm/bufstop",
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release",
},
{ "tzachar/fuzzy.nvim", requires = { "nvim-telescope/telescope-fzf-native.nvim" } },
"fhill2/telescope-ultisnips.nvim",
"preservim/tagbar",
-- Visuals
"vim-airline/vim-airline",
"vim-airline/vim-airline-themes",
"ryanoasis/vim-devicons",
"tiagofumo/vim-nerdtree-syntax-highlight",
{
"nvim-telescope/telescope.nvim",
tag = "0.1.5",
dependencies = { "nvim-lua/plenary.nvim" },
},
"nvim-tree/nvim-web-devicons",
{ "romgrk/barbar.nvim", wants = "nvim-web-devicons" },
"mhinz/vim-startify",
"p00f/nvim-ts-rainbow",
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
local configs = require("nvim-treesitter.configs")
configs.setup({
-- ensure_installed = { "c", "vim", "ada", "html", "python" },
sync_install = false,
highlight = { enable = true },
indent = { enable = true },
rainbow = {
enable = true,
extended_mode = true,
max_file_lines = 3000,
},
})
end,
},
"dense-analysis/ale",
"f-person/git-blame.nvim",
"dstein64/vim-startuptime",
"hiphish/rainbow-delimiters.nvim",
{
"iamcco/markdown-preview.nvim",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
build = "cd app && npm install",
init = function()
vim.g.mkdp_filetypes = { "markdown" }
end,
ft = { "markdown" },
},
-- Themes
"folke/tokyonight.nvim",
"patstockwell/vim-monokai-tasty",
"hiroakis/cyberspace.vim",
"jaredgorski/spacecamp",
{
"scottmckendry/cyberdream.nvim",
lazy = false,
priority = 1000,
},
-- Code completion / Menu
"hrsh7th/nvim-cmp",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-nvim-lsp-signature-help",
"hrsh7th/cmp-path",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-calc",
"hrsh7th/cmp-cmdline",
"dmitmel/cmp-cmdline-history",
"amarakon/nvim-cmp-lua-latex-symbols",
"f3fora/cmp-spell",
{ "tzachar/cmp-fuzzy-buffer", requires = { "hrsh7th/nvim-cmp", "tzachar/fuzzy.nvim" } },
"quangnguyen30192/cmp-nvim-ultisnips",
-- LSP / Formatter
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"neovim/nvim-lspconfig",
"mfussenegger/nvim-dap",
"mhartington/formatter.nvim",
{ "TamaMcGlinn/nvim-lspconfig-ada" },
"sainnhe/sonokai",
-- Plugins to test
"https://git.nickr.eu/yannickreiss/nvim-macrotool.git",
-- Wiki
{
"echaya/neowiki.nvim",
opts = {
wiki_dirs = {
-- neowiki.nvim supports both absolute and relative paths
{ name = "Personal", path = "~/.wiki" },
{ name = "RiscVar", path = "~/Documents/HSRM/riscvar.wiki" },
{ name = "Ada/Spark", path = "~/Documents/Science/ada_spark_wiki" },
{ name = "FPGA Book", path = "~/Documents/Science/FPGA_Design" },
{ name = "Spark-Shell", path = "~/Documents/Programming/spark/spark_shell/spark_shell.wiki" },
},
},
keys = {
{ "<leader>ww", "<cmd>lua require('neowiki').open_wiki()<cr>", desc = "Open Wiki" },
{ "<leader>wW", "<cmd>lua require('neowiki').open_wiki_floating()<cr>", desc = "Open Floating Wiki" },
{ "<leader>wT", "<cmd>lua require('neowiki').open_wiki_new_tab()<cr>", desc = "Open Wiki in Tab" },
},
},
-- Lean
{
"Julian/lean.nvim",
event = { "BufReadPre *.lean", "BufNewFile *.lean" },
dependencies = {
"neovim/nvim-lspconfig",
"nvim-lua/plenary.nvim",
-- optional dependencies:
-- a completion engine
-- hrsh7th/nvim-cmp or Saghen/blink.cmp are popular choices
-- 'nvim-telescope/telescope.nvim', -- for 2 Lean-specific pickers
-- 'andymass/vim-matchup', -- for enhanced % motion behavior
-- 'andrewradev/switch.vim', -- for switch support
-- 'tomtom/tcomment_vim', -- for commenting
},
---@type lean.Config
opts = { -- see below for full configuration options
mappings = true,
},
},
}

View File

@ -1,5 +0,0 @@
vim.g.UltiSnipsExpandTrigger = "<tab>"
vim.g.UltiSnipsJumpForwardTrigger = "<c-l>"
vim.g.UltiSnipsJumpBackwardTrigger = "<c-h>"
vim.g.UltiSnipsEditSplit = "vertical"
vim.g.UltiSnipsSnippetDirectories = { "~/.config/nvim/UltiSnips" }

View File

@ -1,12 +0,0 @@
-- in tools.lua
local api = vim.api
local M = {}
function M.makeScratch()
vim.bo[0].buftype = nofile -- set the current buffer's (buffer 0) buftype to nofile
vim.bo[0].bufhidden = hide
vim.bo[0].swapfile = false
end
return M

View File

@ -1,105 +0,0 @@
-- Filetypes and compatibility
vim.opt.compatible = false
vim.cmd("filetype on")
vim.cmd("filetype plugin on")
vim.cmd("syntax on")
-- Spell
vim.opt.spell = true
vim.opt.spl = "en_us,de_de"
vim.opt.sps = "fast,timeout:100"
-- Editor configuration
vim.opt.number = true
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.splitright = true
vim.opt.splitbelow = true
vim.opt.relativenumber = false
vim.g.mapleader = ","
vim.cmd("set clipboard+=unnamedplus")
vim.cmd("autocmd! CursorHold,CursorHoldI *.md write")
vim.cmd("set autoread")
-- GUI
vim.opt.cursorline = true
vim.opt.hlsearch = true
vim.opt.encoding = "UTF-8"
vim.g.tex_flavor = "latex"
vim.opt.conceallevel = 2
vim.opt.showmatch = true
-- set color scheme
vim.opt.termguicolors = true
vim.cmd("colorscheme slate")
vim.keymap.set("n", "<M-+>", ":colo tokyonight-day<CR>")
vim.keymap.set("n", "<M-->", ":colo tokyonight-night<CR>")
-- vim.opt.mouse = ""
-- set copy mode
vim.keymap.set("n", "<leader>ll", ":set nonumber<cr>")
vim.keymap.set("n", "<leader>lm", ":set number<cr>")
-- switch mode
vim.keymap.set("n", "<leader>na", ":set norelativenumber<cr>")
vim.keymap.set("n", "<leader>nr", ":set relativenumber<cr>")
-- Nix mode
local nix_interpreter_buffer = -1
local nix_interpreter_window = -1
-- @name run_nix_interpreter
-- @param
-- @short Run nix and output to a buffer on the right
local function run_nix_interpreter()
local original_win = vim.api.nvim_get_current_win()
vim.cmd("vsplit")
nix_interpreter_buffer = vim.api.nvim_create_buf(false, true)
vim.api.nvim_win_set_buf(0, nix_interpreter_buffer)
nix_interpreter_window = vim.api.nvim_get_current_win()
vim.api.nvim_set_current_win(original_win)
end
-- @name update_nix_interpreter
-- @param
-- @short Run nix enterpreter on that file.
local function update_nix_interpreter()
local filename = vim.api.nvim_buf_get_name(0)
if filename == "" then
vim.api.nvim_buf_set_lines(nix_interpreter_buffer, 0, -1, false, {
"Error: Current buffer has no file name.",
})
return
end
local cmd = { "nix-instantiate", "--eval", "--strict", filename }
local output = vim.fn.systemlist(cmd)
if vim.v.shell_error ~= 0 then
table.insert(output, 1, "Error running nix-instantiate:")
end
vim.api.nvim_buf_set_lines(nix_interpreter_buffer, 0, -1, false, output)
end
-- @name close_nix_interpreter
-- @param
-- @short Closes the window and buffer of the interpreter
local function close_nix_interpreter()
vim.api.nvim_buf_delete(nix_interpreter_buffer, { unload = true })
vim.api.nvim_win_close(nix_interpreter_window, true)
end
vim.api.nvim_create_autocmd({ "BufEnter" }, {
pattern = { "*.nix" },
callback = run_nix_interpreter,
})
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
pattern = { "*.nix" },
callback = update_nix_interpreter,
})
vim.api.nvim_create_autocmd({ "BufLeave" }, {
pattern = { "*.nix" },
callback = close_nix_interpreter,
})

View File

@ -1,13 +0,0 @@
-- vim dummy assignment for the lsp
if vim == nil then
local vim = {}
end
-- Setup the formatter for VHDL
-- Download for current platform type if not already present
local check_formatter = { os.execute("which ~/.local/bin/vhdlfmt") }
if check_formatter == 1 then
-- setup the formatter here
os.execute("wget -O ~/.local/bin/vhdlfmt https://www.nickr.eu/data/vhdlfmt")
os.execute("chmod +x ~/.local/bin/vhdlfmt")
end

View File

@ -1,98 +0,0 @@
end=crbefore,dindonkey,dindent,crafter,capital
[end]=if,then,else,while,with,for,record,try,finally,except,class,object,private,public,protected,published,casevar,colon,equals
begin=crbefore,dindonkey,inbytab,crafter,capital
[begin]=var,label,const,type
if=spaft,gobsym,inbytab,capital
then=capital
else=crbefore,dindonkey,inbytab,capital
[else]=if,then,else
proc=dindonkey,spaft,capital
[proc]=var,label,const,type
var=blinbefore,dindonkey,spaft,inbytab,capital
[var]=var,label,const,type
of=crsupp,spbef,spaft,capital
while=spaft,gobsym,inbytab,crafter,capital
do=crsupp,spbef,capital
case=spaft,gobsym,inbytab,crafter,capital
with=spaft,gobsym,inbytab,crafter,capital
for=spaft,gobsym,inbytab,crafter,capital
repeat=inbytab,crafter,capital
until=crbefore,dindonkey,dindent,spaft,gobsym,crafter,capital
[until]=if,then,else,while,with,for,colon,equals
func=dindonkey,spaft,capital
[func]=var,label,const,type
label=blinbefore,spaft,inbytab,capital
const=blinbefore,dindonkey,spaft,inbytab,capital
[const]=var,label,const,type
type=blinbefore,dindonkey,spaft,inbytab,capital
[type]=var,label,const,type
record=inbyindent,crafter,capital
[record]=end
string=
prog=blinbefore,spaft,capital
asm=
try=crbefore,inbytab,crafter,capital
finally=crbefore,dindent,inbytab,crafter,capital
[finally]=try
except=crbefore,dindent,inbytab,crafter,capital
[except]=try
raise=
class=inbyindent,capital
object=inbyindent,capital
constructor=
destructor=
inherited=
property=
private=crbefore,dindonkey,spaft,inbytab,capital
[private]=end,private,public,protected,published
public=crbefore,dindonkey,spaft,inbytab,capital
[public]=end,private,public,protected,published
protected=crbefore,dindonkey,spaft,inbytab,capital
[protected]=end,private,public,protected,published
published=crbefore,dindonkey,spaft,inbytab,capital
[published]=end,private,public,protected,published
initialization=
finalization=
inline=
library=blinbefore,spaft,capital
interface=blinbefore,crafter,capital
implementation=blinbefore,dindonkey,crafter,capital
[implementation]=end,var,label,const,type,property
read=
write=
unit=blinbefore,spaft,capital
and=
arr=
div=
down=
file=
goto=
in=
mod=
not=
nil=
or=
set=
to=
virtual=
uses=blinbefore,spaft,capital
casevar=spaft,gobsym,inbytab,crafter,capital
ofobject=
becomes=spbef,spaft,gobsym,capital
notequal=
lessorequal=
greaterorequal=
delphicomment=crafter
dopencomment=
dclosecomment=
opencomment=crsupp,capital
closecomment=crsupp,capital
semicolon=crsupp,dindonkey,crafter,capital
[semicolon]=if,then,else,while,with,for,colon,equals
colon=inbytab,capital
equals=spbef,spaft,inbytab,capital
openparen=gobsym,capital
closeparen=
period=crsupp,capital
endoffile=
other=

View File

@ -351,30 +351,3 @@ Instagram
Tablet Tablet
Abschwington Abschwington
BerndDasBot BerndDasBot
Frameworks
Tuples
structs
make
IoT
json
Request
Dictionary
Everything
Disclaimer
linuxspezifischen
linuxspezifischen
cron
false
true
boolsche
bash
zsh
sockets
requests
otwendige
ptionale
utomatischer
anueller
nickr
eu
email

Binary file not shown.

View File

@ -171,5 +171,3 @@ gcc
linux linux
chibicc chibicc
chibi chibi
readonly
extern

Binary file not shown.

37
vim/init.vim Normal file
View File

@ -0,0 +1,37 @@
set nocompatible
filetype on
filetype plugin on
syntax on
set number
set tabstop=4
set shiftwidth=4
set showmatch
set hlsearch
set cursorline
colorscheme desert
set splitright
set splitbelow
set completeopt=menuone,preview
set clipboard+=unnamedplus
set expandtab
set conceallevel=2
set termguicolors
let g:mapleader=","
let g:tex_flavor="latex"
function OpenTerm()
10 split
terminal
endfunction
nnoremap <C-t> :call OpenTerm()<CR>
autocmd VimEnter * set spell spelllang=en_us
function Litde()
set spell spelllang=de_de
endfunction
function Liten()
set spell spelllang=en_us
endfunction
nnoremap <M-e> :call Liten()<CR>
nnoremap <M-g> :call Litde()<CR>

34
vim/plug.vim Normal file
View File

@ -0,0 +1,34 @@
call plug#begin('~/.vim/plugged')
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'preservim/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.5' }
Plug 'tpope/vim-surround'
Plug 'tpope/vim-speeddating'
Plug 'mhinz/vim-startify'
Plug 'dstein64/vim-startuptime'
Plug 'hiroakis/cyberspace.vim'
Plug 'mhinz/vim-startify'
Plug 'dstein64/vim-startuptime'
Plug 'SirVer/ultisnips'
call plug#end()
function Update_sys()
PlugUpdate
endfunction
nmap <C-u> :call Update_sys()<CR>
" NERDTree config
let g:NERDTreeShowHidden = 1
let g:NERDTreeDirArrowExpandable = "▸"
let g:NERDTreeDirArrowCollapsible = "▾"
nmap <C-e> :NERDTreeToggle<CR>
" UltiSnips config
let g:UltiSnipsExpandTrigger = "<tab>"
let g:UltiSnipsJumpForwardTrigger = "<c-l>"
let g:UltiSnipsJumpBackwardTrigger = "<c-h>"
let g:UltiSnipsEditSplit = "vertical"
let g:UltiSnipsSnippetDirectories = [ "~/.config/nvim/UltiSnips" ]

View File

@ -1,32 +0,0 @@
" various tools inside vim
function! GetCharUnderCursor()
let line = getline('.')
let col = col('.')
return line[col - 1]
endfunction
" predefined macros in functions
function SpacedLine()
normal o
normal O
normal O
normal j
endfunction
function SwapWords()
normal dw
normal e
exec 'normal! a '
normal p
normal l
let char = GetCharUnderCursor()
if char == ' '
normal x
endif
normal h
normal b
normal b
endfunction
let @o = ':call SpacedLine() '
let @s = ':call SwapWords() '