initial(ish) commit

This commit is contained in:
Philipp Hochkamp 2022-03-01 23:53:11 +01:00
commit b744693f0e
No known key found for this signature in database
GPG key ID: 3676AB4CB36E5641
88 changed files with 4925 additions and 0 deletions

View file

@ -0,0 +1,51 @@
{
"suggest.triggerCompletionWait": 50,
"suggest.enablePreview": true,
"html.enable": true,
"python.linting.enabled": true,
"html.format.enable": true,
"html.suggest.html5": true,
"html.suggest.ionic": true,
"html.validate.html": true,
"html.validate.styles": true,
"diagnostic-languageserver.mergeConfig": true,
"diagnostic-languageserver.filetypes": {
"vim": "vint",
"sh": "shellcheck",
"markdown": "write-good"
},
"diagnostic-languageserver.formatFiletypes": {
"sh": "shfmt"
},
"tabnine.disable_filetypes": ["pandoc"],
"flutter.provider.hot-reload": true,
"flutter.provider.enableSnippet": true,
"snippets.ultisnips.direcories": ["snippets"],
"rust-analyzer.procMacro.enable": true,
"rust-analyzer.cargo.allFeatures": true,
"rust-analyzer.inlayHints.refreshOnInsertMode": true,
"rust-analyzer.updates.channel": "nightly",
"html.validate.scripts": true,
"git.gitlab.hosts": [
"gitlab.com"
],
"git.addGBlameToVirtualText": true,
"languageserver": {
"nix": {
"command": "rnix-lsp",
"filetypes": [
"nix"
]
},
"terraform": {
"command": "terraform-ls",
"args": ["serve"],
"filetypes": [
"terraform",
"tf"
],
"initializationOptions": {},
"settings": {}
}
}
}

View file

@ -0,0 +1,145 @@
if system('id -u') > 500
let g:coc_global_extensions = [ 'coc-markdownlint', 'coc-diagnostic', 'coc-angular', 'coc-css', 'coc-docker', 'coc-flutter-tools', 'coc-git', 'coc-homeassistant', 'coc-html', 'coc-json', 'coc-marketplace', 'coc-prettier', 'coc-pyright', 'coc-rls', 'coc-rust-analyzer', 'coc-scssmodules', 'coc-sh', 'coc-snippets', 'coc-stylelintplus', 'coc-swagger', 'coc-tabnine', 'coc-eslint', 'coc-tsserver', 'coc-webpack', 'coc-yaml' ]
endif
" \coc Some servers have issues with backup files, see #649.
set nobackup
set nowritebackup
" \coc Don't pass messages to |ins-completion-menu|.
set shortmess+=c
" \coc Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved.
set signcolumn=number
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" c-space to trigger completion
inoremap <silent><expr> <c-space> coc#refresh()
" Make <CR> auto-select the first completion item and notify coc.nvim to
" format on enter, <cr> could be remapped by other vim plugin
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
" Use `[g` and `]g` to navigate diagnostics
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Use K to show documentation in preview window.
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
elseif (coc#rpc#ready())
call CocActionAsync('doHover')
else
execute '!' . &keywordprg . " " . expand('<cword>')
endif
endfunction
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
" Symbol renaming.
nmap <leader>rn <Plug>(coc-rename)
" coc snippets
" Use <C-l> for trigger snippet expand.
imap <C-l> <Plug>(coc-snippets-expand)
" Use <C-j> for select text for visual placeholder of snippet.
vmap <C-j> <Plug>(coc-snippets-select)
" Use <C-j> for jump to next placeholder, it's default of coc.nvim
let g:coc_snippet_next = '<c-j>'
" Use <C-k> for jump to previous placeholder, it's default of coc.nvim
let g:coc_snippet_prev = '<c-k>'
" Use <C-j> for both expand and jump (make expand higher priority.)
imap <C-j> <Plug>(coc-snippets-expand-jump)
" Use <leader>x for convert visual selected code to snippet
xmap <leader>x <Plug>(coc-convert-snippet)
" Formatting selected code.
xmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected)
augroup mygroup
autocmd!
" Setup formatexpr specified filetype(s).
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
" Update signature help on jump placeholder.
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end
" Applying codeAction to the selected region.
" Example: `<leader>aap` for current paragraph
xmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)
" Remap keys for applying codeAction to the current buffer.
nmap <leader>ac <Plug>(coc-codeaction)
" Apply AutoFix to problem on the current line.
nmap <leader>qf <Plug>(coc-fix-current)
nmap <leader>f :CocFix<CR>
" Map function and class text objects
" NOTE: Requires 'textDocument.documentSymbol' support from the language server.
xmap if <Plug>(coc-funcobj-i)
omap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap af <Plug>(coc-funcobj-a)
xmap ic <Plug>(coc-classobj-i)
omap ic <Plug>(coc-classobj-i)
xmap ac <Plug>(coc-classobj-a)
omap ac <Plug>(coc-classobj-a)
" Remap <C-f> and <C-b> for scroll float windows/popups.
nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
" Use CTRL-S for selections ranges.
" Requires 'textDocument/selectionRange' support of language server.
nmap <silent> <C-a> <Plug>(coc-range-select)
xmap <silent> <C-a> <Plug>(coc-range-select)
" Add `:Format` command to format current buffer.
command! -nargs=0 Format :call CocAction('format')
" Add `:Fold` command to fold current buffer.
command! -nargs=? Fold :call CocAction('fold', <f-args>)
" Add `:OR` command for organize imports of the current buffer.
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
" Mappings for CoCList
" Show all diagnostics.
nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr>
" Manage extensions.
nnoremap <silent><nowait> <space>e :<C-u>CocList extensions<cr>
" Show commands.
nnoremap <silent><nowait> <space>c :<C-u>CocList commands<cr>
" Find symbol of current document.
nnoremap <silent><nowait> <space>o :<C-u>CocList outline<cr>
" Search workspace symbols.
nnoremap <silent><nowait> <space>s :<C-u>CocList -I symbols<cr>
" Do default action for next item.
nnoremap <silent><nowait> <space>j :<C-u>CocNext<CR>
" Do default action for previous item.
nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR>
" Resume latest coc list.
nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR>

View file

@ -0,0 +1,47 @@
require('utils')
require('keybindings')
require('filetypes')
local opt = vim.opt
-- load plugin luas (idk how to do that autmagically)
require('plugin.nnn')
require('plugin.rainbow')
require('plugin.terminal')
-- plugins - coc
vim.cmd 'source /etc/nvim/coc.vim' -- too lazy to convert all the shit to lua
-- terminal
vim.cmd 'source /etc/nvim/terminal.vim' -- too lazy to convert all the shit to lua
-- color stuff
vim.g.gruvbox_italic = 1
vim.cmd ':colorscheme gruvbox'
opt.termguicolors = true -- 24bit color
opt.background = 'dark' -- dark gruvbox
-- general settings
vim.cmd [[
filetype plugin on
filetype indent plugin on
filetype plugin indent on
syntax on
]]
opt.encoding = 'utf-8'
opt.number = true
opt.relativenumber = true
opt.undofile = true -- save undo chages even after computer restart
opt.showcmd = true -- show (partial) command in status line
opt.showmatch = true -- show match brackets
opt.wildmenu = true -- visual autocomplete for command menu
-- Splits open at the bottom and right, which is non-retarded, unlike vim defaults.
opt.splitbelow = true
opt.splitright = true
-- indents
opt.expandtab = true
opt.shiftwidth = 2
opt.softtabstop = 2
-- buffers don't get unloaded when hidden
opt.hidden = true
-- low updatetime so it isnt as slow
opt.updatetime = 200
require('plugin.lualine')

View file

@ -0,0 +1,3 @@
vim.cmd [[
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
]]

View file

