This commit is contained in:
Till 2026-03-29 14:23:01 +02:00
parent d8032cc35d
commit e945735fa1
61 changed files with 344 additions and 550 deletions

52
home/minimal/default.nix Normal file
View file

@ -0,0 +1,52 @@
{ config, pkgs, ... }:
{
programs.home-manager.enable = true;
home.homeDirectory = "/home/${config.home.username}";
imports = [
./fish.nix
./vifm.nix
./nvim
./tmux.nix
./git.nix
];
home.packages = with pkgs; [
dust
eza
fastfetch
fzf
jq
nh
nix-search
progress
rename
silver-searcher
tldr
tmux
yq
];
home.shellAliases = {
cdg = "cd \$(git rev-parse --show-toplevel)";
dmy = "date +'%-d.-%-m.%Y'";
du = "dust";
ls = "eza";
tree = "eza --tree";
top = "btm --battery";
ymd = "date +'%Y-%m-%d'";
};
programs.nix-index = {
enable = true;
enableFishIntegration = true;
};
programs.bottom = {
enable = true;
};
home.stateVersion = "22.11";
}

78
home/minimal/fish.nix Normal file
View file

@ -0,0 +1,78 @@
{ config, ... }:
{
programs.fish = {
enable = true;
interactiveShellInit = "fish_add_path ${config.xdg.dataHome}/npm/packages/bin";
shellInit = ''
set -gx EDITOR "nvim"
set -gx VISUAL "nvim"
function fish_greeting;
echo (set_color magenta)fish $version(set_color normal)
end
function brief;
khal list today 1d --day-format=
echo ""
task rc.verbose=nothing rc.report.foo.columns:id,description.count rc.report.foo.sort:urgency- foo +READY limit:5
echo ""
tree --noreport -L 1 ~/desktop
end
fzf --fish | source
function startrloft --description 'Starts R with custom environment'
set -lx R_ENVIRON_USER "~/.config/rloft/RLoft_environ"
R -q
end
function vd --wraps vim --description 'vim with date in filename'
nvim (ymd)_$argv.md
end
function note --description 'Create a new note'
if count $argv > /dev/null
nvim -c "call CreateNote('$argv')"
else
nvim ~/notes/(ls ~/notes/ | fzf)
end
end
function diary --description 'Create or edit today\'s diary entry'
nvim -c "call Diary()"
end
set -U fish_prompt_pwd_dir_length 0
function fish_prompt --description "Write out the prompt"
echo -s (set_color green) (whoami) (set_color brblack) @ (set_color yellow) (hostname) (set_color brblack) : (prompt_pwd) '$ ' (set_color normal)
end
function fish_right_prompt --description "Display info to the right of the prompt"
echo -s (__fish_git_prompt)
end
function fish_mode_prompt; end
set fish_cursor_default line blink
set __fish_git_prompt_showdirtystate 'yes'
set __fish_git_prompt_showstashstate 'yes'
set __fish_git_prompt_showuntrackedfiles 'yes'
set __fish_git_prompt_showupstream 'yes'
set __fish_git_prompt_color_upstream_ahead green
set __fish_git_prompt_color_upstream_behind red
set __fish_git_prompt_char_dirtystate '*'
set __fish_git_prompt_char_stagedstate ''
set __fish_git_prompt_char_untrackedfiles ''
set __fish_git_prompt_char_stashstate ''
set __fish_git_prompt_char_upstream_ahead '+'
set __fish_git_prompt_char_upstream_behind '-'
test -f ${config.xdg.configHome}/alias.fish && source ${config.xdg.configHome}/alias.fish
'';
};
}

12
home/minimal/git.nix Normal file
View file

@ -0,0 +1,12 @@
{...}:
{
programs.git = {
enable = true;
settings = {
pull.rebase = true;
extraConfig.init.defaultBranch = "main";
};
lfs.enable = true;
};
}

View file

