commit eea4fd70bc08454bf65f6a3ecdac21efabb2f4cf
parent 26977e8f902f2cef73b64de8d7a86f52e330612f
Author: Bharatvaj <bharatvaj@yahoo.com>
Date: Thu, 24 Aug 2023 05:55:07 +0530
Give up and use ~/.vimrc
Upload debug broken init.lua
Add support for ar in extract.sh
Use comfortable user-dirs.dirs
Add open_project function and it's alias 'op'
Add env to .profile to prevent . file creation in $HOME
Move .gitignore to .config/git/ignore
Proper alacritty.yml
Use mac specific unstaged file to .config/mac
Diffstat:
20 files changed, 376 insertions(+), 494 deletions(-)
diff --git a/.config/alacritty/alacritty.yml b/.config/alacritty/alacritty.yml
@@ -1,17 +1,5 @@
import:
- - ~/.config/alacritty/windows.yml
- - ~/.config/alacritty/unstaged.yml
-
-key_bindings:
- - { key: N, mods: Control|Shift, action: CreateNewWindow}
-
-colors:
- primary:
- background: '0x000000'
- foreground: '0xffffff'
- cursor:
- text: '0xF81CE5'
- cursor: '0xffffff'
+ - ~/.cache/alacritty_unstaged.yml
live_config_reload: true
@@ -21,6 +9,3 @@ bell:
selection:
save_to_clipboard: true
-# No title bar, use shortcuts
-window:
- decorations: none
diff --git a/.gitignore b/.config/git/ignore
diff --git a/.config/mac/.cache/alacritty_unstaged.yml b/.config/mac/.cache/alacritty_unstaged.yml
@@ -0,0 +1,8 @@
+font:
+ normal:
+ family: ProggyCleanTT
+ style: Regular
+
+# No title bar, use shortcuts
+# window:
+# decorations: none
diff --git a/.config/mac/hard.sh b/.config/mac/hard.sh
@@ -0,0 +1,11 @@
+#!/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
+
+# map caps lock to esc
+hidutil property --set '{"UserKeyMapping":[
+{
+ "HIDKeyboardModifierMappingSrc": 0x700000039,
+ "HIDKeyboardModifierMappingDst": 0x700000029
+ }
+]}'
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
@@ -33,9 +33,6 @@ vim.cmd([[
function load_plugns()
vim.cmd([[
- set packpath+=$XDG_DATA_HOME/vim
- packadd fzf
- packadd fzf.vim
packadd vim-fugitive
packadd vim-ninja-feet
packadd vim-surround
@@ -43,22 +40,18 @@ function load_plugns()
packadd vim-unimpaired
packadd vim-xcode
packadd vim-dispatch
-
- packadd nvim-dap
- packadd nvim-dap-ui
- packadd nvim-lspconfig
]])
- require"dapui".setup()
- require"lspconfig".clangd.setup{}
- require"unstaged"
+ --require"dapui".setup()
+ --require"lspconfig".clangd.setup{}
+ --require"unstaged"
- require('dap').adapters.cppdbg = {
- type = 'executable',
- command = 'lldb-vscode',
- name = 'cppdbg'
- }
+ --require('dap').adapters.cppdbg = {
+ -- type = 'executable',
+ -- command = 'lldb-vscode',
+ -- name = 'cppdbg'
+ --}
- require('dap.ext.vscode').load_launchjs(nil, { cppdbg = {'c', 'cpp'} })
+ --require('dap.ext.vscode').load_launchjs(nil, { cppdbg = {'c', 'cpp'} })
end
vim.defer_fn(function() load_plugns() end, 20)
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_CONFIG_HOME/vim/keybindings.vim]]
+vim.cmd[[source $XDG_DATA_HOME/vim/keybindings.vim]]
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(args)
diff --git a/.config/sh/aliases b/.config/sh/aliases
@@ -44,11 +44,14 @@ alias g=git
alias l=lfcd
alias le=less
alias m=smartmake
-alias v="VIMINIT='' nvim"
+alias v="$EDITOR"
alias x=extract.sh
-# [longhands]
+# [midlonghands]
+alias op='cd $(open_project "$HOME/repo" | fzf)'
alias girl='grep -irl'
alias gir='grep -ir'
+alias markdown=md2html
+alias fy='fzf | pbcopy'
alias voom='VIM_DIR=$XDG_DATA_HOME/vim voom'
diff --git a/.config/sh/functions b/.config/sh/functions
@@ -2,14 +2,24 @@ md() {
mkdir "$@" && cd "$@"
}
+open_project() {
+ # search only dirs
+ search_dir=${1:-.}
+ for i in $search_dir/*/; do
+ if [ -d "$i/.git" ]; then
+ echo "$i"
+ else
+ # if does not have .git, search the subdirs
+ open_project "$i"
+ fi
+ done
+}
+
attach() {
if there abduco && [ $# -eq 0 ]; then
sesh_name=$(abduco -l | tail -n +2 | cut -f3 | $FUZZER)
test -z "$sesh_name" && return
- abduco -a $sesh_name || {
- echo "Do you want to create session: $sesh_name? (press any key)";
- read a && abduco -c $sesh_name mtm;
- }
+ abduco -a $sesh_name || abduco -c $sesh_name mtm;
fi
[ $# -gt 0 ] && abduco -a $1
}
@@ -37,7 +47,7 @@ thwart() {
quickopen() {
if ! there "${FUZZER}"; then
printf '${FUZZER} not available\n'
- exit 1
+ return
fi
# TODO maybe add -type in the future TODO add $name
@@ -59,7 +69,7 @@ quickopen() {
cd "$somethin"
else
printf '%s: is neither a file nor a directory\n' "$somethin"
- exit 1
+ return
fi
}
diff --git a/.config/user-dirs.dirs b/.config/user-dirs.dirs
@@ -1,8 +1,8 @@
-XDG_DESKTOP_DIR="$XDG_DATA_HOME/desktop"
-XDG_DOCUMENTS_DIR="$XDG_DATA_HOME/documents"
-XDG_DOWNLOAD_DIR="$XDG_CACHE_HOME/downloads"
-XDG_MUSIC_DIR="$XDG_DATA_HOME/music"
-XDG_PICTURES_DIR="$XDG_DATA_HOME/pictures"
-XDG_PUBLICSHARE_DIR="$XDG_DATA_HOME/public"
-XDG_TEMPLATES_DIR="$XDG_DATA_HOME/templates"
-XDG_VIDEOS_DIR="$XDG_DATA_HOME/videos"
+XDG_DESKTOP_DIR="$XDG_ROOT/desktop"
+XDG_DOCUMENTS_DIR="$XDG_ROOT/documents"
+XDG_DOWNLOAD_DIR="$XDG_ROOT/downloads"
+XDG_MUSIC_DIR="$XDG_ROOT/music"
+XDG_PICTURES_DIR="$XDG_ROOT/pictures"
+XDG_PUBLICSHARE_DIR="$XDG_ROOT/public"
+XDG_TEMPLATES_DIR="$XDG_ROOT/templates"
+XDG_VIDEOS_DIR="$XDG_ROOT/videos"
diff --git a/.config/vim/keybindings.vim b/.config/vim/keybindings.vim
@@ -1,164 +0,0 @@
-" General keybindings
-nnoremap <leader>aa :argadd **<cr>
-nnoremap <leader>co :copen<cr>
-nnoremap <leader>cd :cdo<space>s/
-nnoremap <leader>cs :cdo<space>s/
-nnoremap <leader>ec :edit $XDG_CONFIG_HOME/vim/vimrc<cr>
-nnoremap <leader>ek :edit $XDG_CONFIG_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>
-" Buffer Creation
-nnoremap <leader>sc :source $XDG_CONFIG_HOME/vim/vimrc<cr>
-nnoremap <leader>ss :split<cr>
-nnoremap <leader>vv :vsplit<cr>
-nnoremap <leader>wd :call DiffWithSaved()<cr>
-
-" netrw keybindings
-nnoremap <leader>sf :Ex<cr>
-
-" Accessible completions
-inoremap <c-f> <c-x><c-f>
-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
-" Behave vim
-nnoremap Y y$
-
-" development
-nnoremap <leader>oc :grepadd /:: %
-nnoremap <leader>oh :grepadd /:: %
-
-nnoremap <leader>fb :b *
-
-fun! SaveAndBuild()
- :wall
- :Make
-endfun
-
-" quick navigation
-nnoremap \f :GFiles<cr>
-nnoremap \F :Files<cr>
-" TODO setup this up with fzf
-nnoremap \g :Ggrep<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 <leader>bb :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>gd :Gvdiff<CR>
-nnoremap <leader>gg :Ggrep<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 <CR> :noh<CR><CR>:<backspace>
-
-" Markdown - Add checkbox mode?
-nnoremap <leader>cc :ChecklistToggleCheckbox<cr>
-nnoremap <leader>ct :ChecklistToggleCheckbox<cr>
-nnoremap <leader>ce :ChecklistEnableCheckbox<cr>
-"nnoremap <leader>cd :ChecklistDisableCheckbox<cr>
-
-let g:gutentags_file_list_command = 'rg --files'
-
-" vim-fugitive
-nnoremap <leader>gg :Ggrep<space>
-nnoremap <leader>lg :Glgrep<space>
-
-autocmd FileType markdown set cursorline
-
-" Hide and format markdown elements like **bold**
-autocmd FileType markdown set conceallevel=2
-
-function QuickUnderline(n)
- if a:n == 1
- normal! yypv$r=
- else
- normal! yypv$r-
- endif
-endfunction
-
-function ReverseDate()
- normal! dt/wwpldeBP
-endfunction
-
-nnoremap <leader>h1 :call QuickUnderline(1)<cr>
-nnoremap <leader>h2 :call QuickUnderline(2)<cr>
-
-fun! GotoWindow(id)
- call win_gotoid(a:id)
-endfun
-
-" Debugger remaps
-nnoremap <leader>dd :call vimspector#Launch()<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 <leader>de :call vimspector#Reset()<CR>
-
-nnoremap <leader>dtcb :call vimspector#CleanLineBreakpoint()<CR>
-
-nmap <leader>dl <Plug>VimspectorStepInto
-nmap <leader>dj <Plug>VimspectorStepOver
-nmap <leader>dk <Plug>VimspectorStepOut
-nmap <leader>d_ <Plug>VimspectorRestart
-nnoremap <leader>d<space> :call vimspector#Continue()<CR>
-
-nmap <leader>drc <Plug>VimspectorRunToCursor
-nmap <leader>dbp <Plug>VimspectorToggleBreakpoint
-nmap <leader>dcbp <Plug>VimspectorToggleConditionalBreakpoint
-
-" nb
-" TODO open a fuzzy finder quickly. Even better use fuzzy finder without chdir
-nnoremap <leader>nb :chdir $NB_PATH<cr>
-
-nnoremap cn *``cgn
-nnoremap cN *``cgN
-let g:mc = "y/\\V\<C-r>=escape(@\", '/')\<CR>\<CR>"
-vnoremap <expr> cn g:mc . "``cgn"
diff --git a/.config/vim/plugin/plugin.vim b/.config/vim/plugin/plugin.vim
@@ -1,76 +0,0 @@
-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()
- wall
- Make
-endfunction
-
-" TODO load this automatically
-source $XDG_CONFIG_HOME/vim/ftplugin/cpp.vim
-
-
-" Mail
-set rtp+=~/.local/share/nvim/pack/general/start/himalaya/vim
-
-
-let g:birck_default_chan="irc.libera.chat"
-
-" Strip the newline from the end of a string
-function! Chomp(str)
- return substitute(a:str, '\n$', '', '')
-endfunction
-
-" 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
-
-
diff --git a/.config/vim/vimrc b/.config/vim/vimrc
@@ -1,124 +0,0 @@
-if has('nvim')
- luafile ~/.config/nvim/init.lua
- finish
-else
- if has("&viminfofile")
- set viminfofile=$XDG_CACHE_DIR/vim/viminfo
- endif
-endif
-
-set complete-=i
-
-" General
-set nocompatible
-set mouse=
-set cursorline
-if has('cursorlineopt')
- set cursorlineopt=number
-endif
-set exrc
-
-" Turn backup off
-set nobackup
-set nowb
-set noswapfile
-
-" Map leader to space
-nnoremap <space> <Nop>
-let mapleader = " "
-
-" Enable hidden buffers
-set hidden
-
-" Disable auto fixing end of line
-" Useful when opening binary files
-set nofixendofline
-
-" Disable vim intro message
-set shortmess=Iat
-
-" Search
-set hlsearch
-set incsearch
-set nowrapscan
-
-" Pro tab
-filetype plugin indent on
-set tabstop=4
-set shiftwidth=4
-set expandtab
-
-" Netrw customization
-let g:netrw_banner = 0
-let g:netrw_liststyle = 3
-
-" Disable status
-set laststatus=1
-
-set lazyredraw
-set ttyfast
-set nospell
-
-syntax on indent off
-
-" Plugins
-source $XDG_CONFIG_HOME/vim/plugin/plugin.vim
-
-" Keybindings
-source $XDG_CONFIG_HOME/vim/keybindings.vim
-
-" Common vimrc
-source $XDG_DATA_HOME/vim/vimrc
-
-set packpath^=$XDG_DATA_HOME/vim
-
-function! s:load_plugins(t) abort
- set synmaxcol=128
- " Use XDG Paths for vim
- " TODO compile hard constants somewhere based on OS
- set runtimepath^='$XDG_CONFIG_HOME/vim'
- set runtimepath+='$XDG_DATA_HOME/vim'
- set runtimepath+='$XDG_CONFIG_HOME/vim/after'
-
- 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')
- packadd fzf
- packadd fzf.vim
- packadd vim-tmux-navigator
- packadd vim-commentary
- packadd vim-surround
- packadd vim-ninja-feet
- packadd vim-fugitive
- packadd vim-unimpaired
- packadd vim-better-whitespace
- packadd notmuch-vim
- packadd vim-dispatch
- 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[0]
- endif
-endfunction
-augroup user_cmds
- autocmd!
- autocmd VimEnter * call timer_start(20, function('s:load_plugins'))
-augroup END
-
-if has("gui")
- source $XDG_CONFIG_HOME/vim/gvimrc
-endif
-
-if has("win32")
- set shell=cmd
- set shellquote=\"
- " shellxquote must be a literal space character.
- set shellxquote=
-endif
diff --git a/.gitmodules b/.gitmodules
@@ -1,21 +0,0 @@
-[submodule ".local/share/vim/pack/general/opt/vim-better-whitespace"]
- path = .config/nvim/vim-vinegar
- url = https://github.com/tpope/vim-vinegar
-[submodule ".local/share/nvim/pack/general/start/vim-vinegar"]
- path = .local/share/vim/pack/general/start/vim-vinegar
- url = https://github.com/tpope/vim-vinegar
-[submodule ".local/share/vim/pack/general/opt/birck.vim"]
- path = .local/share/vim/pack/general/opt/vim-ninja-feet/birck.vim
- url = https://git.sr.ht/~torresjrjr/birck.vim
-[submodule ".local/share/vim/pack/general/opt/vim-maildir"]
- path = .local/share/vim/pack/general/opt/vim-maildir
- url = https://github.com/ferranpm/vim-maildir
-[submodule ".local/share/nvim/pack/dev/opt/nvim-dap-ui"]
- path = .local/share/nvim/pack/dev/opt/nvim-dap-ui
- url = https://github.com/rcarriga/nvim-dap-ui
-[submodule ".local/share/nvim/pack/dev/start/nvim-lspconfig"]
- path = .local/share/nvim/pack/dev/opt/nvim-lspconfig
- url = https://github.com/neovim/nvim-lspconfig
-[submodule ".local/share/vim/pack/dev/start/omnisharp-vim"]
- path = .local/share/vim/pack/dev/start/omnisharp-vim
- url = https://github.com/OmniSharp/omnisharp-vim
diff --git a/.local/bin/sh/cam b/.local/bin/sh/cam
@@ -5,5 +5,5 @@ c_os="$(uname -s)"
if [ "$c_os" == "Windows_NT" ]; then
ffplay -f dshow -i video="Integrated Webcam"
else
- ffplay -f avfoundation -i 1:0 -video_size 1280x720 -framerate 30
+ ffplay -f avfoundation -i 0:0 -video_size 1280x720 -framerate 30
fi
diff --git a/.local/bin/sh/extract.sh b/.local/bin/sh/extract.sh
@@ -7,6 +7,7 @@
test $# -lt 1 && { printf "Usage: $(basename $0) <archive>\n"; exit 1; }
test -f $1 || { printf "$0: $1: No such file \n"; exit 1; }
case $1 in
+ *.a) ar x "$1" ;;
*.z) 7z x "$1" ;;
*.bz2) bzip2 -d "$1" ;;
*.bz) bzip2 -d "$1" ;;
diff --git a/.local/run/.gitkeep b/.local/run/.gitkeep
diff --git a/.local/share/vim/plugins b/.local/share/vim/plugins
@@ -1,32 +1,39 @@
-cfdrake/vim-pbxproj
-christoomey/vim-tmux-navigator
-evansalter/vim-checklist
-ferranpm/vim-maildir
-gfontenot/vim-xcode
-jerrymarino/xcodebuild.vim
-joereynolds/vim-minisnip/
-junegunn/fzf
-junegunn/fzf.vim
-kana/vim-submode
-keith/swift.vim
-nachumk/systemverilog.vim
-ntpeters/vim-better-whitespace.git
-omniSharp/omnisharp-vim
-pope/vim-repeat.git
-radenling/vim-dispatch-neovim
-tommcdo/vim-ninja-feet.git
-tpope/vim-commentary.git
+tpope/vim-commentary
tpope/vim-dispatch
tpope/vim-fugitive
-tpope/vim-surround.git
+tpope/vim-surround
tpope/vim-unimpaired
-tpope/vim-vinegar
-tpope/vim-vinegar
-vim-scripts/gitignore
-torrancew/vim-openscad
-yegappan/mru
-https://github.com/bfrg/vim-jqplay
-notmuch-vim/notmuch-vim
+tpope/vim-repeat
+natebosch/vim-lsc
+dradtke/vim-dap
+Bestoa/SearchComplete
+tpope/vim-projectionist
+junegunn/goyo.vim
+
+#cfdrake/vim-pbxproj
+#ervandew/supertab
+#vim-scripts/vimacs
+#vim-scripts/SearchComplete
+#christoomey/vim-tmux-navigator
+#evansalter/vim-checklist
+#ferranpm/vim-maildir
+#https://github.com/bfrg/vim-jqplay
+#joereynolds/vim-minisnip/
+#nachumk/systemverilog.vim
+#notmuch-vim/notmuch-vim
+#ntpeters/vim-better-whitespace.git
+#radenling/vim-dispatch-neovim
+#tommcdo/vim-ninja-feet.git
+#torrancew/vim-openscad
+#yegappan/mru
+
+#vim-scripts/gitignore
+#kana/vim-submode
+#omniSharp/omnisharp-vim
+#bfrg/vim-fzy
+#jerrymarino/xcodebuild.vim
+#gfontenot/vim-xcode
+#keith/swift.vim
# https://git.sr.ht/~torresjrjr/birck.vim
# rcarriga/nvim-dap-ui
diff --git a/.local/share/vim/vimrc b/.local/share/vim/vimrc
@@ -2,9 +2,12 @@ set packpath^=$XDG_DATA_HOME/vim
let g:minisnip_dir=$XDG_DATA_HOME . '/vim/minisnip'
+set nocursorline
set background=dark
source $XDG_DATA_HOME/vim/hyper-red.vim
+set noexpandtab
+
set path+=**
set wildignore+=**/out/**
diff --git a/.profile b/.profile
@@ -5,59 +5,61 @@
export XDG_CONFIG_HOME="$XDG_ROOT/.config"
export XDG_DATA_HOME="$XDG_ROOT/.local/share"
export XDG_CACHE_HOME="$XDG_ROOT/.cache"
-export XDG_RUNTIME_HOME="$XDG_ROOT/.runtime"
+export XDG_RUNTIME_DIR="$XDG_ROOT/.local/run"
+export XDG_STATE_HOME="$XDG_ROOT/.local/state"
-export XDG_DESKTOP_DIR="$XDG_DATA_HOME/desktop"
-export XDG_DOCUMENTS_DIR="$XDG_DATA_HOME/documents"
-export XDG_DOWNLOAD_DIR="$XDG_CACHE_HOME/downloads"
-export XDG_MUSIC_DIR="$XDG_DATA_HOME/music"
-export XDG_PICTURES_DIR="$XDG_DATA_HOME/pictures"
-export XDG_PUBLICSHARE_DIR="$XDG_DATA_HOME/public"
-export XDG_TEMPLATES_DIR="$XDG_DATA_HOME/templates"
-export XDG_VIDEOS_DIR="$XDG_DATA_HOME/videos"
+export ABDUCO_SOCKET_DIR="$XDG_STATE_HOME"/abuco
+export LESSHISTFILE="$XDG_STATE_HOME"/lesshst
# Global programs
-export VIMINIT="if !has('nvim')
-source $XDG_CONFIG_HOME/vim/vimrc
-endif"
+export BUNDLE_USER_CONFIG="$XDG_CONFIG_HOME"/bundle
+export DOCKER_CONFIG="$XDG_CONFIG_HOME"/docker
+export ELINKS_CONFDIR="$XDG_CONFIG_HOME/elinks"
+export INPUTRC="$XDG_CONFIG_HOME"/readline/inputrc
export LESSHISTFILE=-
export LYNX_CFG="$XDG_CONFIG_HOME/lynx/lynx.cfg"
export LYNX_LSS="$XDG_CONFIG_HOME/lynx/lynx.lss"
-export PSQLRC="$XDG_CONFIG_HOME/pg/psqlrc"
+export NOTMUCH_CONFIG="$XDG_CONFIG_HOME/notmuch/config"
+export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME"/npm/npmrc
+export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc"
+export PARALLEL_HOME="$XDG_CONFIG_HOME"/parallel
export PGPASSFILE="$XDG_CONFIG_HOME/pg/pgpass"
export PGSERVICEFILE="$XDG_CONFIG_HOME/pg/pg_service.conf"
+export PSQLRC="$XDG_CONFIG_HOME/pg/psqlrc"
+export SCREENRC="$XDG_CONFIG_HOME"/screen/screenrc
export TASKRC="$XDG_CONFIG_HOME/task/taskrc"
+export WGETRC="$XDG_CONFIG_HOME/wgetrc"
+export XAUTHORITY="$XDG_RUNTIME_DIR"/Xauthority
export XINITRC="$XDG_CONFIG_HOME"/X11/xinitrc
export XSERVERRC="$XDG_CONFIG_HOME"/X11/xserverrc
-export XAUTHORITY="$XDG_RUNTIME_DIR"/Xauthority
-export WGETRC="$XDG_CONFIG_HOME/wgetrc"
-export SCREENRC="$XDG_CONFIG_HOME"/screen/screenrc
-export DOCKER_CONFIG="$XDG_CONFIG_HOME"/docker
-export INPUTRC="$XDG_CONFIG_HOME"/readline/inputrc
-export NOTMUCH_CONFIG="$XDG_CONFIG_HOME/notmuch/config"
-export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc"
-export ELINKS_CONFDIR="$XDG_CONFIG_HOME/elinks"
+export ANDROID_HOME="$XDG_DATA_HOME"/android
+export BUNDLE_USER_PLUGIN="$XDG_DATA_HOME"/bundle
+export CARGO_HOME="$XDG_DATA_HOME"/cargo
export FFMPEG_DATADIR="$XDG_DATA_HOME"/ffmpeg
+export GEM_HOME="$XDG_DATA_HOME"/gem
export GNUPGHOME="$XDG_DATA_HOME/gnupg"
-export NODE_REPL_HISTORY="$XDG_DATA_HOME"/node_repl_history
-export PASSWORD_STORE_DIR="$XDG_DATA_HOME"/pass
-export HISTFILE="$XDG_DATA_HOME"/history
-export RUSTUP_HOME="$XDG_DATA_HOME"/rustup
-export MACHINE_STORAGE_PATH="$XDG_DATA_HOME"/docker-machine
export GOPATH="$XDG_DATA_HOME"/go
-export NB_PATH="$XDG_DATA_HOME/notebook"
-export CARGO_HOME="$XDG_DATA_HOME"/cargo
-export GEM_HOME="$XDG_DATA_HOME"/gem
-export VSCODE_PORTABLE="$XDG_DATA_HOME/vscode"
export GRADLE_USER_HOME="$XDG_DATA_HOME"/gradle
-export SQLITE_HISTORY="$XDG_DATA_HOME/sqlite_history"
+export HISTFILE="$XDG_DATA_HOME"/history
+export MACHINE_STORAGE_PATH="$XDG_DATA_HOME"/docker-machine
export MYSQL_HISTFILE="$XDG_DATA_HOME/mysql_history"
+export NB_PATH="$XDG_DATA_HOME/notebook"
+export NODE_REPL_HISTORY="$XDG_DATA_HOME"/node_repl_history
+export PASSWORD_STORE_DIR="$XDG_DATA_HOME"/pass
+export RUSTUP_HOME="$XDG_DATA_HOME"/rustup
export SONGDL_HOME="${XDG_DATA_HOME}/music/"
+export SQLITE_HISTORY="$XDG_DATA_HOME/sqlite_history"
+export TERMINFO="$XDG_DATA_HOME"/terminfo
+export TERMINFO_DIRS="$XDG_DATA_HOME"/terminfo:/usr/share/terminfo
+export VSCODE_PORTABLE="$XDG_DATA_HOME/vscode"
+export W3M_DIR="$XDG_DATA_HOME"/w3m
+export _Z_DATA="$XDG_DATA_HOME/z"
-export PSQL_HISTORY="$XDG_CACHE_HOME/pg/psql_history"
-export NUGET_PACKAGES="$XDG_CACHE_HOME"/NuGetPackages
+export BUNDLE_USER_CACHE="$XDG_CACHE_HOME"/bundle
export GEM_SPEC_CACHE="$XDG_CACHE_HOME"/gem
+export NUGET_PACKAGES="$XDG_CACHE_HOME"/NuGetPackages
+export PSQL_HISTORY="$XDG_CACHE_HOME/pg/psql_history"
# Make `history` print timestamp
HISTTIMEFORMAT="%F %T "
diff --git a/.vimrc b/.vimrc
@@ -0,0 +1,244 @@
+syntax on indent off
+if has("&viminfofile")
+ set viminfofile=$XDG_CACHE_DIR/vim/viminfo
+endif
+
+" reject netrw, embrace ls
+"let loaded_netrwPlugin = 1
+
+set complete-=i
+set foldmethod=marker
+set foldmarker={,}
+set foldlevel=20
+set foldopen-=search
+
+" General
+set nocompatible
+set mouse=
+set cursorline
+if has('cursorlineopt')
+ set cursorlineopt=number
+endif
+set exrc
+
+" Turn backup off
+set nobackup
+set nowb
+set noswapfile
+
+" Map leader to space
+nnoremap <space> <Nop>
+let mapleader = " "
+
+" Enable hidden buffers
+set hidden
+
+" Disable auto fixing end of line
+" Useful when opening binary files
+set nofixendofline
+
+" Disable vim intro message
+set shortmess=Iat
+set shortmess-=F
+
+" Search
+set hlsearch
+set incsearch
+set nowrapscan
+
+" Pro tab
+filetype plugin indent on
+set tabstop=4
+set shiftwidth=4
+set expandtab
+
+" Netrw customization
+let g:netrw_banner = 0
+let g:netrw_liststyle = 3
+let g:netrw_fastbrowse= 2
+
+" Disable status
+set laststatus=1
+
+set nolazyredraw
+set ttyfast
+set nospell
+
+
+" Common vimrc
+source $XDG_DATA_HOME/vim/vimrc
+
+source $XDG_DATA_HOME/vim/keybindings.vim
+
+set packpath^=$XDG_DATA_HOME/vim
+
+function! FZYFiles() abort
+ let l:tempname = tempname()
+ " fzf | awk '{ print $1":1:0" }' > file
+ execute 'silent !git ls-files --recurse-submodules | fzy > ' . 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
+let g:lsc_server_commands = {'cpp': 'clangd --log=error'}
+let g:lsc_auto_map = {
+ \ 'GoToDefinition': '<C-]>',
+ \ 'GoToDefinitionSplit': ['<C-W>]', '<C-W><C-]>'],
+ \ 'FindReferences': 'gr',
+ \ 'FindImplementations': 'gI',
+ \ 'FindCodeActions': 'ga',
+ \ 'Rename': 'gR',
+ \ 'ShowHover': v:true,
+ \ 'DocumentSymbol': 'go',
+ \ 'WorkspaceSymbol': 'gS',
+ \ 'SignatureHelp': 'gm',
+ \ 'Completion': 'completefunc',
+ \}
+let g:lsc_enable_autocomplete = v:true
+let g:lsc_enable_diagnostics = v:true
+let g:lsc_reference_highlights = v:false
+let g:lsc_trace_level = 'off'
+
+function! s:load_plugins(t) abort
+ set synmaxcol=128
+ " Use XDG Paths for vim
+ " TODO compile hard constants somewhere based on OS
+ set runtimepath^='$XDG_CONFIG_HOME/vim'
+ set runtimepath+='$XDG_DATA_HOME/vim'
+ set runtimepath+='$XDG_CONFIG_HOME/vim/after'
+
+ 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')
+ packadd vim-tmux-navigator
+ packadd vim-commentary
+ packadd vim-surround
+ packadd vim-ninja-feet
+ packadd vim-fugitive
+ packadd vim-unimpaired
+ packadd vim-better-whitespace
+ packadd notmuch-vim
+ packadd vim-dispatch
+ 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[0]
+ endif
+endfunction
+augroup user_cmds
+ autocmd!
+ autocmd VimEnter * call timer_start(20, function('s:load_plugins'))
+augroup END
+
+if has("gui")
+ source $XDG_CONFIG_HOME/vim/gvimrc
+endif
+
+if has("win32")
+set shell=cmd
+ set shellquote=\"
+ " shellxquote must be a literal space character.
+ set shellxquote=
+else
+ set shell=sh
+endif
+
+" 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()
+ wall
+ Make
+endfunction
+
+function QuickUnderline(n)
+ if a:n == 1
+ normal! yypv$r=
+ else
+ normal! yypv$r-
+ endif
+endfunction
+
+function ReverseDate()
+ normal! dt/wwpldeBP
+endfunction
+
+
+" TODO load this automatically
+source $XDG_CONFIG_HOME/vim/ftplugin/cpp.vim
+
+let g:birck_default_chan="irc.libera.chat"
+
+" Strip the newline from the end of a string
+function! Chomp(str)
+ return substitute(a:str, '\n$', '', '')
+endfunction
+
+" 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
+