@ -0,0 +1,45 @@
local map = require('utils').map
-- split binds
map { 'n', '<A-h>', ':vertical resize -5<CR>', noremap = true, silent = true}
map { 'n', '<A-l>', ':vertical resize +5<CR>', noremap = true, silent = true}
map { 'n', '<A-j>', ':resize -5<CR>', noremap = true, silent = true}
map { 'n', '<A-k>', ':resize +5<CR>', noremap = true, silent = true}
map { 'n', '<A-=>', '<C-w> =', noremap = true, silent = true}
map { 'n', '<A-s>', ':vsp<CR>', noremap = true, silent = true}
map { 'n', '<C-s>', ':split<CR>', noremap = true, silent = true}
map { 'n', '<C-h>', '<C-w>h', noremap = true, silent = true}
map { 'n', '<C-j>', '<C-w>j', noremap = true, silent = true}
map { 'n', '<C-k>', '<C-w>k', noremap = true, silent = true}
map { 'n', '<C-l>', '<C-w>l', noremap = true, silent = true}
-- buffer binds
map { 'n', ',q', ':bd<CR>', noremap = false, silent = true}
map { 'n', ',b', ':Buffers<CR>', noremap = false, silent = true}
-- tab binds
map { 'n', '<C-t>', ':tabnew<CR>', noremap = false, silent = true}
-- copy paste
map { 'v', '<C-c>', '"+y', noremap = true, silent = true}
map { 'n', '<C-b>', '"+P', noremap = false, silent = true}
map { 'n', '<C-p>', ':registers<CR>', noremap = true, silent = true}
-- sudo :w
map { 'c', 'w!!', 'w !sudo tee > /dev/null %', noremap = false, silent = false}
-- terminal
map { 'n', '<leader>t', ':term<CR>', noremap = false, silent = true}
map { 't', '<C-b>', '<C-\\><C-n>', noremap = true, silent = true}
-- plugins - commentary
map { 'n', '<leader>c', ':Commentary<CR>', noremap = false, silent = true}
-- plugins - vista
map { 'n', '<leader>v', ':Vista!!<CR>', noremap = false, silent = true}
-- plugins - nnn
map { 'n', '<tab>', '::NnnPicker %:p:h<CR>', noremap = true, silent = true}
-- plugins - terminal
map {"n", "<leader>l", "<cmd>lua _lazygit_toggle()<CR>", {noremap = true, silent = true}}

View file

@ -0,0 +1,28 @@
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'gruvbox',
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
disabled_filetypes = {},
always_divide_middle = true,
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {'filename'},
lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
tabline = {},
extensions = {}
}

View file

@ -0,0 +1,11 @@
require('nnn').setup({
set_default_mappings = 0,
replace_netrw = 1,
layout = {
window = {
width = 0.9,
height = 0.6,
highlight = 'Debug'
}
}
})

View file

@ -0,0 +1 @@
vim.g.rainbow_active = 1

View file

@ -0,0 +1,22 @@
require('toggleterm').setup {
direction = 'window',
open_mapping = [[<c-n>]],
}
local Terminal = require('toggleterm.terminal').Terminal
local lazygit = Terminal:new {
cmd = "lazygit",
hidden = true,
direction = 'float'
}
function _lazygit_toggle()
lazygit:toggle()
end
-- local pipeline = Terminal:new {
-- cmd = "glab ci view",
-- hidden = true,
-- direction = 'float'
-- }

View file

@ -0,0 +1,21 @@
-- cool map funciton from https://vonheikemen.github.io/devlog/tools/configuring-neovim-using-lua/
utils = {}
utils.map = function(key)
-- get the extra options
local opts = {noremap = false}
for i, v in pairs(key) do
if (i) == 'string' then opts[i] = v end
end
-- basic support for buffer-scoped keybindings
local buffer = opts.buffer
opts.buffer = nil
if buffer then
vim.api.nvim_buf_set_keymap(0, key[1], key[2], key[3], opts)
else
vim.api.nvim_set_keymap(key[1], key[2], key[3], opts)
end
end
return utils

View file