@ -0,0 +1,65 @@
let mapleader=" "
let maplocalleader="\\"
set colorcolumn=+1
set expandtab
set ignorecase
set iskeyword+=-,ä,Ä,ö,Ö,ü,Ü,ß
set linebreak
set list listchars=tab:»\ ,trail,nbsp:~
set number
set relativenumber
set scrolloff=7
set shell=/bin/sh
set shiftwidth=2
set shortmess=FfmnxoTIc
set signcolumn=no
set smartcase
set softtabstop=2
set spelllang=en_us,de_20
set spellfile=~/.local/share/nvim/site/spell/till.utf-8.add
set splitbelow
set splitright
set tabstop=2
set updatetime=300
set foldmethod=expr
set foldexpr=nvim_treesitter#foldexpr()
let g:netrw_liststyle = 3
let g:netrw_fastbrowse = 0
nnoremap Y y$
nnoremap <leader>cd :lcd %:h<CR>
nnoremap <leader>ew :e <C-R>=expand("%:p:h") . "/" <CR>
nnoremap gF :edit <cfile><return>
nnoremap gx :! xdg-open <cfile><return>
nnoremap <silent> <tab> :bnext<return>
nnoremap <silent> <S-tab> :bnext<return>
nnoremap <silent> Q :bdelete<return>
nnoremap <c-q> :hide<return>
nnoremap <leader>m :make<return>
tnoremap <esc> <c-\><c-n>
xnoremap il g_o^
onoremap <silent> il :normal vil<return>
xnoremap al $o0
onoremap <silent> al :normal val<return>
xnoremap i% GoggV
onoremap <silent> i% :normal vi%<return>
" highlight Normal guibg=NONE
function CreateNote(title)
execute "VimwikiIndex"
execute "VimwikiGoto " . a:title
endfunction
function Diary()
execute "VimwikiMakeDiaryNote"
endfunction

View file

@ -0,0 +1,245 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
astro-language-server
marksman
nil
tree-sitter
typescript-language-server
vim-language-server
];
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
extraConfig = builtins.readFile ./config.vim;
plugins = with pkgs.vimPlugins;
[
cmp-buffer
cmp-cmdline
cmp-emoji
cmp-fish
cmp-nvim-lsp
cmp-nvim-ultisnips
cmp-path
{
plugin = vim-fugitive;
type = "lua";
config = ''
vim.api.nvim_set_keymap("n", "<Leader>g", ":Git<CR>", { noremap = true, silent = true })
'';
}
{
plugin = fzf-vim;
type = "lua";
config = ''
vim.api.nvim_set_keymap('i', '<c-x><c-f>', '<Plug>(fzf-complete-path)', { silent = true })
vim.api.nvim_set_keymap('i', '<c-x><c-k>', '<Plug>(fzf-complete-word)', { silent = true })
vim.api.nvim_set_keymap('i', '<c-x><c-l>', '<Plug>(fzf-complete-line)', { silent = true })
vim.api.nvim_set_keymap('n', '<localleader><tab>', '<Plug>(fzf-maps-n)', { silent = true })
vim.api.nvim_set_keymap('x', '<localleader><tab>', '<Plug>(fzf-maps-x)', { silent = true })
vim.api.nvim_set_keymap('o', '<localleader><tab>', '<Plug>(fzf-maps-o)', { silent = true })
vim.api.nvim_set_keymap('n', '<leader>b', ':Buffers<return>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>o', ':Files<return>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>O', ':Files ~/', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>r', ':Read<return>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>R', ':Read ~/', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>a', ':Ag<return>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>A', ':Ag ~/', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>.', ':Files ~/devel/omniflake/<return>', { noremap = true, silent = true })
vim.api.nvim_create_user_command(
'Read',
'call fzf#run(fzf#wrap({\'sink\': \'read\', \'dir\': <q-args>}))',
{ nargs = '?', complete = 'dir' }
)
'';
}
{
plugin = goyo-vim;
config = ''
nnoremap <silent> yog :Goyo<CR>
nnoremap <silent> [og :Goyo 80<return>
nnoremap <silent> ]og :Goyo!<return>
'';
}
{
plugin = limelight-vim;
config = ''
set termguicolors
let g:limelight_conceal_ctermfg = 'darkgray'
nnoremap yof :Limelight!!<return>
nnoremap [of :Limelight<return>
nnoremap ]of :Limelight!<return>
'';
}
nabla-nvim
{
plugin = nvim-cmp;
type = "lua";
config = builtins.readFile ./nvim-cmp.lua;
}
{
plugin = nvim-colorizer-lua;
config = "lua require 'colorizer'.setup()";
}
{
plugin = nvim-lspconfig;
type = "lua";
config = ''
vim.lsp.enable('astro')
vim.lsp.enable('marksman')
vim.lsp.enable('nil_ls')
vim.lsp.enable('r_language_server')
vim.lsp.enable('rust_analyzer')
vim.lsp.enable('texlab')
vim.lsp.enable('ts_ls')
vim.lsp.enable('vimls')
vim.api.nvim_del_keymap('i', '<c-s>')
vim.keymap.set({ 'i' }, "<c-tab>", vim.lsp.buf.signature_help, { desc = "Show signature help" })
'';
}
{
plugin = (nvim-treesitter.withPlugins (p: [ p.nix p.lua p.r p.typescript ]));
type = "lua";
config = ''
vim.api.nvim_create_autocmd('FileType', {
pattern = { 'nix', 'markdown', 'lua', 'r' },
callback = function()
-- Enable Tree-sitter-based folding
vim.o.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
vim.o.foldmethod = 'expr'
-- Optional: configure fold behavior
vim.o.foldlevel = 99
vim.o.foldlevelstart = 99
end,
})
'';
}
{
plugin = catppuccin-nvim;
config = ''
colorscheme catppuccin-nvim
'';
}
# {
# plugin = papercolor-theme;
# config = ''
# colorscheme PaperColor
# '';
# }
quarto-nvim
typescript-vim
{
plugin = ultisnips;
type = "lua";
config = ''
vim.api.nvim_set_keymap('n', '<leader>se', ':UltiSnipsEdit!<return>', { noremap = true, silent = true })
'';
}
vifm-vim
{
plugin = vim-astro;
config = ''
let g:astro_typescript = 'enable'
'';
}
vim-commentary
{
plugin = vim-easy-align;
config = ''
xmap ga <Plug>(EasyAlign)
nmap ga <Plug>(EasyAlign)
'';
}
{
plugin = vim-fish;
}
vim-nix
{
plugin = vim-pandoc;
config = ''
let g:pandoc#modules#disabled = ["completion", "command", "menu"]
'';
}
vim-pandoc-syntax
vim-repeat
{
plugin = vim-slime;
config = ''
let g:slime_target = "tmux"
let g:slime_default_config = {"socket_name": get(split($TMUX, ","), 0), "target_pane": ":.2"}
let g:slime_no_mappings = 1
let g:slime_dont_ask_default = 1
xmap s <plug>SlimeRegionSend
nmap s <plug>SlimeMotionSend
nmap ss <plug>SlimeLineSend
nnoremap s: :SlimeSend1
'';
}
vim-snippets
vim-speeddating
vim-surround
{
plugin = vim-unimpaired;
config = ''
nnoremap =p <Nop>
nnoremap =P <Nop>
nnoremap =s <Nop>
'';
}
{
plugin = vimwiki;
config = ''
let g:vimwiki_list = [ { 'path': '~/notes/', 'syntax': 'markdown', 'ext': '.md' } ]
nnoremap <Leader>wt <Nop>
nnoremap <Leader>w<Leader>t <Nop>
nmap <C-j> <Plug>VimwikiNextLink
nmap <C-k> <Plug>VimwikiPrevLink
let g:vimwiki_key_mappings = { 'headers': 0, 'text_objs': 0, 'lists': 0, 'lists_return': 0, 'html': 0 }
'';
}
];
};
xdg.configFile."nvim" = {
source = ./dotfiles;
recursive = true;
};
home.shellAliases.v = "nvim";
}

View file

@ -0,0 +1 @@
setlocal shiftwidth=2

View file

@ -0,0 +1,11 @@
augroup markdown
autocmd!
autocmd BufNewFile,BufRead *.Rmd,*.rmd set ft=rmd
autocmd BufNewFile,BufRead *.md,*.markdown set ft=markdown
autocmd BufNewFile,BufRead *.md,*.markdown set syntax=rmd
augroup end
augroup netrw
autocmd!
autocmd FileType netrw setl bufhidden=wipe
augroup end

View file

@ -0,0 +1,42 @@
setlocal spell
setlocal textwidth=0
setlocal syntax=rmd
setlocal breakat-=@
setlocal makeprg=Rscript\ -e\ 'publishR::render(\\"%\\")'
nnoremap <localleader>oh :! xdg-open %:r.html<cr>
nnoremap <localleader>op :! xdg-open %:r.pdf<cr>
nnoremap <localleader>ow :! xdg-open %:r.docx<cr>
nnoremap <leader>t :TOC<cr>
xnoremap <silent> ic :<c-u>call InnerChunk()<cr>
onoremap <silent> ic :<c-u>call InnerChunk()<cr>
xnoremap <silent> ac :<c-u>call OuterChunk()<cr>
onoremap <silent> ac :<c-u>call OuterChunk()<cr>
function OuterChunk()
let chunk = FindChunk()
execute "normal! " . chunk.start . "GV" . chunk.end . "G"
endfunction
function InnerChunk()
let chunk = FindChunk()
execute "normal! " . chunk.start . "GjV" . chunk.end . "Gk"
endfunction
function FindChunk()
let view = winsaveview()
normal! j
?\v^ *```(\{.*\})=$
let startFence = line(".")
/\v^ *``` *
let endFence = line(".")
if startFence <= view.lnum && endFence >= view.lnum
return {"start": startFence, "end": endFence}
else
echoerr "Not inside a chunk"
endif
call winrestview(view)
endfunction

View file

@ -0,0 +1 @@
setlocal makeprg=nixos-rebuild\ dry-build

View file

@ -0,0 +1,6 @@
nnoremap <localleader>i :! R CMD INSTALL `git rev-parse --show-toplevel`<cr>
nnoremap <localleader>d :! R -e "devtools::document()"<cr>
nnoremap <localleader>t :! R -e "devtools::test()"<cr>
" nnoremap <localleader>rl :vsplit \| :terminal R<cr><c-w><c-w>
nnoremap <localleader>rl :silent exec "! tmux source-file ~/.config/tmux/rloft.conf"<cr>

View file

