Merge commit 'f035c9318b23aea7479c124d749f5678c060e7b3'

This commit is contained in:
2025-10-21 00:00:41 +02:00
57 changed files with 1143 additions and 1677 deletions

View File

@@ -0,0 +1,30 @@
vim.cmd([[
" Tip: acronyms for overview, use `:h` for a quick lookup.
set nocp " Disable vi incompatibility
filetype plugin indent on " Filetype recognition
set enc=utf8 " Default to UTF-8 encoding
set hid " Allow hiding unsaved buffers
set tf " Fast tty
set ut=300 " 300ms for update time
set to tm=200 ttm=5 " Timeouts
set shm+=c " ...
set ul=500 hi=500 " History and undo
set nu rnu scl=number " Line numbers & signs
set nowrap
set bs=indent,eol,start " Indentation
set ai ts=2 sts=2 sw=2 et " Indentation
set is ic scs hls " Search
set lz " Only essential redraws
set nobk nowb noswf " No backups
set vi='20,\"101 " Max 100 lines in registers
set novb " Bell
set cole=0 cocu="" " Conceal
set cb=unnamedplus " Clipboard
set fcs+=vert:│ " Cleaner split separator (tmux style)
set list
set lcs=trail:·,tab:→\ ,nbsp:␣ " Whitespace rendering
set ar " Autoread
set spellsuggest+=5 " Limit spell suggestions
set wildignore+=*/node_modules/*,*/tmp/*,*.so,*.swp,*.zip
" set thesaurus+=./thesaurus/mthesaur.txt " FIXME
]])

View File

@@ -0,0 +1,16 @@
vim.cmd([[
" Taken from /usr/share/vim/vim90/defaults.vim
augroup vimStartup
au!
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid, when inside an event handler
" (happens when dropping a file on gvim) and for a commit message (it's
" likely a different one than last time).
autocmd BufReadPost *
\ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
\ | exe "normal! g`\""
\ | endif
augroup END
]])

View File

@@ -0,0 +1,26 @@
vim.cmd([[
" Folds {{{
set foldmethod=marker
augroup filetype_vim
autocmd!
autocmd FileType vim setlocal foldmethod=marker
augroup END
augroup filetype_python
autocmd!
autocmd FileType python setlocal foldmethod=indent
augroup END
augroup filetype_sh
autocmd!
autocmd FileType sh setlocal foldmethod=marker
augroup END
augroup filetype_snippets
autocmd!
autocmd FileType snippets setlocal foldmethod=marker
augroup END
" }}}
]])

View File

@@ -7,5 +7,6 @@ vim.filetype.add({
[".*/%.vscode/.*%.json"] = "jsonc",
[".*/%.ssh/config%.d/.*"] = "sshconfig",
["%.env.*"] = "dotenv",
["%.pl$"] = "prolog",
},
})

View File

@@ -1,3 +1,50 @@
vim.cmd([[
" Leader keys
let mapleader = " "
let maplocalleader = ";"
" Splits & navigation
nm s <c-w> " Split horizontal
nm ss :sp<CR><c-w>w| " Split horizontal
nm sv :vs<CR><c-w>w| " Split vertical
nm sw <c-w>w| " Navigate splits
nm sh <c-w>h| "
nm sj <c-w>j| "
nm sk <c-w>k| "
nm sl <c-w>l| "
nn sH <c-w>8<| " Resize splits
nn sJ <c-w>8-| "
nn sK <c-w>8+| "
nn sL <c-w>8>| "
nn s= <c-w>=| " Equalize splits
" Open
nn sb :Lex<cr>| " File tree
nn <leader><leader> :noh<cr> |"
nn <leader>t :term<cr>| " Open terminal
" Remaps
ino <nowait> jj <esc>| " Normal now
nn <left> <nop>| " Hard mode
nn <down> <nop>| " "
nn <up> <nop>| " "
nn <right> <nop>| " "
ino <left> <nop>| " "
ino <down> <nop>| " "
ino <up> <nop>| " "
ino <right> <nop>| " "
" Search
nn <c-_> :noh<cr>| " map 'ctrl + /'
" Line numbers
nn <leader>n :set nu! rnu!<cr>
" Vim configuration
nn <leader>ec :vs $MYVIMRC<cr>
nn <leader>so :so %<cr>
]])
local set = vim.keymap.set
set("n", "<leader>cx", "<cmd>!chmod +x %<CR>", { silent = true, desc = "Run `chmod +x` on current file" })

