initial(ish) commit
This commit is contained in:
commit
b744693f0e
88 changed files with 4925 additions and 0 deletions
118
hm-imports/cli.nix
Normal file
118
hm-imports/cli.nix
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
{ inputs, config, lib, pkgs, ... }:
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
|
||||
nnn
|
||||
bat
|
||||
htop
|
||||
exa
|
||||
curl
|
||||
fd
|
||||
file
|
||||
lorri
|
||||
fzf
|
||||
git
|
||||
neofetch
|
||||
ripgrep
|
||||
direnv # needed for lorri
|
||||
unzip
|
||||
pv
|
||||
killall
|
||||
lefthook
|
||||
yt-dlp
|
||||
aria2
|
||||
libqalculate
|
||||
]
|
||||
home.shellAliases = {
|
||||
v = "nvim";
|
||||
vim = "nvim";
|
||||
gpl = "git pull";
|
||||
gp = "git push";
|
||||
lg = "lazygit";
|
||||
gc = "git commit -v";
|
||||
kb = "git commit -m \"\$(curl -s http://whatthecommit.com/index.txt)\"";
|
||||
gs = "git status -v";
|
||||
gfc = "git fetch && git checkout";
|
||||
gl = "git log --graph";
|
||||
l = "exa -la --git";
|
||||
la = "exa -la --git";
|
||||
ls = "exa";
|
||||
ll = "exa -l --git";
|
||||
cat = "bat";
|
||||
};
|
||||
|
||||
programs = {
|
||||
gpg = {
|
||||
enable = true;
|
||||
settings = {
|
||||
cert-digest-algo = "SHA512";
|
||||
charset = "utf-8";
|
||||
default-preference-list = "SHA512 SHA384 SHA256 AES256 AES192 AES ZLIB BZIP2 ZIP Uncompressed";
|
||||
fixed-list-mode = true;
|
||||
keyserver = "hkps://keyserver.ubuntu.com:443";
|
||||
list-options = [ "show-uid-validity" "show-unusable-subkeys" ];
|
||||
no-comments = true;
|
||||
no-emit-version = true;
|
||||
no-greeting = true;
|
||||
no-symkey-cache = true;
|
||||
personal-cipher-preferences = "AES256 AES192 AES";
|
||||
personal-compress-preferences = "ZLIB BZIP2 ZIP Uncompressed";
|
||||
personal-digest-preferences = "SHA512 SHA384 SHA256";
|
||||
require-cross-certification = true;
|
||||
s2k-cipher-algo = "AES256";
|
||||
s2k-digest-algo = "SHA512";
|
||||
throw-keyids = true;
|
||||
use-agent = true;
|
||||
verbose = true;
|
||||
verify-options = "show-uid-validity";
|
||||
with-fingerprint = true;
|
||||
with-key-origin = true;
|
||||
};
|
||||
};
|
||||
bat = {
|
||||
enable = true;
|
||||
config.theme = "gruvbox-dark";
|
||||
};
|
||||
fzf = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
defaultOptions = [
|
||||
"--height 40%"
|
||||
"--layout=reverse"
|
||||
"--border"
|
||||
"--inline-info"
|
||||
];
|
||||
};
|
||||
git = {
|
||||
enable = true;
|
||||
lfs.enable = true;
|
||||
|
||||
# Default configs
|
||||
extraConfig = {
|
||||
commit.gpgSign = true;
|
||||
|
||||
user.name = "Philipp Hochkamp";
|
||||
user.email = "git@phochkamp.de";
|
||||
user.signingKey = "DA5D9235BD5BD4BD6F4C2EA868066BFF4EA525F1";
|
||||
|
||||
# Set default "git pull" behaviour so it doesn't try to default to
|
||||
# either "git fetch; git merge" (default) or "git fetch; git rebase".
|
||||
pull.ff = "only";
|
||||
};
|
||||
};
|
||||
# Htop configurations
|
||||
htop = {
|
||||
enable = true;
|
||||
settings = {
|
||||
hide_userland_threads = true;
|
||||
highlight_base_name = true;
|
||||
shadow_other_users = true;
|
||||
show_program_path = false;
|
||||
tree_view = false;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
12
hm-imports/files.nix
Normal file
12
hm-imports/files.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{ inputs, config, lib, pkgs, ... }:
|
||||
{
|
||||
home.file = {
|
||||
# Home nix config.
|
||||
".config/nixpkgs/config.nix".text = "{ allowUnfree = true; }";
|
||||
".local/share/pandoc/templates/default.latex".source = "${inputs.pandoc-latex-template}/eisvogel.tex";
|
||||
|
||||
# empty zshrc to stop zsh-newuser-install from running
|
||||
".zshrc".text = "";
|
||||
|
||||
};
|
||||
}
|
||||
51
hm-imports/nvim/config/coc-settings.json
Normal file
51
hm-imports/nvim/config/coc-settings.json
Normal 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": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
145
hm-imports/nvim/config/coc.vim
Normal file
145
hm-imports/nvim/config/coc.vim
Normal 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>
|
||||
47
hm-imports/nvim/config/init.lua
Normal file
47
hm-imports/nvim/config/init.lua
Normal 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')
|
||||
3
hm-imports/nvim/config/lua/filetypes.lua
Normal file
3
hm-imports/nvim/config/lua/filetypes.lua
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
vim.cmd [[
|
||||
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
|
||||
]]
|
||||
45
hm-imports/nvim/config/lua/keybindings.lua
Normal file
45
hm-imports/nvim/config/lua/keybindings.lua
Normal 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}}
|
||||
28
hm-imports/nvim/config/lua/plugin/lualine.lua
Normal file
28
hm-imports/nvim/config/lua/plugin/lualine.lua
Normal 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 = {}
|
||||
}
|
||||
11
hm-imports/nvim/config/lua/plugin/nnn.lua
Normal file
11
hm-imports/nvim/config/lua/plugin/nnn.lua
Normal 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'
|
||||
}
|
||||
}
|
||||
})
|
||||
1
hm-imports/nvim/config/lua/plugin/rainbow.lua
Normal file
1
hm-imports/nvim/config/lua/plugin/rainbow.lua
Normal file
|
|
@ -0,0 +1 @@
|
|||
vim.g.rainbow_active = 1
|
||||
22
hm-imports/nvim/config/lua/plugin/terminal.lua
Normal file
22
hm-imports/nvim/config/lua/plugin/terminal.lua
Normal 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'
|
||||
-- }
|
||||
|
||||
21
hm-imports/nvim/config/lua/utils.lua
Normal file
21
hm-imports/nvim/config/lua/utils.lua
Normal 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
|
||||
121
hm-imports/nvim/config/snippets/all.snippets
Normal file
121
hm-imports/nvim/config/snippets/all.snippets
Normal 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:
|
||||
115
hm-imports/nvim/config/snippets/go.snippets
Normal file
115
hm-imports/nvim/config/snippets/go.snippets
Normal 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
|
||||
399
hm-imports/nvim/config/snippets/java.snippets
Normal file
399
hm-imports/nvim/config/snippets/java.snippets
Normal 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:
|
||||
|
||||
172
hm-imports/nvim/config/snippets/pandoc.snippets
Normal file
172
hm-imports/nvim/config/snippets/pandoc.snippets
Normal 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
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet ilc "Inline Code" i
|
||||
\`$1\`$0
|
||||
endsnippet
|
||||
|
||||
snippet sqrt "square root" i
|
||||
\sqrt{${1}} $2
|
||||
endsnippet
|
||||
3
hm-imports/nvim/config/snippets/python.snippets
Normal file
3
hm-imports/nvim/config/snippets/python.snippets
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
snippet sh "Shebang" EndStuff
|
||||
#!/usr/bin/env python
|
||||
endsnippet
|
||||
5
hm-imports/nvim/config/snippets/snippets.snippets
Normal file
5
hm-imports/nvim/config/snippets/snippets.snippets
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
snippet sn "Snippet"
|
||||
`echo snippet` ${1:Keys} "${2:Description}" ${3:EndStuff}
|
||||
$4
|
||||
`echo endsnippet`
|
||||
endsnippet
|
||||
9
hm-imports/nvim/config/terminal.vim
Normal file
9
hm-imports/nvim/config/terminal.vim
Normal 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
|
||||
84
hm-imports/nvim/default.nix
Normal file
84
hm-imports/nvim/default.nix
Normal 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
|
||||
]);
|
||||
};
|
||||
}
|
||||
16
hm-imports/tmux/default.nix
Normal file
16
hm-imports/tmux/default.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{ config, pkgs,...}:{
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
keyMode = "vi";
|
||||
clock24 = true;
|
||||
historyLimit = 10000;
|
||||
plugins = with pkgs.tmuxPlugins; [
|
||||
vim-tmux-navigator
|
||||
gruvbox
|
||||
];
|
||||
extraConfig = ''
|
||||
new-session -s main
|
||||
bind-key -n C-a send-prefix
|
||||
'';
|
||||
};
|
||||
}
|
||||
34
hm-imports/zsh/default.nix
Normal file
34
hm-imports/zsh/default.nix
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{ inputs, config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.ragon.cli;
|
||||
in
|
||||
{
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
histSize = 10000;
|
||||
enableCompletion = true;
|
||||
initExtra =
|
||||
let
|
||||
zshrc = builtins.readFile ./zshrc;
|
||||
|
||||
sources = [
|
||||
"${inputs.agkozak-zsh-prompt}/agkozak-zsh-prompt.plugin.zsh"
|
||||
"${pkgs.oh-my-zsh}/share/oh-my-zsh/plugins/git/git.plugin.zsh"
|
||||
"${pkgs.oh-my-zsh}/share/oh-my-zsh/plugins/globalias/globalias.plugin.zsh"
|
||||
"${inputs.zsh-vim-mode}/zsh-vim-mode.plugin.zsh"
|
||||
"${inputs.zsh-syntax-highlighting}/zsh-syntax-highlighting.plugin.zsh"
|
||||
"${inputs.zsh-completions}/zsh-completions.plugin.zsh"
|
||||
];
|
||||
|
||||
source = map (x: "source " + x) sources;
|
||||
|
||||
plugins = builtins.concatStringsSep "\n" (source);
|
||||
|
||||
in
|
||||
''
|
||||
${zshrc}
|
||||
${plugins}
|
||||
'';
|
||||
};
|
||||
|
||||
}
|
||||
62
hm-imports/zsh/zshrc
Normal file
62
hm-imports/zsh/zshrc
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
AGKOZAK_MULTILINE=0
|
||||
AGKOZAK_PROMPT_CHAR=( ❯ ❯ "%F{red}N%f")
|
||||
autoload -Uz history-search-end
|
||||
|
||||
zle -N history-beginning-search-backward-end history-search-end
|
||||
zle -N history-beginning-search-forward-end history-search-end
|
||||
|
||||
bindkey -M vicmd '^[[A' history-beginning-search-backward-end \
|
||||
'^[OA' history-beginning-search-backward-end \
|
||||
'^[[B' history-beginning-search-forward-end \
|
||||
'^[OB' history-beginning-search-forward-end
|
||||
bindkey -M viins '^[[A' history-beginning-search-backward-end \
|
||||
'^[OA' history-beginning-search-backward-end \
|
||||
'^[[B' history-beginning-search-forward-end \
|
||||
'^[OB' history-beginning-search-forward-end
|
||||
|
||||
hash go 2>/dev/null && export PATH=$PATH:$(go env GOPATH)/bin
|
||||
hash yarn 2>/dev/null && export PATH=$PATH:$HOME/.yarn/bin
|
||||
hash direnv 2>/dev/null && eval "$(direnv hook zsh)" # needed for lorri
|
||||
export PATH=$PATH:$HOME/scripts
|
||||
export PATH=$PATH:$HOME/.config/rofi/bins
|
||||
export PATH=$PATH:$HOME/.local/bin
|
||||
export PATH=$PATH:$HOME/flutter/flutter/bin
|
||||
hash kitty 2>/dev/null && alias ssh="kitty kitten ssh"
|
||||
hash helm 2>/dev/null && . <(helm completion zsh)
|
||||
hash kubectl 2>/dev/null && . <(kubectl completion zsh)
|
||||
export NNN_ARCHIVE="\\.(7z|a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|rar|rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip)$"
|
||||
|
||||
ssh() {
|
||||
if [ -v TMUX ]; then
|
||||
tmux set-option allow-rename off 1>/dev/null
|
||||
tmux rename-window "ssh/$*"
|
||||
command ssh "$@"
|
||||
tmux set-option allow-rename on 1>/dev/null
|
||||
else
|
||||
command ssh "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
n ()
|
||||
{
|
||||
# Block nesting of nnn in subshells
|
||||
if [ -n $NNNLVL ] && [ "${NNNLVL:-0}" -ge 1 ]; then
|
||||
echo "nnn is already running"
|
||||
return
|
||||
fi
|
||||
|
||||
export NNN_TMPFILE="$HOME/.config/nnn/.lastd"
|
||||
|
||||
# Unmask ^Q (, ^V etc.) (if required, see `stty -a`) to Quit nnn
|
||||
# stty start undef
|
||||
# stty stop undef
|
||||
# stty lwrap undef
|
||||
# stty lnext undef
|
||||
|
||||
nnn -d "$@"
|
||||
|
||||
if [ -f "$NNN_TMPFILE" ]; then
|
||||
. "$NNN_TMPFILE"
|
||||
rm -f "$NNN_TMPFILE" > /dev/null
|
||||
fi
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue