: bharatvaj/dotfiles

Cross platform dotfiles for linux, mac and windows

commit 06ffc57cda1cdd57beaad487bb0447d9ff8627bf
parent 3075a32e9c521343f45e0f2bf480cf08b7beed80
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Mon, 30 Mar 2026 22:37:34 +0530

Remove XDG_ROOT in favour of XDG_HOME

Create directories for vim with setup.cmd

Add clink patches

Move ftplugin, plugins, plugin.vim, keybindings.vim to .config/ as per
XDG standards.

Fix nvim startup

Separate [opt] from plugins as plugins-opt

Fix some hyperred.vim colors

Organize .vimrc XDG codepath

Update vifmrc to use directory view
22 files changed, 724 insertions(+), 613 deletions(-)
M
.bashrc
|
2
+-
A
.config/cmd/patch/AppData/Local/clink/.inputrc
|
3
+++
A
.config/cmd/patch/AppData/Local/clink/clink_settings
|
73
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
M
.config/cmd/setup.cmd
|
42
++++++++++++++++++++++++++++++++----------
M
.config/mac/hard.sh
|
2
+-
M
.config/nvim/init.lua
|
2
+-
M
.config/nvim/lua/keybindings.lua
|
2
+-
M
.config/profile.cmd
|
5
++++-
M
.config/sh/aliases
|
3
++-
M
.config/vifm/vifmrc
|
5
++++-
R
.local/share/vim/ftplugin/c.vim -> .config/vim/ftplugin/c.vim
|
0
R
.local/share/vim/ftplugin/openscad.vim -> .config/vim/ftplugin/openscad.vim
|
0
A
.config/vim/keybindings.vim
|
249
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A
.config/vim/plugin.vim
|
226
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A
.config/vim/plugins
|
67
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A
.config/vim/plugins-opt
|
19
+++++++++++++++++++
M
.local/share/vim/colors/hyperred.vim
|
6
+++---
D
.local/share/vim/keybindings.vim
|
246
-------------------------------------------------------------------------------
D
.local/share/vim/plugin.vim
|
117
-------------------------------------------------------------------------------
D
.local/share/vim/plugins
|
88
-------------------------------------------------------------------------------
M
.profile
|
10
+++++-----
M
.vimrc
|
170
++++++++++++++++---------------------------------------------------------------
diff --git a/.bashrc b/.bashrc
@@ -1,4 +1,4 @@
-[ -z "$XDG_ROOT" ] && . ./.profile
+[ -z "$XDG_HOME" ] && . ./.profile
 [ -f "$XDG_CONFIG_HOME/sh/unstaged" ] && . "$XDG_CONFIG_HOME/sh/unstaged"
 [ -f "$XDG_CONFIG_HOME/bash_unstaged" ] && . "$XDG_CONFIG_HOME/bash_unstaged"
 . "${XDG_CONFIG_HOME}/sh/aliases"
diff --git a/.config/cmd/patch/AppData/Local/clink/.inputrc b/.config/cmd/patch/AppData/Local/clink/.inputrc
@@ -0,0 +1,3 @@
+$if clink
+"\C-d": win-insert-eof
+$endif
diff --git a/.config/cmd/patch/AppData/Local/clink/clink_settings b/.config/cmd/patch/AppData/Local/clink/clink_settings
@@ -0,0 +1,73 @@
+# name: Strips CR and LF chars on paste
+# type: enum
+# options: delete,space,ampersand,crlf
+clink.paste_crlf = space
+
+clink.autostart = %USERPROFILE%\.config\profile.cmd
+clink.autoupdate = off
+clink.logo = none
+clink.default_bindings = bash
+
+# name: Auto-answer terminate prompt
+# type: enum
+# options: off,answer_yes,answer_no
+cmd.auto_answer = on
+
+# name: Pressing Ctrl-D exits session
+# type: boolean
+cmd.ctrld_exits = True
+
+# color
+color.arg = bold
+color.arginfo = yellow
+color.cmd = bold
+color.cmdredir = bold
+color.cmdsep = bold
+color.comment_row = bright white on cyan
+color.description = bright cyan
+color.doskey = bold cyan
+color.filtered = bold
+color.flag = default
+color.interact = bold
+color.message = default
+color.unexpected = default
+
+# name: Controls how duplicate entries are handled
+# type: enum
+# options: add,ignore,erase_prev
+history.dupe_mode = erase_prev
+
+# name: Sets how command history expansion is applied
+# type: enum
+# options: off,on,not_squoted,not_dquoted,not_quoted
+history.expand_mode = not_quoted
+
+# name: Skip adding lines prefixed with whitespace
+# type: boolean
+history.ignore_space = False
+
+history.max_lines = 10000
+
+history.save = True
+
+history.shared = False
+
+# name: Controls VT emulation
+# type: enum
+# options: native,emulate,auto
+terminal.emulation = auto
+
+# name: Esc sends a literal escape character
+# type: boolean
+terminal.raw_esc = False
+
+# name: Support Windows' Ctrl-Alt substitute for AltGr
+# type: boolean
+terminal.use_altgr_substitute = True
+
+exec.cwd = 1
+exec.dirs = 1
+exec.enable = 1
+exec.path = 1
+exec.space_prefix = 1
+
diff --git a/.config/cmd/setup.cmd b/.config/cmd/setup.cmd
@@ -11,6 +11,15 @@ goto :main
     set "%~1=%_tail%"
 goto :eof
 
+:create_dir
+setlocal
+    if not exist "%~1\" (
+        echo mkdir "%~1"
+        mkdir "%~1"
+    )
+endlocal
+goto :eof
+
 :add_path
     setlocal EnableDelayedExpansion
 

@@ -45,17 +54,18 @@ goto :eof
 @call %~dp0\..\profile.cmd %1
 
 if "%~1" == "" (
-    call :set_var XDG_ROOT %USERPROFILE%
+    call :set_var XDG_HOME %USERPROFILE%
     call :set_var SCOOP %SYSTEMROOT:~0,2%\ProgramData\scoop
 ) else (
-    call :set_var XDG_ROOT %~1
-    call :set_var SCOOP %XDG_ROOT%\scoop
+    call :set_var XDG_HOME %~1
+    call :set_var SCOOP %XDG_HOME%\scoop
 )
 echo SCOOP is "%SCOOP%"
 