View File

@@ -0,0 +1,5 @@
vim.cmd([[
let g:netrw_winsize = 30
let g:netrw_liststyle=3
let g:netrw_banner = 0
]])

View File

@@ -0,0 +1,12 @@
vim.cmd([[
fu! Compile()
if expand('%:e') == "md"
:silent exec "!pandoc % -s -o /tmp/op.pdf &"
endif
endfu
fu! Preview()
:call Compile()
:silent exec "!zathura /tmp/op.pdf &"
endfu
]])

View File

@@ -0,0 +1,31 @@
vim.cmd([[
call plug#begin()
Plug 'machakann/vim-sandwich'
Plug 'Shougo/context_filetype.vim'
Plug 'editorconfig/editorconfig-vim'
Plug 'honza/vim-snippets'
Plug 'chrisbra/unicode.vim'
Plug 'ap/vim-css-color'
" Jupyter
Plug 'quarto-dev/quarto-vim'
" LaTeX
Plug 'lervag/vimtex'
" Wiki
Plug 'lervag/wiki.vim'
Plug 'hektor/taskwiki'
" Markdown
Plug 'vim-pandoc/vim-pandoc'
Plug 'vim-pandoc/vim-pandoc-syntax'
Plug 'ferrine/md-img-paste.vim'
" TidalCycles
Plug 'supercollider/scvim'
Plug 'tidalcycles/vim-tidal'
" GLSL
Plug 'tikhomirov/vim-glsl'
Plug 'timtro/glslView-nvim'
" Jupyter notebooks
Plug 'goerz/jupytext.vim'
" OpenSCAD
Plug 'sirtaj/vim-openscad'
call plug#end()
]])

View File

@@ -0,0 +1,7 @@
vim.cmd([[
augroup Vim
au!
" Reload vim config when ~/.vimrc is changed
au BufWritePost $HOME/.vimrc so $MYVIMRC | redraw | echo "Reloaded vimrc"
augroup END
]])

View File

@@ -0,0 +1,9 @@
vim.cmd([[
se ls=2
se stl=\ %0*%n
se stl+=\ %m
se stl+=\ %y%0*
se stl+=\ %<%F
se stl+=\ %0*%=%5l%*
se stl+=%0*/%L%*
]])

View File

@@ -0,0 +1,8 @@
vim.cmd([[
function! SynGroup()
let l:s = synID(line('.'), col('.'), 1)
echo synIDattr(l:s, 'name') . ' -> ' . synIDattr(synIDtrans(l:s), 'name')
endfun
com! -nargs=0 Syn :call SynGroup()
]])

View File

@@ -1,5 +0,0 @@
vim.cmd([[
set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
source ~/.vimrc"
]])

View File

@@ -0,0 +1,22 @@
vim.cmd([[
let s:zk_preview_enabled = 0
let s:live_server_job = -1
au BufEnter /home/h/.zk/*.md silent exe '!echo "%" > /home/h/.zk/current-zettel.txt'
function! ToggleZKPreview()
if s:zk_preview_enabled == 1
let s:zk_preview_enabled = 0
call jobstop(s:live_server_job)
au! ZKPreview
else
let s:zk_preview_enabled = 1
let s:live_server_job = jobstart('live-server --watch=/home/h/.zk/current-zettel-content.html --open=current-zettel-content.html --port=8080')
augroup ZKPreview
au BufEnter /home/h/.zk/*.md silent exe '!cat "%:r.html" > /home/h/.zk/current-zettel-content.html'
au BufWritePost /home/h/.zk/*.md silent exe '!make && cat "%:r.html" > /home/h/.zk/current-zettel-content.html'
augroup END
endif
endfunction
command! ToggleZKPreview call ToggleZKPreview()
nn <leader>o :ToggleZKPreview<cr> :!xdg-open http://localhost:8080/%:t:r.html & <cr>
]])