@ -0,0 +1,43 @@
runtime ftplugin/markdown.vim
runtime ftplugin/r.vim
" let g:slime_cell_delimiter = "```"
nmap <silent> snc <plug>SlimeMotionSendic/```{<cr>:noh<cr>j
nmap <silent> <localleader>pd :execute 'SlimeSend1 datapasta::tribble_construct() \|> clipr::write_clip()'<cr>:sleep500ms<cr>"*p
nmap <silent> <localleader>pv :execute 'SlimeSend1 datapasta::vector_construct() \|> clipr::write_clip()'<cr>:sleep500ms<cr>"*p
nmap sc :set opfunc=SendAndPaste<CR>g@
nmap sc<cr> ^:set opfunc=SendAndPaste<CR>g@$
vmap sc :<C-U>call SendAndPaste(visualmode(), 1)<CR>
function! SendAndPaste(type, ...)
let v = winsaveview()
let sel_save = &selection
let &selection = "inclusive"
let reg_save = @@
if a:0 " Invoked from Visual mode, use gv command.
silent exe "normal! gvy"
elseif a:type == 'line'
silent exe "normal! '[V']y"
else
silent exe "normal! `[v`]y"
endif
call slime#send(trim(@@) . " |> capture.output() |> clipr::write_clip()\r")
/```
call append(line("."), ["", "```{r}", "```"])
/```{r}
sleep 500m
let @*=substitute(@*, '\e\[[0-9;]*m', '', 'g')
:put*
call winrestview(v)
let &selection = sel_save
let @@ = reg_save
endfunction
:UltiSnipsAddFiletypes rmd.r.markdown

View file

@ -0,0 +1,2 @@
setlocal makeprg=xelatex\ %
nnoremap <localleader>op :! xdg-open %:r.pdf<cr>

View file

@ -0,0 +1 @@
setlocal makeprg=tsx\ %

View file

@ -0,0 +1,4 @@
syn region math start=/\$\$/ end=/\$\$/
syn match math_block '\$[^$].\{-}\$'
hi link math Statement
hi link math_block Statement

View file

@ -0,0 +1,6 @@
vim.lsp.enable('astro')
vim.lsp.enable('marksman')
vim.lsp.enable('nil_ls')
vim.lsp.enable('r_language_server')
vim.lsp.enable('texlab')
vim.lsp.enable('ts_ls')

View file

@ -0,0 +1,54 @@
local cmp = require'cmp'
cmp.setup({
snippet = {
expand = function(args)
vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
end,
},
mapping = cmp.mapping.preset.insert(
{
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<Tab>'] = cmp.mapping.confirm({ select = false }),
}
),
sources = cmp.config.sources({
{ name = 'cmp_pandoc' },
{ name = 'emoji' },
{ name = 'fish' },
{ name = 'nvim_lsp' },
{ name = 'path' },
{ name = 'ultisnips' },
}, {
{ name = 'buffer' },
})
})
-- 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' }
}
})
-- 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' }
}),
matching = { disallow_symbol_nonprefix_matching = false }
})
-- Set up lspconfig.
local capabilities = require('cmp_nvim_lsp').default_capabilities()

61
home/minimal/tmux.nix Normal file
View file

@ -0,0 +1,61 @@
{ pkgs, ... }:
{
programs.tmux = {
enable = true;
escapeTime = 0;
mouse = true;
newSession = true;
shell = "${pkgs.fish}/bin/fish";
extraConfig = ''
# Key bindings
bind C-l next-window
bind C-h previous-window
bind C-b last-window
bind n new-window
bind C-n new-window -c '#{pane_current_path}'
bind v split-window -h
bind C-v split-window -hc '#{pane_current_path}'
bind s split-window -v
bind C-s split-window -vc '#{pane_current_path}'
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
bind c command-prompt -I "#{b:pane_current_path}" "rename-window '%%'"
bind C-c command-prompt -I "#{b:pane_current_path}" "rename-window '%%'"
# Layouts
bind f new-window -c '#{pane_current_path}' vifm
bind R source ${ pkgs.writeText "tmux-rloft" ''
split-window -c '#{pane_current_path}' -h R -q --no-save --no-restore;
select-pane -l
''}
# Unbind
unbind p
unbind '"'
unbind %
# Eye candy
set-option -g status-right ""
set-option -g status-left ""
set-option -g status-justify "centre"
set-option -g status-style fg=magenta
set-option -g pane-border-style fg=brightwhite
set-option -g pane-active-border-style fg=magenta
set-option -g window-status-current-style bg=brightwhite
# Some more specifics
set-option -g focus-events on
set -g base-index 1
setw -g pane-base-index 1
set -g default-terminal "tmux-256color"
set -as terminal-features ",xterm-256color:RGB"
'';
};
}

12
home/minimal/vifm.nix Normal file
View file

@ -0,0 +1,12 @@
{ config, pkgs, ... }:
{
programs.vifm = {
enable = true;
extraConfig = "
set vicmd=nvim
filetype * xdg-open
colorscheme Default
";
};
}