@ -0,0 +1,121 @@
# This file contains snippets that are always defined. I personally
# have snippets for signatures and often needed texts
# sligthly lower priority than everything else since specialized versions
# should overwrite. The user needs to adjust her priority in her snippets to
# ~-55 so that other filetypes will still overwrite.
priority -60
global !p
def _parse_comments(s):
""" Parses vim's comments option to extract comment format """
i = iter(s.split(","))
rv = []
try:
while True:
# get the flags and text of a comment part
flags, text = next(i).split(':', 1)
if len(flags) == 0:
rv.append(('OTHER', text, text, text, ""))
# parse 3-part comment, but ignore those with O flag
elif 's' in flags and 'O' not in flags:
ctriple = ["TRIPLE"]
indent = ""
if flags[-1] in string.digits:
indent = " " * int(flags[-1])
ctriple.append(text)
flags, text = next(i).split(':', 1)
assert flags[0] == 'm'
ctriple.append(text)
flags, text = next(i).split(':', 1)
assert flags[0] == 'e'
ctriple.append(text)
ctriple.append(indent)
rv.append(ctriple)
elif 'b' in flags:
if len(text) == 1:
rv.insert(0, ("SINGLE_CHAR", text, text, text, ""))
except StopIteration:
return rv
def get_comment_format():
""" Returns a 4-element tuple (first_line, middle_lines, end_line, indent)
representing the comment format for the current file.
It first looks at the 'commentstring', if that ends with %s, it uses that.
Otherwise it parses '&comments' and prefers single character comment
markers if there are any.
"""
commentstring = vim.eval("&commentstring")
if commentstring.endswith("%s"):
c = commentstring[:-2]
return (c, c, c, "")
comments = _parse_comments(vim.eval("&comments"))
for c in comments:
if c[0] == "SINGLE_CHAR":
return c[1:]
return comments[0][1:]
endglobal
##########################
# LOREM IPSUM GENERATORS #
##########################
snippet lorem "Lorem Ipsum - 50 Words" b
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.
endsnippet
##########################
# VIM MODELINE GENERATOR #
##########################
# See advice on `:help 'tabstop'` for why these values are set. Uses second
# modeline form ('set') to work in languages with comment terminators
# (/* like C */).
snippet modeline "Vim modeline"
vim`!v ':set '. (&expandtab ? printf('et sw=%i ts=%i', &sw, &ts) : printf('noet sts=%i sw=%i ts=%i', &sts, &sw, &ts)) . (&tw ? ' tw='. &tw : '') . ':'`
endsnippet
#########
# DATES #
#########
snippet date "YYYY-MM-DD" w
`!v strftime("%Y-%m-%d")`
endsnippet
snippet ddate "DD.MM.YYYY" w
`!v strftime("%d.%m.%Y")`
endsnippet
snippet diso "ISO format datetime" w
`!v strftime("%Y-%m-%d %H:%M:%S%z")`
endsnippet
snippet time "hh:mm" w
`!v strftime("%H:%M")`
endsnippet
snippet datetime "YYYY-MM-DD hh:mm" w
`!v strftime("%Y-%m-%d %H:%M")`
endsnippet
snippet todo "TODO comment" bw
`!p snip.rv=get_comment_format()[0]` ${2:TODO}: $1 ${3: <${4:`!v strftime('%d.%m.%y %H:%M')`}${5:, `git config --get user.name`}>} `!p snip.rv=get_comment_format()[2]`
endsnippet
##########
# Misc #
##########
snippet uuid "Random UUID" w
`!p if not snip.c: import uuid; snip.rv = uuid.uuid4()`
endsnippet
# vim:ft=snippets:

View file