-call :set_var XDG_CONFIG_HOME %XDG_ROOT%\.config
-call :set_var XDG_DATA_HOME %XDG_ROOT%\.local\share
-call :set_var XDG_CACHE_HOME %XDG_ROOT%\.cache
+call :set_var XDG_CACHE_HOME %XDG_HOME%\.cache
+call :set_var XDG_CONFIG_HOME %XDG_HOME%\.config
+call :set_var XDG_DATA_HOME %XDG_HOME%\.local\share
+call :set_var XDG_STATE_HOME %XDG_HOME%\.local\state
 
 if not exist "%SCOOP%\apps\scoop\current\bin\scoop.ps1" (
 

@@ -64,10 +74,10 @@ if not exist "%SCOOP%\apps\scoop\current\bin\scoop.ps1" (
     rem echo powershell -Command "Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')"
     rem TODO Autorun? Print the current settings like Mode: USER or Mode: Admin
     echo If you want to install scoop globally run the contents of
-    echo %XDG_ROOT%\.config\cmd\global_scoop.ps1
+    echo %XDG_HOME%\.config\cmd\global_scoop.ps1
     
     rem Install only the absolute essentials
-    rem TODO Fix global install apps like gpg and firefox, by making it use the XDG_ROOT
+    rem TODO Fix global install apps like gpg and firefox, by making it use the XDG_HOME
     rem set base="7zip clink dos2unix grep make mingit mpv sed sudo unzip vim"
     rem set full="%cmd% git-annex firefox"
     rem TODO Use a parameter to mention this rather hardcoding this value

@@ -93,9 +103,21 @@ call :set_var VIFM %XDG_CONFIG_HOME%\vifm
 call :set_var FUZZER wlines
 call :set_var ChocolateyToolsLocation %SYSTEMROOT:~0,2%\ProgramData\Tools
 
+rem XDG Dirs
+call :create_dir "%XDG_HOME%"
+call :create_dir "%XDG_CACHE_HOME%"
+call :create_dir "%XDG_CONFIG_HOME%"
+call :create_dir "%XDG_DATA_HOME%"
+call :create_dir "%XDG_STATE_HOME%"
+
+rem Vim Dirs
+call :create_dir "%XDG_STATE_HOME%\vim"
+call :create_dir "%XDG_STATE_HOME%\vim\backup"
+call :create_dir "%XDG_STATE_HOME%\vim\swap"
+
 rem Apply config patches
 rem TODO Use mklink instead of xcopy, it will prevent overriding changed files in the destination dir.
-xcopy /S /E /Y %XDG_ROOT%\.config\cmd\patch %XDG_ROOT%\
+xcopy /S /E /Y %XDG_HOME%\.config\cmd\patch %XDG_HOME%\
 
 if not exist "%SYSTEMDRIVE%\bin" ( mkdir %SYSTEMDRIVE%\bin )
 

@@ -116,7 +138,7 @@ if EXIST %SCOOP%\apps\gpg\current\bin\gpgconf.ctl (
 
 call :add_path "%SCOOP%\shims"
 rem Always use \\ infront of '.' (causes issue with findstr)
-call :add_path "%XDG_ROOT%\.local\bin\cmd"
+call :add_path "%XDG_HOME%\.local\bin\cmd"
 call :add_path "%SYSTEMDRIVE%\bin"
 call :add_path "%APPDATA%\Python\Python313\Scripts"
 
diff --git a/.config/mac/hard.sh b/.config/mac/hard.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 # TODO Use a general script to shadow copy all
-cp $XDG_ROOT/.config/mac/.cache/alacritty_unstaged.yml $XDG_ROOT/.cache/alacritty_unstaged.yml
+cp $XDG_HOME/.config/mac/.cache/alacritty_unstaged.yml $XDG_HOME/.cache/alacritty_unstaged.yml
 
 # map caps lock to esc
 hidutil property --set '{"UserKeyMapping":[
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
@@ -28,7 +28,7 @@ g.netrw_banner = 0
 g.netrw_liststyle = 3
 
 vim.cmd([[
-	source $XDG_DATA_HOME/vim/plugin.vim
+	source $XDG_CONFIG_HOME/vim/plugin.vim
 ]])
 
 function load_plugns()
diff --git a/.config/nvim/lua/keybindings.lua b/.config/nvim/lua/keybindings.lua
@@ -1,6 +1,6 @@
 local map = vim.keymap.set
 
-vim.cmd[[source $XDG_DATA_HOME/vim/keybindings.vim]]
+vim.cmd[[source $XDG_CONFIG_HOME/vim/keybindings.vim]]
 
 vim.api.nvim_create_autocmd('LspAttach', {
   callback = function(args)
diff --git a/.config/profile.cmd b/.config/profile.cmd
@@ -3,7 +3,10 @@
 doskey cat=type $*
 doskey clear=cls
 doskey d=curl -fLO $*
-doskey dot=git --git-dir="%USERPROFILE%\.local\share\wt\dotfiles.git" $*
+
+doskey dot=mklink /J "%XDG_HOME%\.git" "%XDG_DATA_HOME%\wt\dotfiles.git"
+doskey undot=rmdir "%XDG_HOME%\.git"
+
 doskey e=%EDITOR% $*
 doskey g=git $*
 doskey hb=sh %USERPROFILE%\.local\bin\sh\hb $*
diff --git a/.config/sh/aliases b/.config/sh/aliases
@@ -58,4 +58,5 @@ alias fy='fzf | clip'
 alias o='xdg-open'
 
 alias voom='VIM_DIR=$XDG_DATA_HOME/vim voom'
-alias dot='git --git-dir=$HOME/.dotfiles --work-tree=$HOME'
+alias dot="ln -s \"$XDG_DATA_HOME/wt/dotfiles.git\" \"$XDG_HOME/.git\""
+alias undot="rm \"$XDG_HOME/.git\""
diff --git a/.config/vifm/vifmrc b/.config/vifm/vifmrc
@@ -557,7 +557,10 @@ nnoremap <space> :select<cr><down>
 "windo set viewcolumns=-{name},6{size},11{perms}
 windo set viewcolumns=-85%{name},15%{size}
 set millerview
-set milleroptions+=rpreview:all
+set milleroptions+=rpreview:dirs
 set dotdirs-=nonrootparent
 
+"fileviewer <text/*> head -n %ph %c
+"fileviewer !<text/*> file %c
+
 only
diff --git a/.local/share/vim/ftplugin/c.vim b/.config/vim/ftplugin/c.vim
diff --git a/.local/share/vim/ftplugin/openscad.vim b/.config/vim/ftplugin/openscad.vim
diff --git a/.config/vim/keybindings.vim b/.config/vim/keybindings.vim
@@ -0,0 +1,249 @@
+" General keybindings
+inoremap <C-{> <esc>:
+nnoremap <C-{> :
+
+nnoremap <C-/> :vim9cmd scope#fuzzy#Grep('git grep')<cr>
+nnoremap <C-`> :terminal<cr>
+
+nnoremap <F4> :call SaveAndBuild()<cr>
+
+nnoremap <leader>co :botright copen<cr>
+nnoremap <leader>cs :cdo<space>s/
+nnoremap <leader>ec :call OpenSource("$XDG_HOME/.vimrc")<cr>
+nnoremap <leader>ek :call OpenSource("$XDG_DATA_HOME/vim/keybindings.vim")<cr>
+nnoremap <leader>et :set expandtab<cr>
+nnoremap <leader>fa :find *
+nnoremap <leader>ff :find *
+nnoremap <leader>lb :ls<cr>:b<space>
+nnoremap <leader>ld :ldo<space>s/
+nnoremap <leader>lo :lopen<cr>
+nnoremap <leader>ls :ldo<space>s/
+nnoremap <leader>pp :Rg<cr>
+nnoremap <leader>pv :packadd vimspector<cr>
+nnoremap <leader>sc :source $XDG_CONFIG_HOME/vim/vimrc<cr>
+nnoremap <leader>so :source %<cr>
+nnoremap <leader>spp :set paste<cr>
+nnoremap <leader>spa :set path+=**<cr>
+nnoremap <leader>tt :tabnew<cr>
+nnoremap <leader>ta :tab *
+nnoremap <leader>vg :vimgrep<space>
+nnoremap <leader>/ :cdo %s/
+nnoremap <leader>cd :cd %:p:h<cr>
+nnoremap <leader>gcd :Gcd<cr>
+nnoremap <leader>qd :cdo s/
+
+" Buffer Creation
+nnoremap <leader>sc :source $XDG_CONFIG_HOME/vim/vimrc<cr>
+nnoremap <leader>ss :split<cr>
+nnoremap <leader>vv :vsplit<cr>
+
+nnoremap <leader>ds :call DiffWithSaved()<cr>
+" TODO Add du to diff with undo
+" nnoremap <leader>ds :call DiffWithSaved()<cr>
+
+fun! SaveAndSuspend()
+    :w
+    :suspend
+endfun
+
+nnoremap <silent> <leader>zj :call NextClosedFold('j')<cr>
+nnoremap <silent> <leader>zk :call NextClosedFold('k')<cr>
+
+function! NextClosedFold(dir)
+    let cmd = 'norm!z'..a:dir
+    let view = winsaveview()
+    let [l0, l, open] = [0, view.lnum, 1]
+    while l != l0 && open
+        exe cmd
+        let [l0, l] = [l, line('.')]
+        let open = foldclosed(l) < 0
+    endwhile
+    if open
+        call winrestview(view)
+    endif
+endfunction
+
+
+" Control
+nnoremap <c-z> :call SaveAndSuspend()<cr>
+inoremap <c-z> :call SaveAndSuspend()<cr>
+
+" Accessible completions
+inoremap <c-l> <c-x><c-l>
+" Emacs line navigation in insert mode
+inoremap <c-a> <c-o>0
+inoremap <c-e> <c-o>A
+inoremap <c-k> <c-o>D
+inoremap <c-y> <c-o>p
+inoremap <c-f> <Right>
+inoremap <c-b> <Left>
+
+cnoremap <c-a> <home>
+cnoremap <c-e> <end>
+cnoremap <c-y> <c-r>"
+cnoremap <c-p> <c-f>
+cnoremap <c-f> <Right>
+cnoremap <c-b> <Left>
+
+nnoremap <c-x><c-f> :Explore<cr>/
+nnoremap <c-x><c-c> :q<cr>
+nnoremap <c-x><c-g> :G<cr>/
+nnoremap <c-x><c-s-g> :G<cr>
+nnoremap <c-x><c-d> :Debugger<cr>
+nnoremap <c-x><c-s> :w<cr>
+
+" Behave vim
+nnoremap Y y$
+nmap Q gzip
+
+if has("win32")
+    " TODO Check if alt is allowed along with win32 check?
+    nnoremap ë :cprev<cr>
+    nnoremap ê :cnext<cr>
+endif
+
+nnoremap <A-k> :cprev<cr>
+nnoremap <A-j> :cnext<cr>
+
+" development
+nnoremap <leader>oc :grepadd /:: %
+nnoremap <leader>oh :grepadd /:: %
+
+nnoremap <leader>fb :b *
+
+vnoremap <tab> >>
+
+" TODO reflect on whether <leader><leader> is productive, I keep hitting it
+" accidentally
+"nnoremap <leader><leader> :Rg<cr>
+
+fun! SetupCommandAlias(from, to)
+  exec 'cnoreabbrev <expr> '.a:from
+        \ .' ((getcmdtype() is# ":" && getcmdline() is# "'.a:from.'")'
+        \ .'? ("'.a:to.'") : ("'.a:from.'"))'
+endfun
+call SetupCommandAlias("W","w")
+call SetupCommandAlias("Wq","wq")
+call SetupCommandAlias("man","help")
+
+nnoremap <leader>tb :call ToggleBackground()<CR>
+nnoremap <leader>tl :call ToggleList()<CR>
+
+" useful
+nnoremap <leader>nn :set number<cr>
+
+" development
+nnoremap <M-F9> :call SaveAndBuild()<cr>
+inoremap <M-F9> :call SaveAndBuild()<cr>
+nnoremap <leader>bc :Make clean<CR>
+
+nnoremap <leader>fmv :call FileMvHelper()<CR>
+
+" Quick save and write
+nnoremap <leader>wq :wq<cr>
+nnoremap <leader>ww :w<cr>
+nnoremap <leader>qq :q<cr>
+
+" vim-fugitive
+nnoremap <leader>gb :G blame<cr>
+nnoremap <leader>dg :Gvdiff<CR>
+nnoremap <leader>gg :Ggrep -q <space>
+nnoremap <leader>gr :G reset %<cr>
+nnoremap <leader>gwq :Gwq<cr>
+nnoremap <leader>lg :Glgrep<space>
+
+
+" Generate ctags
+nnoremap<leader>gt :!sh -c "ctags `git ls-files`"<CR>
+
+nnoremap <C-L> :nohl<CR><C-L>
+
+" Markdown - Add checkbox mode?
+nnoremap <leader>cc :ChecklistToggleCheckbox<cr>
+nnoremap <leader>ct :ChecklistToggleCheckbox<cr>
+nnoremap <leader>ce :ChecklistEnableCheckbox<cr>
+
+let g:gutentags_file_list_command = 'rg --files'
+
+
+autocmd FileType markdown set cursorline
+
+" Hide and format markdown elements like **bold**
+autocmd FileType markdown set conceallevel=2
+
+nnoremap <leader>h1 :call QuickUnderline(1)<cr>
+nnoremap <leader>h2 :call QuickUnderline(2)<cr>
+
+fun! GotoWindow(id)
+    call win_gotoid(a:id)
+endfun
+
+
+fun! StartDebugging()
+    doautocmd User DebuggingStarted
+    :Termdebug .\payredu.exe<cr>
+endfun
+
+" Easy save
+nnoremap <esc>s :w<cr>
+
+" Fly through windows
+nnoremap <esc>h <c-w>h
+nnoremap <esc>j <c-w>j
+nnoremap <esc>k <c-w>k
+nnoremap <esc>l <c-w>l
+
+" Debugger remaps
+nnoremap <F5> :call StartDebugging()<cr>
+nnoremap <leader>dc :call GotoWindow(g:vimspector_session_windows.code)<CR>
+nnoremap <leader>dt :call GotoWindow(g:vimspector_session_windows.tagpage)<CR>
+nnoremap <leader>dv :call GotoWindow(g:vimspector_session_windows.variables)<CR>
+nnoremap <leader>dw :call GotoWindow(g:vimspector_session_windows.watches)<CR>
+" nnoremap <leader>ds :call GotoWindow(g:vimspector_session_windows.stack_trace)<CR>
+nnoremap <leader>do :call GotoWindow(g:vimspector_session_windows.output)<CR>
+nnoremap <S-F5> :call vimspector#Reset()<CR>
+
+nnoremap <leader>dtcb :call vimspector#CleanLineBreakpoint()<CR>
+
+fun! SetupDebuggingKeymaps()
+    nmap <> <Plug>VimspectorStepOver
+    nmap <c-i> <Plug>VimspectorStepInto
+    nmap <m-i> <Plug>VimspectorStepOut
+    nmap <c-s-r> <Plug>VimspectorRestart
+    nmap <F9> :Break<cr>
+    nmap <C-S-F9> :Clear<CR>
+    nmap <F5> :Continue<CR>
+    nmap <S-F5> :Finish<CR>
+endfun
+
+augroup debugmode
+    autocmd User DebuggingStarted :call SetupDebuggingKeymaps()
+augroup END
+
+nmap <leader>drc <Plug>VimspectorRunToCursor
+nmap <leader>dbp <Plug>VimspectorToggleBreakpoint
+nmap <leader>dcbp <Plug>VimspectorToggleConditionalBreakpoint
+
+nnoremap cn *``cgn
+nnoremap cN *``cgN
+let g:mc = "y/\\V\<C-r>=escape(@\", '/')\<CR>\<CR>"
+vnoremap <expr> cn g:mc . "``cgn"
+
+let g:ctrlp_map = '<F2>'
+nnoremap <F1> :CtrlPBuffer<cr>
+inoremap <F1> :CtrlPBuffer<cr>
+nnoremap <S-F1> :CtrlPMRU<cr>
+inoremap <S-F1> :CtrlPMRU<cr>
+"
+" TODO setup this up with fzf
+nnoremap <F2> :vim9cmd scope#fuzzy#GitFile()<cr>
+nnoremap <S-F2> :vim9cmd scope#fuzzy#File()<cr>
+
+nnoremap <F3> :vim9cmd call scope#fuzzy#Quickfix()<cr>
+
+if has('macunix')
+    :imap <D-V> ^O"+p
+en
+
+"inoremap <silent> <Bar>   <Bar><Esc>:call <SID>align()<CR>a
+
diff --git a/.config/vim/plugin.vim b/.config/vim/plugin.vim
@@ -0,0 +1,226 @@
+" Strip the newline from the end of a string
+function! Chomp(str)
+  return substitute(a:str, '\n$', '', '')
+endfunction
+
+func! TryAndDelete()
+    try
+        source %
+        bdelete
+    catch
+        echom "Cannot source file '" .. expand('<afile>') .. "'"
+    endt
+endfunc
+
+func! OpenOnce(fi)
+    :exec "vsplit" a:fi
+    aug EphemeralBuffer
+        au!
+        au! BufWritePost <buffer> bdelete
+    aug END
+endfunc
+
+func! OpenSource(fi)
+    :exec "vsplit" a:fi
+    aug EphemeralBuffer
+        au! | au! BufWritePost <buffer> call TryAndDelete()
+    aug END
+endfunc
+
+" Find a file and pass it to cmd
+function! DmenuOpen(cmd)
+  let fname = Chomp(system("git ls-files | dmenu-mac -i -l 20 -p " . a:cmd))
+  if empty(fname)
+    return
+  endif
+  execute a:cmd . " " . fname
+endfunction
+
+" find file in git repo
+function! ChooseFile()
+  let dir = expand("%:h")
+  if empty(dir) | let dir = getcwd() | endif
+
+  let root = system("cd " . dir . " && git rev-parse --show-toplevel")
+  if v:shell_error != 0 | echo "Not in a git repo" | return | endif
+  let root = root[0:-2]
+
+  let selection = system("cd " . root . " && git ls-files -co --exclude-standard | choose")
+  if empty(selection) | echo "Canceled" | return | end
+
+  echo "Finding file..."
+  exec ":e " . root . "/" . selection
+endfunction
+
+function! DiffWithSaved()
+  let filetype=&ft
+  diffthis
+  vnew | r # | normal! 1Gdd
+  diffthis
+  exe "setlocal bt=nofile bh=wipe nobl noswf ro ft=" . filetype
+endfunction
+
+" Move to a file common to nvim and vim
+function! ToggleList()
+	if &list == "nolist"
+		set list
+	else
+		set nolist
+	endif
+endfunction
+
+function! ToggleBackground()
+	if &background == "light"
+		set background=dark
+	else
+		set background=light
+	endif
+endfunction
+
+function! FileMvHelper()
+	:normal! 0i"A"0y$A p0imv j0
+endfunction
+" Run Make
+
+function SaveAndBuild()
+    botright copen
+	wall
+	if exists(":Make")
+		Make
+	else
+		make
+	endif
+endfunction
+
+function QuickUnderline(n)
+	if a:n == 1
+		normal! yypv$r=
+	else
+		normal! yypv$r-
+	endif
+endfunction
+
+function ReverseDate()
+	normal! dt/wwpldeBP
+endfunction
+
+function! s:align()
+  let p = '^\s*|\s.*\s|\s*$'
+  if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
+    let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g'))
+    let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*'))
+    Tabularize/|/l1
+    normal! 0
+    call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
+  endif
+endfunction
+
+function! s:load_plugins(t) abort
+	call s:plugin_pre_load()
+	packadd vim-commentary
+	packadd vim-surround
+	packadd vim-ninja-feet
+	packadd vim-fugitive
+	packadd vim-unimpaired
+	packadd vim-better-whitespace
+	packadd vim-dispatch
+	packadd ctrlp.vim
+	packadd conflict-marker.vim
+	packadd mru
+
+	call s:plugin_post_load()
+endfunction
+
+func! s:plugin_pre_load()
+	let g:ale_floating_window_border = ['│', '─', '╭', '╮', '╯', '╰', '│', '─']
+	let g:ale_floating_window_border = repeat([''], 8)
+	let g:ale_completion_enabled = 1
+	let g:ale_fixers = { 'c': [ 'astyle'] }
+	let g:ale_linters = { 'javascript': ['quicklintjs'] }
+	let g:ale_lint_on_enter = 1
+	let g:ale_disable_lsp = 0
+
+	let g:ale_lint_delay = 0
+	let g:ale_lint_on_text_changed = 'always'
+	let g:birck_default_chan="irc.libera.chat"
+
+	if exists('#ALEEvents')
+	  call ale#events#Init()
+	endif
+
+	"let g:lsp_use_native_client = 1
+	"let g:lsp_diagnostics_virtual_text_enabled = 0
+	"let g:lsp_diagnostics_enabled  = 1
+	"let g:lsp_diagnostics_echo_cursor  = 1
+endfunc
+
+func! s:plugin_post_load()
+    let g:ctrlp_by_filename = 1
+    let g:ctrlp_reuse_window = 'netrw\|help\|quickfix'
+
+    let g:ctrlp_prompt_mappings = {
+            \ 'PrtSelectMove("j")':   ['<c-n>', '<down>'],
+            \'PrtSelectMove("k")':   ['<c-p>', '<up>'], 
+            \ 'PrtHistory(-1)':       ['<c-j>'],
+            \ 'PrtHistory(1)':        ['<c-k>'],
+            \ }
+
+    if executable('ag')
+        " Use Ag over Grep
+        set grepprg=ag\ --nogroup\ --nocolor
+
+        " Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
+        let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
+    endif
+
+
+    packadd termdebug
+    let g:termdebug_wide=163
+
+    if !has("win32")
+        packadd vim-tmux-navigator
+        packadd notmuch-vim
+        let g:notmuch_use_fzf = 1
+        let g:notmuch_open_command = 'fzf'
+        let g:notmuch_fzf_command = 'fzf --reverse'
+        let g:notmuch_use_conversation_view = 1
+        let sendmail_path = systemlist('sed -n "s/^set sendmail=\(.*\)$/\1/p; $!d" ~/.mailrc')
+        if len(sendmail_path) > 0
+            "let g:notmuch_sendmail=sendmail_path[]
+        endif
+    endif
+
+endfunc
+
+aug user_cmds
+	au!
+	au VimEnter * call timer_start(20, function('s:load_plugins'))
+aug END
+
+if !exists('g:undotree_WindowLayout')
+	let g:undotree_WindowLayout = 4
+	let g:undotree_ShortIndicators = 1
+endif
+
+
+" Debug
+let g:termdebug_config = {'sign': '>>', 'winbar': 0, 'wide':163}
+
+function! FZYFiles() abort
+	let l:tempname = tempname()
+	" fzf | awk '{ print $1":1:0" }' > file
+	execute 'silent !git ls-files --recurse-submodules | fzf > ' . fnameescape(l:tempname)
+	let l:tcontents = join(readfile(l:tempname))
+	try
+		" TODO Add option to add multiple files to argslist
+		"execute 'argadd ' . l:tcontents
+		 let bufnr = bufadd(l:tcontents)
+		call bufload(bufnr)
+		"call setbufline(bufnr, 1, ['some', 'text'])
+		execute 'edit ' . l:tcontents
+		redraw!
+	finally
+		call delete(l:tempname)
+	endtry
+endfunction
+
diff --git a/.config/vim/plugins b/.config/vim/plugins
@@ -0,0 +1,67 @@
+907th/vim-auto-save
+AndrewRadev/tagalong.vim
+chrisbra/csv.vim
+dhruvasagar/vim-table-mode
+epheien/termdbg
+hattya/vcvars.vim
+ldrumm/compiler-explorer.vim
+mbbill/undotree
+PreciousChicken/vim-groff-viewer
+taoso/mru.vim
+torrancew/vim-openscad
+axvr/zepl.vim
+dense-analysis/ale
+prabirshrestha/asyncomplete.vim
+axvr/org.vim
+img-paste-devs/img-paste.vim
+kristijanhusak/vim-dadbod-ui
+ledger/vim-ledger
+will133/vim-dirdiff
+tpope/vim-sleuth
+travisjeffery/vim-auto-mkdir
+jceb/vim-orgmode
+tpope/vim-speeddating
+bharatvaj/jump.vim
+https://git.sr.ht/~ackyshake/VimCompletesMe.vim
+
+#prabirshrestha/vim-lsp
+#mattn/vim-lsp-settings
+#hsanson/vim-android
+#tomtom/tlib_vim
+#tomtom/ttodo_vim
+#Bestoa/SearchComplete
+#Shougo/vimproc.vim
+#bfrg/vim-fzy
+#cfdrake/vim-pbxproj
+#christoomey/vim-tmux-navigator
+#ervandew/supertab
+#evansalter/vim-checklist
+#ferranpm/vim-maildir
+#gfontenot/vim-xcode
+#https://git.sr.ht/~ackyshake/VimCompletesMe.vim
+#https://git.sr.ht/~torresjrjr/birck.vim
+#https://github.com/bfrg/vim-jqplay
+#jerrymarino/xcodebuild.vim
+#joereynolds/vim-minisnip/
+#kana/vim-submode
+#keith/swift.vim
+#mfussenegger/nvim-dap
+#nachumk/systemverilog.vim
+#neovim/nvim-lspconfig
+#notmuch-vim/notmuch-vim
+#ntpeters/vim-better-whitespace.git
+#omniSharp/omnisharp-vim
+#preservim/tagbar
+#psliwka/vim-smoothie # smooth scrolling for vim, it is good, but I personally don't need smooth scrolling
+#puremourning/vimspector
+#radenling/vim-dispatch-neovim
+#rcarriga/nvim-dap-ui
+#terrortylor/nvim-comment
+#tommcdo/vim-ninja-feet.git
+#tpope/vim-vinegar
+#vim-scripts/SearchComplete
+#vim-scripts/gitignore
+#vim-scripts/vimacs
+#xolox/vim-easytags
+#xolox/vim-misc
+#yegappan/searchcomplete
diff --git a/.config/vim/plugins-opt b/.config/vim/plugins-opt
@@ -0,0 +1,19 @@
+tpope/vim-obsession
+tpope/vim-commentary
+tpope/vim-dadbod
+tpope/vim-dispatch
+tpope/vim-fugitive
+tpope/vim-projectionist
+tpope/vim-repeat
+tpope/vim-surround
+tpope/vim-unimpaired
+vim-scripts/todo-txt.vim
+yuratomo/dbg.vim
+mhinz/vim-signify
+junegunn/gv.vim
+vifm/vifm.vim
+ctrlpvim/ctrlp.vim
+rhysd/conflict-marker.vim
+jpalardy/vim-slime
+junegunn/goyo.vim
+ap/vim-css-color
diff --git a/.local/share/vim/colors/hyperred.vim b/.local/share/vim/colors/hyperred.vim
@@ -50,8 +50,8 @@ else
 	hi! ColorColumn guifg=Black ctermfg=Black guibg=LightGray ctermbg=LightGray
 	hi! Folded guifg=Blue ctermfg=Blue guibg=NONE ctermbg=NONE cterm=bold
 	hi! FoldColumn guifg=Blue ctermfg=Blue guibg=NONE ctermbg=NONE cterm=bold
-	hi! DiffChange guifg=NONE ctermfg=LightYellow guibg=LightYellow ctermbg=NONE
-	hi! DiffText guifg=NONE ctermfg=LightBlue guibg=LightBlue ctermbg=Yellow cterm=bold
+	hi! DiffChange guifg=NONE ctermfg=LightBlue guibg=LightBlue ctermbg=NONE
+	hi! DiffText guifg=NONE ctermfg=LightYellow guibg=LightYellow ctermbg=Yellow cterm=bold
 	hi! DiffAdd guibg=LightGreen ctermbg=LightGreen guifg=NONE ctermfg=NONE
 	hi! DiffDelete guifg=Red ctermfg=Red guibg=NONE ctermbg=NONE
 	hi! LineNr cterm=NONE gui=NONE guibg=NONE ctermbg=NONE guifg=LightGray ctermfg=LightGray

@@ -65,7 +65,7 @@ else
 	hi! Todo gui=underline,bold cterm=underline,bold ctermfg=White ctermbg=Red guifg=White guibg=Red
 	hi! Statement ctermfg=DarkRed guifg=DarkRed
 	hi! Comment ctermfg=DarkGray guifg=DarkGray
-	hi! Special cterm=bold gui=bold ctermbg=NONE ctermfg=LightBlue guibg=NONE guifg=LightBlue
+	hi! Special cterm=bold gui=bold ctermbg=NONE ctermfg=DarkBlue guibg=NONE guifg=Blue
 	hi! SpecialKey cterm=NONE ctermfg=Gray guifg=Gray
 	hi! NonText cterm=NONE ctermfg=LightGray guifg=LightGray
 	hi! Type gui=bold ctermfg=DarkYellow guifg=DarkYellow
diff --git a/.local/share/vim/keybindings.vim b/.local/share/vim/keybindings.vim
@@ -1,246 +0,0 @@
-" General keybindings
-inoremap <C-{> <esc>:
-nnoremap <C-{> :
-
-nnoremap <C-/> :vim9cmd scope#fuzzy#Grep('git grep')<cr>
-nnoremap <C-`> :terminal<cr>
-
-nnoremap <F4> :call SaveAndBuild()<cr>
-
-nnoremap <leader>co :botright copen<cr>
-nnoremap <leader>cs :cdo<space>s/
-nnoremap <leader>ec :call OpenSource("$XDG_HOME/.vimrc")<cr>
-nnoremap <leader>ek :call OpenSource("$XDG_DATA_HOME/vim/keybindings.vim")<cr>
-nnoremap <leader>et :set expandtab<cr>
-nnoremap <leader>fa :find *
-nnoremap <leader>ff :find *
-nnoremap <leader>lb :ls<cr>:b<space>
-nnoremap <leader>ld :ldo<space>s/
-nnoremap <leader>lo :lopen<cr>
-nnoremap <leader>ls :ldo<space>s/
-nnoremap <leader>pp :Rg<cr>
-nnoremap <leader>pv :packadd vimspector<cr>
-nnoremap <leader>sc :source $XDG_CONFIG_HOME/vim/vimrc<cr>
-nnoremap <leader>so :source %<cr>
-nnoremap <leader>spp :set paste<cr>
-nnoremap <leader>spa :set path+=**<cr>
-nnoremap <leader>tt :tabnew<cr>
-nnoremap <leader>ta :tab *
-nnoremap <leader>vg :vimgrep<space>
-nnoremap <leader>/ :cdo %s/
-nnoremap <leader>cd :cd %:p:h<cr>
-nnoremap <leader>gcd :Gcd<cr>
-nnoremap <leader>qd :cdo s/
-
-" Buffer Creation
-nnoremap <leader>sc :source $XDG_CONFIG_HOME/vim/vimrc<cr>
-nnoremap <leader>ss :split<cr>
-nnoremap <leader>vv :vsplit<cr>
-
-nnoremap <leader>ds :call DiffWithSaved()<cr>
-" TODO Add du to diff with undo
-" nnoremap <leader>ds :call DiffWithSaved()<cr>
-
-fun! SaveAndSuspend()
-    :w
-    :suspend
-endfun
-
-nnoremap <silent> <leader>zj :call NextClosedFold('j')<cr>
-nnoremap <silent> <leader>zk :call NextClosedFold('k')<cr>
-
-function! NextClosedFold(dir)
-    let cmd = 'norm!z'..a:dir
-    let view = winsaveview()
-    let [l0, l, open] = [0, view.lnum, 1]
-    while l != l0 && open
-        exe cmd
-        let [l0, l] = [l, line('.')]
-        let open = foldclosed(l) < 0
-    endwhile
-    if open
-        call winrestview(view)
-    endif
-endfunction
-
-
-" Control
-nnoremap <c-z> :call SaveAndSuspend()<cr>
-inoremap <c-z> :call SaveAndSuspend()<cr>
-
-" Accessible completions
-inoremap <c-l> <c-x><c-l>
-" Emacs line navigation in insert mode
-inoremap <c-a> <c-o>0
-inoremap <c-e> <c-o>A
-inoremap <c-k> <c-o>D
-inoremap <c-y> <c-o>p
-inoremap <c-f> <Right>
-inoremap <c-b> <Left>
-
-cnoremap <c-a> <home>
-cnoremap <c-e> <end>
-cnoremap <c-y> <c-r>"
-cnoremap <c-p> <c-f>
-cnoremap <c-f> <Right>
-cnoremap <c-b> <Left>
-
-nnoremap <c-x><c-f> :Explore<cr>/
-nnoremap <c-x><c-c> :q<cr>
-nnoremap <c-x><c-g> :G<cr>/
-nnoremap <c-x><c-s-g> :G<cr>
-nnoremap <c-x><c-d> :Debugger<cr>
-nnoremap <c-x><c-s> :w<cr>
-
-" Behave vim
-nnoremap Y y$
-nmap Q gzip
-
-if has("win32")
-    " TODO Check if alt is allowed along with win32 check?
-    nnoremap ë :cprev<cr>
-    nnoremap ê :cnext<cr>
-endif
-
-nnoremap <A-k> :cprev<cr>
-nnoremap <A-j> :cnext<cr>
-
-" development
-nnoremap <leader>oc :grepadd /:: %
-nnoremap <leader>oh :grepadd /:: %
-
-nnoremap <leader>fb :b *
-
-vnoremap <tab> >>
-
-" TODO reflect on whether <leader><leader> is productive, I keep hitting it
-" accidentally
-"nnoremap <leader><leader> :Rg<cr>
-
-fun! SetupCommandAlias(from, to)
-  exec 'cnoreabbrev <expr> '.a:from
-        \ .' ((getcmdtype() is# ":" && getcmdline() is# "'.a:from.'")'
-        \ .'? ("'.a:to.'") : ("'.a:from.'"))'
-endfun
-call SetupCommandAlias("W","w")
-call SetupCommandAlias("Wq","wq")
-call SetupCommandAlias("man","help")
-
-nnoremap <leader>tb :call ToggleBackground()<CR>
-nnoremap <leader>tl :call ToggleList()<CR>
-
-" useful
-nnoremap <leader>nn :set number<cr>
-
-" development
-nnoremap <M-F9> :call SaveAndBuild()<cr>
-inoremap <M-F9> :call SaveAndBuild()<cr>
-nnoremap <leader>bc :Make clean<CR>
-
-nnoremap <leader>fmv :call FileMvHelper()<CR>
-
-" Quick save and write
-nnoremap <leader>wq :wq<cr>
-nnoremap <leader>ww :w<cr>
-nnoremap <leader>qq :q<cr>
-
-" vim-fugitive
-nnoremap <leader>gb :G blame<cr>
-nnoremap <leader>dg :Gvdiff<CR>
-nnoremap <leader>gg :Ggrep -q <space>
-nnoremap <leader>gr :G reset %<cr>
-nnoremap <leader>gwq :Gwq<cr>
-nnoremap <leader>lg :Glgrep<space>
-
-
-" Generate ctags
-nnoremap<leader>gt :!sh -c "ctags `git ls-files`"<CR>
-
-nnoremap <C-L> :nohl<CR><C-L>
-
-" Markdown - Add checkbox mode?
-nnoremap <leader>cc :ChecklistToggleCheckbox<cr>
-nnoremap <leader>ct :ChecklistToggleCheckbox<cr>
-nnoremap <leader>ce :ChecklistEnableCheckbox<cr>
-
-let g:gutentags_file_list_command = 'rg --files'
-
-
-autocmd FileType markdown set cursorline
-
-" Hide and format markdown elements like **bold**
-autocmd FileType markdown set conceallevel=2
-
-nnoremap <leader>h1 :call QuickUnderline(1)<cr>
-nnoremap <leader>h2 :call QuickUnderline(2)<cr>
-
-fun! GotoWindow(id)
-    call win_gotoid(a:id)
-endfun
-
-
-fun! StartDebugging()
-    doautocmd User DebuggingStarted
-    :Termdebug .\payredu.exe<cr>
-endfun
-
-" Easy save
-nnoremap <esc>s :w<cr>
-
-" Fly through windows
-nnoremap <esc>h <c-w>h
-nnoremap <esc>j <c-w>j
-nnoremap <esc>k <c-w>k
-nnoremap <esc>l <c-w>l
-
-" Debugger remaps
-nnoremap <F5> :call StartDebugging()<cr>
-nnoremap <leader>dc :call GotoWindow(g:vimspector_session_windows.code)<CR>
-nnoremap <leader>dt :call GotoWindow(g:vimspector_session_windows.tagpage)<CR>
-nnoremap <leader>dv :call GotoWindow(g:vimspector_session_windows.variables)<CR>
-nnoremap <leader>dw :call GotoWindow(g:vimspector_session_windows.watches)<CR>
-" nnoremap <leader>ds :call GotoWindow(g:vimspector_session_windows.stack_trace)<CR>
-nnoremap <leader>do :call GotoWindow(g:vimspector_session_windows.output)<CR>
-nnoremap <S-F5> :call vimspector#Reset()<CR>
-
-nnoremap <leader>dtcb :call vimspector#CleanLineBreakpoint()<CR>
-
-fun! SetupDebuggingKeymaps()
-    nmap <> <Plug>VimspectorStepOver
-    nmap <c-i> <Plug>VimspectorStepInto
-    nmap <m-i> <Plug>VimspectorStepOut
-    nmap <c-s-r> <Plug>VimspectorRestart
-    nmap <F9> :Break<cr>
-    nmap <C-S-F9> :Clear<CR>
-    nmap <F5> :Continue<CR>
-    nmap <S-F5> :Finish<CR>
-endfun
-
-augroup debugmode
-    autocmd User DebuggingStarted :call SetupDebuggingKeymaps()
-augroup END
-
-nmap <leader>drc <Plug>VimspectorRunToCursor
-nmap <leader>dbp <Plug>VimspectorToggleBreakpoint
-nmap <leader>dcbp <Plug>VimspectorToggleConditionalBreakpoint
-
-nnoremap cn *``cgn
-nnoremap cN *``cgN
-let g:mc = "y/\\V\<C-r>=escape(@\", '/')\<CR>\<CR>"
-vnoremap <expr> cn g:mc . "``cgn"
-
-let g:ctrlp_map = '<F2>'
-nnoremap <F1> :CtrlPBuffer<cr>
-inoremap <F1> :CtrlPBuffer<cr>
-nnoremap <S-F1> :CtrlPMRU<cr>
-inoremap <S-F1> :CtrlPMRU<cr>
-"
-" TODO setup this up with fzf
-nnoremap <F2> :vim9cmd scope#fuzzy#GitFile()<cr>
-nnoremap <S-F2> :vim9cmd scope#fuzzy#File()<cr>
-
-nnoremap <F3> :vim9cmd call scope#fuzzy#Quickfix()<cr>
-
-if has('macunix')
-    :imap <D-V> ^O"+p
-en
diff --git a/.local/share/vim/plugin.vim b/.local/share/vim/plugin.vim
@@ -1,117 +0,0 @@
-" Strip the newline from the end of a string
-function! Chomp(str)
-  return substitute(a:str, '\n$', '', '')
-endfunction
-
-func! TryAndDelete()
-    try
-        source %
-        bdelete
-    catch
-        echom "Cannot source file '" .. expand('<afile>') .. "'"
-    endt
-endfunc
-
-func! OpenOnce(fi)
-    :exec "vsplit" a:fi
-    aug EphemeralBuffer
-        au!
-        au! BufWritePost <buffer> bdelete
-    aug END
-endfunc
-
-func! OpenSource(fi)
-    :exec "vsplit" a:fi
-    aug EphemeralBuffer
-        au! | au! BufWritePost <buffer> call TryAndDelete()
-    aug END
-endfunc
-
-" Find a file and pass it to cmd
-function! DmenuOpen(cmd)
-  let fname = Chomp(system("git ls-files | dmenu-mac -i -l 20 -p " . a:cmd))
-  if empty(fname)
-    return
-  endif
-  execute a:cmd . " " . fname
-endfunction
-
-" find file in git repo
-function! ChooseFile()
-  let dir = expand("%:h")
-  if empty(dir) | let dir = getcwd() | endif
-
-  let root = system("cd " . dir . " && git rev-parse --show-toplevel")
-  if v:shell_error != 0 | echo "Not in a git repo" | return | endif
-  let root = root[0:-2]
-
-  let selection = system("cd " . root . " && git ls-files -co --exclude-standard | choose")
-  if empty(selection) | echo "Canceled" | return | end
-
-  echo "Finding file..."
-  exec ":e " . root . "/" . selection
-endfunction
-
-function! DiffWithSaved()
-  let filetype=&ft
-  diffthis
-  vnew | r # | normal! 1Gdd
-  diffthis
-  exe "setlocal bt=nofile bh=wipe nobl noswf ro ft=" . filetype
-endfunction
-
-" Move to a file common to nvim and vim
-function! ToggleList()
-	if &list == "nolist"
-		set list
-	else
-		set nolist
-	endif
-endfunction
-
-function! ToggleBackground()
-	if &background == "light"
-		set background=dark
-	else
-		set background=light
-	endif
-endfunction
-
-function! FileMvHelper()
-	:normal! 0i"A"0y$A p0imv j0
-endfunction
-" Run Make
-
-function SaveAndBuild()
-    botright copen
-	wall
-	if exists(":Make")
-		Make
-	else
-		make
-	endif
-endfunction
-
-function QuickUnderline(n)
-	if a:n == 1
-		normal! yypv$r=
-	else
-		normal! yypv$r-
-	endif
-endfunction
-
-function ReverseDate()
-	normal! dt/wwpldeBP
-endfunction
-
-function! s:align()
-  let p = '^\s*|\s.*\s|\s*$'
-  if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
-    let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g'))
-    let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*'))
-    Tabularize/|/l1
-    normal! 0
-    call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
-  endif
-endfunction
-
diff --git a/.local/share/vim/plugins b/.local/share/vim/plugins
@@ -1,88 +0,0 @@
-907th/vim-auto-save
-AndrewRadev/tagalong.vim
-chrisbra/csv.vim
-dhruvasagar/vim-table-mode
-epheien/termdbg
-hattya/vcvars.vim
-ldrumm/compiler-explorer.vim
-mbbill/undotree
-PreciousChicken/vim-groff-viewer
-Shougo/vimproc.vim
-taoso/mru.vim
-torrancew/vim-openscad
-axvr/zepl.vim
-dense-analysis/ale
-#prabirshrestha/vim-lsp
-#mattn/vim-lsp-settings
-prabirshrestha/asyncomplete.vim
-axvr/org.vim
-img-paste-devs/img-paste.vim
-kristijanhusak/vim-dadbod-ui
-ledger/vim-ledger
-#hsanson/vim-android
-will133/vim-dirdiff
-tpope/vim-sleuth
-travisjeffery/vim-auto-mkdir
-https://sr.ht/~ackyshake/VimCompletesMe.vim
-jceb/vim-orgmode
-tpope/vim-speeddating
-padde/jump.vim
-#tomtom/tlib_vim
-#tomtom/ttodo_vim
-
-[opt]
-tpope/vim-obsession
-tpope/vim-commentary
-tpope/vim-dadbod
-tpope/vim-dispatch
-tpope/vim-fugitive
-tpope/vim-projectionist
-tpope/vim-repeat
-tpope/vim-surround
-tpope/vim-unimpaired
-vim-scripts/todo-txt.vim
-yuratomo/dbg.vim
-mhinz/vim-signify
-junegunn/gv.vim
-vifm/vifm.vim
-ctrlpvim/ctrlp.vim
-rhysd/conflict-marker.vim
-jpalardy/vim-slime
-junegunn/goyo.vim
-ap/vim-css-color
-
-#Bestoa/SearchComplete
-#bfrg/vim-fzy
-#cfdrake/vim-pbxproj
-#christoomey/vim-tmux-navigator
-#ervandew/supertab
-#evansalter/vim-checklist
-#ferranpm/vim-maildir
-#gfontenot/vim-xcode
-#https://git.sr.ht/~ackyshake/VimCompletesMe.vim
-#https://git.sr.ht/~torresjrjr/birck.vim
-#https://github.com/bfrg/vim-jqplay
-#jerrymarino/xcodebuild.vim
-#joereynolds/vim-minisnip/
-#kana/vim-submode
-#keith/swift.vim
-#mfussenegger/nvim-dap
-#nachumk/systemverilog.vim
-#neovim/nvim-lspconfig
-#notmuch-vim/notmuch-vim
-#ntpeters/vim-better-whitespace.git
-#omniSharp/omnisharp-vim
-#preservim/tagbar
-#puremourning/vimspector
-#radenling/vim-dispatch-neovim
-#rcarriga/nvim-dap-ui
-#terrortylor/nvim-comment
-#tommcdo/vim-ninja-feet.git
-#tpope/vim-vinegar
-#vim-scripts/gitignore
-#vim-scripts/SearchComplete
-#vim-scripts/vimacs
-#xolox/vim-easytags
-#xolox/vim-misc
-#yegappan/searchcomplete
-# psliwka/vim-smoothie # smooth scrolling for vim, it is good, but I personally don't need smooth scrolling
diff --git a/.profile b/.profile
@@ -1,12 +1,12 @@
 #!/bin/sh
-: ${XDG_ROOT:=$HOME}
+: ${XDG_HOME:=$HOME}
 
 set -a
 # XDG
-XDG_CONFIG_HOME="$XDG_ROOT/.config"
-XDG_DATA_HOME="$XDG_ROOT/.local/share"
-XDG_CACHE_HOME="$XDG_ROOT/.cache"
-XDG_STATE_HOME="$XDG_ROOT/.local/state"
+XDG_CONFIG_HOME="$XDG_HOME/.config"
+XDG_DATA_HOME="$XDG_HOME/.local/share"
+XDG_CACHE_HOME="$XDG_HOME/.cache"
+XDG_STATE_HOME="$XDG_HOME/.local/state"
 
 ABDUCO_SOCKET_DIR="$XDG_STATE_HOME"/abuco
 HISTFILE="$XDG_STATE_HOME"/history
diff --git a/.vimrc b/.vimrc
@@ -1,54 +1,43 @@
-let g:ale_floating_window_border = ['│', '─', '╭', '╮', '╯', '╰', '│', '─']
-let g:ale_floating_window_border = repeat([''], 8)
-let g:ale_completion_enabled = 1
-let g:ale_fixers = { 'c': [ 'astyle'] }
-let g:ale_linters = { 'javascript': ['quicklintjs'] }
-let g:ale_lint_on_enter = 1
-let g:ale_disable_lsp = 0
-
-let g:ale_lint_delay = 0
-let g:ale_lint_on_text_changed = 'always'
-if exists('#ALEEvents')
-  call ale#events#Init()
-endif
-
-"let g:lsp_use_native_client = 1
-"let g:lsp_diagnostics_virtual_text_enabled = 0
-"let g:lsp_diagnostics_enabled  = 1
-"let g:lsp_diagnostics_echo_cursor  = 1
-
-
 " Handle missing XDG_s gracefully
-if !exists("$XDG_HOME")
-    let $XDG_HOME = has("win32") ? expand("$USERPROFILE") : expand("$HOME")
-endif
-if !exists("$XDG_DATA_HOME") | let $XDG_DATA_HOME=expand("$XDG_HOME/.local/share") | endif
-if !exists("$XDG_CACHE_HOME") | let $XDG_CACHE_HOME=expand("$XDG_HOME/.cache") | endif
-
-if !exists("$VIM") | let $VIM=expand("$XDG_DATA_HOME/vim") | endif
+if isdirectory($XDG_CONFIG_HOME)
+	let $vcache = expand((empty($XDG_CACHE_HOME) ? "~/.cache"       : "$XDG_CACHE_HOME")  . "/vim")
+	let $vdata  = expand((empty($XDG_DATA_HOME)  ? "~/.local/share" : "$XDG_DATA_HOME")   . "/vim")
+	let $vstate = expand((empty($XDG_STATE_HOME) ? "~/.local/state" : "$XDG_STATE_HOME")  . "/vim")
+
+
+	set viminfofile=$vstate/viminfo
+	if expand($XDG_HOME) == expand("~")
+		set backupdir-=.
+		set directory-=.
+	else
+		set backupdir=$vstate/backup
+		set directory=$vstate/swap
+	endif
+	set undodir=$vstate/undo
 
-if has("&viminfofile") | set viminfofile=$XDG_CACHE_HOME/vim/viminfo | endif
+	set viewdir=$vstate/view
+	set rtp+=$vdata
+	set packpath^=$vdata
 
-set rtp+=$XDG_DATA_HOME/vim
+	let g:netrw_home = expand($vstate . "/netrw")
+endif
 
 filetype plugin indent on
 syntax on
 
-set packpath^=$XDG_DATA_HOME/vim
-
-source $XDG_DATA_HOME/vim/keybindings.vim
-
-let g:birck_default_chan="irc.libera.chat"
-
 " General
 set ai
 set exrc
 set hidden
+set lazyredraw
 set mouse=
 set nocompatible
 set noexpandtab
 set nofixendofline
+set nosol
+set scrolloff=0
 set shortmess=Iat
+
 if has("signs") | set signcolumn=yes | endif
 
 " Turn backup off

@@ -75,7 +64,6 @@ set expandtab
 " Disable status
 set laststatus=1
 
-set nolazyredraw
 set ttyfast
 set nospell
 

@@ -91,9 +79,9 @@ set updatetime=100
 
 au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
 
-let g:loaded_vimballPlugin = 1
-let g:loaded_vimball = 1
-let g:loaded_getscriptPlugin = 1
+"let g:loaded_vimballPlugin = 1
+"let g:loaded_vimball = 1
+"let g:loaded_getscriptPlugin = 1
 
 let maplocalleader=" "
 set complete-=i

@@ -103,97 +91,8 @@ set foldlevel=20
 set foldopen-=search
 
 
-" Debug
-let g:termdebug_config = {'sign': '>>', 'winbar': 0, 'wide':163}
-
-function! FZYFiles() abort
-	let l:tempname = tempname()
-	" fzf | awk '{ print $1":1:0" }' > file
-	execute 'silent !git ls-files --recurse-submodules | fzf > ' . fnameescape(l:tempname)
-	let l:tcontents = join(readfile(l:tempname))
-	try
-		" TODO Add option to add multiple files to argslist
-		"execute 'argadd ' . l:tcontents
-		 let bufnr = bufadd(l:tcontents)
-		call bufload(bufnr)
-		"call setbufline(bufnr, 1, ['some', 'text'])
-		execute 'edit ' . l:tcontents
-		redraw!
-	finally
-		call delete(l:tempname)
-	endtry
-endfunction
-
 set synmaxcol=1000
 
-let g:netrw_home = $XDG_DATA_HOME . "/vim"
-call mkdir($XDG_DATA_HOME . "/vim/spell", 'p')
-set viewdir=$XDG_DATA_HOME/vim/view | call mkdir(&viewdir, 'p')
-
-set backupdir=$XDG_CACHE_HOME/vim/backup | call mkdir(&backupdir, 'p')
-set directory=$XDG_CACHE_HOME/vim/swap   | call mkdir(&directory, 'p')
-set undodir=$XDG_CACHE_HOME/vim/undo     | call mkdir(&undodir,   'p')
-
-function! s:load_plugins(t) abort
-	packadd vim-commentary
-	packadd vim-surround
-	packadd vim-ninja-feet
-	packadd vim-fugitive
-	packadd vim-unimpaired
-	packadd vim-better-whitespace
-	packadd vim-dispatch
-	packadd ctrlp.vim
-    packadd conflict-marker.vim
-    packadd mru
-
-    call s:plugin_post_load()
-endfunction
-
-func! s:plugin_post_load()
-    let g:ctrlp_by_filename = 1
-    let g:ctrlp_reuse_window = 'netrw\|help\|quickfix'
-
-    let g:ctrlp_prompt_mappings = {
-            \ 'PrtSelectMove("j")':   ['<c-n>', '<down>'],
-            \'PrtSelectMove("k")':   ['<c-p>', '<up>'], 
-            \ 'PrtHistory(-1)':       ['<c-j>'],
-            \ 'PrtHistory(1)':        ['<c-k>'],
-            \ }
-
-    if executable('ag')
-        " Use Ag over Grep
-        set grepprg=ag\ --nogroup\ --nocolor
-
-        " Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
-        let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
-    endif
-
-
-    packadd termdebug
-    let g:termdebug_wide=163
-
-    if !has("win32")
-        packadd vim-tmux-navigator
-        packadd notmuch-vim
-        let g:notmuch_use_fzf = 1
-        let g:notmuch_open_command = 'fzf'
-        let g:notmuch_fzf_command = 'fzf --reverse'
-        let g:notmuch_use_conversation_view = 1
-        let sendmail_path = systemlist('sed -n "s/^set sendmail=\(.*\)$/\1/p; $!d" ~/.mailrc')
-        if len(sendmail_path) > 0
-            "let g:notmuch_sendmail=sendmail_path[]
-        endif
-    endif
-
-endfunc
-
-aug user_cmds
-	au!
-	au VimEnter * call timer_start(20, function('s:load_plugins'))
-aug END
-
-source $XDG_DATA_HOME/vim/plugin.vim
-
 if has("gui")
 	set guioptions=
 	set mouse=a

@@ -225,11 +124,6 @@ else
 	set shell=sh
 endif
 
-if !exists('g:undotree_WindowLayout')
-	let g:undotree_WindowLayout = 4
-	let g:undotree_ShortIndicators = 1
-endif
-
 if &term =~ 'xterm' || &term == 'win32'
 	" Use DECSCUSR escape sequences
 	let &t_SI = "\e[6 q"    " blink bar

@@ -239,9 +133,11 @@ if &term =~ 'xterm' || &term == 'win32'
 	let &t_te .= "\e[0 q"   " default (depends on terminal, normally blink block)
 endif
 
-let g:autojump_executable='autojump'
-let g:autojum_vim_command='j'
+if isdirectory($XDG_CONFIG_HOME)
+	source "$XDG_CONFIG_HOME/vim/plugin.vim"
+	source "$XDG_CONFIG_HOME/vim/keybindings.vim"
+endif
 
-if filereadable("$XDG_DATA_HOME/.config/vim/unstaged.vim")
-	source "$XDG_DATA_HOME/.config/vim/unstaged.vim"
+if filereadable("$XDG_CONFIG_HOME/vim/unstaged.vim")
+	source "$XDG_CONFIG_HOME/vim/unstaged.vim"
 endif