@ -0,0 +1,115 @@
# Snippets for Go
priority -50
# when to abbriviate and when not?
# b doesn't work here, because it ignores whitespace
# optional local name?
snippet /^import/ "Import declaration" r
import (
"${1:package}"
)
endsnippet
snippet /^package/ "Package declaration" r
// Package $1 provides ...
package ${1:main}
endsnippet
# Mostly converted from: https://github.com/AlanQuatermain/go-tmbundle
snippet /^cons/ "Constants declaration" r
const (
${1:constant}${2/(.+)/ /}${2:type} = ${0:value}
)
endsnippet
snippet /^con/ "Constant declaration" r
const ${1:name}${2/(.+)/ /}${2:type} = ${0:value}
endsnippet
snippet iota "Iota constant generator" b
const (
${1:constant}${2/(.+)/ /}${2:type} = iota
)
endsnippet
snippet struct "Struct declaration" b
type ${1:Struct} struct {
${0:${VISUAL}}
}
endsnippet
snippet interface "Interface declaration" b
type ${1:Interface} interface {
${0:${VISUAL}}
}
endsnippet
snippet if "If statement" b
if ${1:condition}${1/(.+)/ /}{
${0:${VISUAL}}
}
endsnippet
snippet switch "Switch statement" b
switch ${1:expression}${1/(.+)/ /}{
case$0
}
endsnippet
# functions
snippet /^main/ "Main function" r
func main() {
${0:${VISUAL}}
}
endsnippet
snippet /^meth/ "Method" r
func (${1:receiver} ${2:type}) ${3:name}(${4:params})${5/(.+)/ /}${5:type} {
${0:${VISUAL}}
}
endsnippet
snippet func "Function" b
func ${1:name}(${2:params})${3/(.+)/ /}${3:type} {
${0:${VISUAL}}
}
endsnippet
snippet funch "HTTP handler" b
func ${1:handler}(${2:w} http.ResponseWriter, ${3:r} *http.Request) {
${0:${VISUAL}}
}
endsnippet
# types and variables
snippet map "Map type" b
map[${1:keytype}]${2:valtype}
endsnippet
snippet : "Variable declaration :=" b
${1:name} := ${0:value}
endsnippet
snippet var "Variable declaration" b
var ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value}}
endsnippet
snippet vars "Variables declaration" b
var (
${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value} }
)
endsnippet
snippet json "JSON field"
\`json:"${1:displayName}"\`
endsnippet
# vim:ft=snippets:
# error handling
snippet err "Basic error handling" b
if err != nil {
log.${1:Fatal}(err)
}
endsnippet

View file

@ -0,0 +1,399 @@
###########################################################################
# TEXTMATE SNIPPETS #
###########################################################################
# Many of the snippets here use a global option called
# "g:ultisnips_java_brace_style" which, if set to "nl" will put a newline
# before '{' braces.
global !p
def junit(snip):
if snip.opt("g:ultisnips_java_junit", "") == "3":
snip += ""
else:
snip.rv += "@Test\n\t"
def nl(snip):
if snip.opt("g:ultisnips_java_brace_style", "") == "nl":
snip += ""
else:
snip.rv += " "
def getArgs(group):
import re
word = re.compile('[a-zA-Z><.]+ \w+')
return [i.split(" ") for i in word.findall(group) ]
def camel(word):
return word[0].upper() + word[1:]
endglobal
snippet sleep "try sleep catch" !b
try {
Thread.sleep(${1:1000});
} catch (InterruptedException e){
e.printStackTrace();
}
endsnippet
snippet /i|n/ "new primitive or int" !br
${1:int} ${2:i} = ${3:1};
$0
endsnippet
snippet /o|v/ "new Object or variable" !br
${1:Object} ${2:var} = new $1(${3});
endsnippet
snippet f "field" !b
${1:private} ${2:String} ${3:`!p snip.rv = t[2].lower()`};
endsnippet
snippet ab "abstract" b
abstract
endsnippet
snippet as "assert" b
assert ${1:test}${2/(.+)/(?1: \: ")/}${2:Failure message}${2/(.+)/(?1:")/};$0
endsnippet
snippet at "assert true" !b
assertTrue(${1:actual});
endsnippet
snippet af "assert false" !b
assertFalse(${1:actual});$0
endsnippet
snippet ae "assert equals" !b
assertEquals(${1:expected}, ${2:actual});
endsnippet
snippet br "break"
break;
endsnippet
snippet cs "case" b
case $1:
$2
$0
endsnippet
snippet ca "catch" b
catch (${1:Exception} ${2:e})`!p nl(snip)`{
$0
}
endsnippet
snippet cle "class extends" b
public class ${1:`!p
snip.rv = snip.basename or "untitled"`} ${2:extends ${3:Parent} }${4:implements ${5:Interface} }{
$0
}
endsnippet
snippet clc "class with constructor, fields, setter and getters"
public class `!p
snip.rv = snip.basename or "untitled"` {
`!p
import re
args = getArgs(t[1])
if len(args) == 0: snip.rv = ""
for i in args:
snip.rv += "\n\tprivate " + i[0] + " " + i[1]+ ";"
if len(args) > 0:
snip.rv += "\n"`
public `!p snip.rv = snip.basename or "unknown"`($1) { `!p
args = getArgs(t[1])
for i in args:
snip.rv += "\n\t\tthis." + i[1] + " = " + i[1] + ";"
if len(args) == 0:
snip.rv += "\n"`
}$0
`!p
args = getArgs(t[1])
if len(args) == 0: snip.rv = ""
for i in args:
snip.rv += "\n\tpublic void set" + camel(i[1]) + "(" + i[0] + " " + i[1] + ") {\n" + "\
\tthis." + i[1] + " = " + i[1] + ";\n\t}\n"
snip.rv += "\n\tpublic " + i[0] + " get" + camel(i[1]) + "() {\
\n\t\treturn " + i[1] + ";\n\t}\n"
`
}
endsnippet
snippet cl "class" b
public class ${1:`!p
snip.rv = snip.basename or "untitled"`} {
$0
}
endsnippet
snippet cos "constant string" b
public static final String ${1:var} = "$2";$0
endsnippet
snippet co "constant" b
public static final ${1:String} ${2:var} = $3;$0
endsnippet
snippet de "default" b
default:
$0
endsnippet
snippet elif "else if" b
else if ($1)`!p nl(snip)`{
$0
}
endsnippet
snippet else "else" b
else`!p nl(snip)`{
$0
}
endsnippet
snippet fi "final" b
final
endsnippet
snippet fore "for (each)" b
for ($1 : $2)`!p nl(snip)`{
$0
}
endsnippet
snippet fori "for with int i" b
for (int ${1:i} = 0; $1 < ${2:10}; $1++)`!p nl(snip)`{
$0
}
endsnippet
snippet for "for" b
for ($1; $2; $3)`!p nl(snip)`{
$0
}
endsnippet
snippet if "if" b
if ($1)`!p nl(snip)`{
$0
}
endsnippet
snippet imt "import junit_framework_TestCase;" b
import junit.framework.TestCase;
$0
endsnippet
snippet im "import" b
import ${1:java}.${2:util}.$0
endsnippet
snippet in "interface" b
interface ${1:`!p snip.rv = snip.basename or "untitled"`} ${2:extends ${3:Parent} }{
$0
}
endsnippet
snippet cc "constuctor call or setter body"
this.${1:var} = $1;
endsnippet
snippet list "Collections List" b
List<${1:String}> ${2:list} = new ${3:Array}List<$1>();
endsnippet
snippet map "Collections Map" b
Map<${1:String}, ${2:String}> ${3:map} = new ${4:Hash}Map<$1, $2>();
endsnippet
snippet set "Collections Set" !b
Set<${1:String}> ${2:set} = new ${3:Hash}Set<$1>();
endsnippet
snippet /Str?|str/ "String" !br
String
endsnippet
snippet cn "constructor, \w fields + assigments" b
`!p
import re
args = getArgs(t[1])
for i in args:
snip.rv += "\n\tprivate " + i[0] + " " + i[1]+ ";"
if len(args) > 0:
snip.rv += "\n"`
public `!p snip.rv = snip.basename or "unknown"`($1) { `!p
args = getArgs(t[1])
for i in args:
snip.rv += "\n\t\tthis." + i[1] + " = " + i[1]
if len(args) == 0:
snip.rv += "\n"`
}
endsnippet
snippet j.b "java_beans_" i
java.beans.
endsnippet
snippet j.i "java_io" i
java.io.
endsnippet
snippet j.m "java_math" i
java.math.
endsnippet
snippet j.n "java_net_" i
java.net.
endsnippet
snippet j.u "java_util_" i
java.util.
endsnippet
snippet main "method (main)" b
public static void main(String[] args)`!p nl(snip)`{
$0
}
endsnippet
snippet try "try/catch" !b
try {
$1
} catch(${2:Exception} ${3:e}){
${4:e.printStackTrace();}
}
endsnippet
snippet mt "method throws" b!
${1:private} ${2:void} ${3:method}(${4}) ${5:throws $6 }{
$0
}
endsnippet
snippet m "method" b
${1:private} ${2:void} ${3:method}(${4}) {
$0
}
endsnippet
snippet md "Method With javadoc" !b
/**
* ${7:Short Description}`!p
for i in getArgs(t[4]):
snip.rv += "\n\t * @param " + i[1] + " usage..."`
* `!p
if "throws" in t[5]:
snip.rv = "\n\t * @throws " + t[6]
else:
snip.rv = ""` `!p
if not "void" in t[2]:
snip.rv = "\n\t * @return object"
else:
snip.rv = ""`
**/
${1:public} ${2:void} ${3:method}($4) ${5:throws $6 }{
$0
}
endsnippet
snippet getter "getter"
public ${1:String} get${2:Name}() {
return `!p snip.rv = t[2].lower()`;
}
endsnippet
snippet setter "setter"
public void set${1:Name}(${2:String} $1) {
return this.`!p snip.rv = t[1].lower()` = `!p snip.rv = t[1].lower()`;
}
endsnippet
snippet setget "setter and getter"
public void set${1:Name}(${2:String} `!p snip.rv = t[1].lower()`) {
this.`!p snip.rv = t[1].lower()` = `!p snip.rv = t[1].lower()`;
}
public $2 get$1() {
return `!p snip.rv = t[1].lower()`;
}
endsnippet
snippet pa "package" b
package
endsnippet
snippet p "print" b
System.out.print($1);$0
endsnippet
snippet pl "println" b
System.out.println($1);$0
endsnippet
snippet pr "private" b
private
endsnippet
snippet po "protected" b
protected
endsnippet
snippet pu "public" b
public
endsnippet
snippet re "return" b
return
endsnippet
snippet st "static"
static
endsnippet
snippet sw "switch" b
switch ($1)`!p nl(snip)`{
case $2: $0
}
endsnippet
snippet sy "synchronized"
synchronized
endsnippet
snippet tc "test case"
public class ${1:`!p snip.rv = snip.basename or "untitled"`} extends ${2:TestCase}`!p nl(snip)`{
$0
}
endsnippet
snippet t "test" b
`!p junit(snip)`public void test${1:Name}() {
$0
}
endsnippet
snippet tt "test throws" b
`!p junit(snip)`public void test${1:Name}() ${2:throws Exception }{
$0
}
endsnippet
snippet th "throw" b
throw new $0
endsnippet
snippet wh "while" b
while ($1)`!p nl(snip)`{
$0
}
endsnippet
# vim:ft=snippets:

View file

@ -0,0 +1,172 @@
snippet limxa "lim from x to a" i
\lim_{${2:x} \rightarrow ${1:a}} $0
endsnippet
snippet liminf "lim from x to infinity" i
\lim_{${1:x} \rightarrow \infty} $0
endsnippet
snippet ddx "fr d dx" i
\frac{d}{dx}
endsnippet
snippet pm "Generate pmatrix" i
\begin{pmatrix} $0 \end{pmatrix}
endsnippet
snippet cd "cdot" i
\cdot
endsnippet
snippet lra "leftrightarrow" i
\leftrightarrow
endsnippet
snippet Lra "Leftrightarrow" i
\Leftrightarrow
endsnippet
snippet la "leftarrow" i
\leftarrow
endsnippet
snippet La "Leftarrow" i
\Leftarrow
endsnippet
snippet ra "rightarrow" i
\rightarrow
endsnippet
snippet Ra "Rightarrow" i
\Rightarrow
endsnippet
snippet gm "Generate pmatrix" i
\begin{gmatrix} $0 \end{gmatrix}
endsnippet
snippet bm "Creates a BMatrix" i
\begin{bmatrix} $0 \end{bmatrix}
endsnippet
snippet ta "add a tag"
\tag{${1:Tag Text}}
endsnippet
snippet fr "Fraction" i
\frac{$1}{$2}
endsnippet
snippet p "Programmiersprache" i
\`\`\`{${1:mips}}
$2
\`\`\`
endsnippet
snippet pi "Include Code from other file" i
\`\`\`{.${1:mips}include=${2:source.asm}}
\`\`\`
endsnippet
snippet head "Generates header with everything" b
---
title: '`!p pwd = os.getcwd()
if "mafi1" in pwd:
snip.rv = "Mafi1 Übung " + snip.basename[1:3] +" (Gruppe 10)"
elif "rs" in pwd:
snip.rv = "RS Übung " + snip.basename[1:3] + " (Gruppe 3)"
`'
date: `date +%d.%m.%Y`
author:
- 'Philipp Hochkamp (Mat. Nr. 211011)'
- 'Jonas Röger (Mat. Nr. 210435)'
- 'Nico Jansen (Mat. Nr. 210175)'
titlepage: true
---
endsnippet
snippet new "New Note"
- [${1:Title}](`!p
def getCategory():
w = vim.current.buffer
i = vim.current.window.cursor[0]-1
while i >= 0:
if w[i].split(" ")[0] == "##":
return w[i].split(" ")[1].lower()+"/"
i = i-1
return os.path.basename(w.name).split(".md")[0]+"/"
snip.rv = getCategory() + t[1].replace(" ", "-").lower()`.md)
endsnippet
snippet al "Align Block" i
\begin{align*}
${1:${VISUAL}}
\end{align*}
endsnippet
snippet eq "Equation Block" i
\begin{equation}
${1:${VISUAL}}
\end{equation}
endsnippet
snippet bl "Custom Block" i
\begin{${1:tabluar}}$2
$3
\end{$1}
endsnippet
snippet tab "tabular (or arbitrary) environment" i
\begin{${1:tabular}}{${2:c}}
${0:${VISUAL}}
\end{$1}
endsnippet
snippet mb "Math bold font text" i
\mathbb{${1:R}}
endsnippet
snippet mf "Math Fraktur text" i
\mathfrak{${1:P}}
endsnippet
snippet nt "No Tag and end line" i
\notag \\\\
endsnippet
snippet sum "\sum^{}_{}" i
\sum^{${1:n}}_{${2:i=1}} ${0}
endsnippet
snippet lr( "left( right)" i
\left( ${1:${VISUAL}} \right) ${0}
endsnippet
snippet lr| "left| right|" i
\left| ${1:${VISUAL}} \right| ${0}
endsnippet
snippet lr{ "left\{ right\}" i
\left\{ ${1:${VISUAL}} \right\} ${0}
endsnippet
snippet lr[ "left\[ right\]" i
\left [ ${0:${VISUAL}} \right ]
endsnippet
snippet refl "Reference Link" i
[${1:${VISUAL:Text}}][${2:id}]$0
[$2]:${4:http://${3:www.url.com}} "${5:$4}"
endsnippet
snippet fnt "Footnote" i
[^${1:${VISUAL:Footnote}}]$0
[^$1]:${2:Text}
endsnippet
snippet link "Link to something" i
[${1:${VISUAL:Text}}](${3:http://${2:www.url.com}})$0
endsnippet
snippet img "Image" i
![${1:pic alt}](${2:path}${3/.+/ "/}${3:opt title}${3/.+/"/})$0
endsnippet
snippet ilc "Inline Code" i
\`$1\`$0
endsnippet
snippet sqrt "square root" i
\sqrt{${1}} $2
endsnippet

View file

@ -0,0 +1,3 @@
snippet sh "Shebang" EndStuff
#!/usr/bin/env python
endsnippet

View file

@ -0,0 +1,5 @@
snippet sn "Snippet"
`echo snippet` ${1:Keys} "${2:Description}" ${3:EndStuff}
$4
`echo endsnippet`
endsnippet

View file

@ -0,0 +1,9 @@
augroup neovim_terminal
autocmd!
" Enter Terminal-mode (insert) automatically
autocmd TermOpen * startinsert
" Disables number lines on terminal buffers
autocmd TermOpen * :set nonumber norelativenumber
" allows you to use Ctrl-c on terminal window
autocmd TermOpen * nnoremap <buffer> <C-c> i<C-c>
augroup END

View file

@ -0,0 +1,84 @@
{pkgs, config, inputs, lib, ...}:
with lib;
with lib.my;
{
home.packages = [
python3 # ultisnips
lazygit
nodejs
inputs.rnix-lsp.packages."${pkgs.system}".rnix-lsp
shfmt
shellcheck
vim-vint
nodePackages.write-good
ctags
];
home.file.".config/nvim".source = ./config;
programs.neovim =
let
conf = inputs.self.nixosConfigurations.enterprise.config.programs.neovim.configure;
in
{
enable = true;
package = pkgs.neovim-nightly;
vimAlias = true;
viAlias = true;
extraConfig = ''
set runtimepath^=~/.config/nvim
lua dofile('~/.config/nvim/init.lua')
'';
plugins =
let
nnn-vim = pkgs.vimUtils.buildVimPlugin {
name = "nnn-vim";
src = inputs.nnn-vim;
};
coc-nvim = pkgs.vimUtils.buildVimPlugin {
name = "coc-nvim";
src = inputs.coc-nvim;
};
dart-vim = pkgs.vimUtils.buildVimPlugin {
name = "dart-vim";
src = inputs.dart-vim;
};
vim-pandoc-live-preview = pkgs.vimUtils.buildVimPlugin {
name = "vim-pandoc-live-preview";
src = inputs.vim-pandoc-live-preview;
};
orgmode-nvim = pkgs.vimUtils.buildVimPlugin {
name = "orgmode-nvim";
src = inputs.orgmode-nvim;
dontBuild = true;
};
in
map (x: { plugin = x; }) (with pkgs.vimPlugins; [
vim-tmux-navigator
galaxyline-nvim
nvim-web-devicons
nnn-vim
rainbow
vista-vim
polyglot
vim-commentary
vim-table-mode
vim-speeddating
vim-nix
gruvbox
incsearch-vim
vim-highlightedyank
vim-fugitive
fzf-vim
lualine-nvim
fzfWrapper
vim-devicons
toggleterm-nvim
undotree
vim-pandoc
vim-pandoc-live-preview
vim-pandoc-syntax
ultisnips
coc-nvim
dart-vim
]);
};
}