dotfiles

Cross platform dotfiles for linux, mac and windows
git clone git@getsh.org:dotfiles.git
Log | Files | Refs

commit 631550db14e2c487123f5581a5073973caae5689
parent 7a66a89b959e1210431772e5c819557030c3ac4d
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date:   Sun, 25 Jun 2023 03:54:46 +0530

Merge branch 'main' of github.com:bharatvaj/dotfiles

Diffstat:
M.bash_profile | 6+++---
M.config/.gitignore | 2--
M.config/alacritty/alacritty.yml | 1-
D.config/bash/aliases | 4----
D.config/bash/bashrc | 9---------
D.config/bash/plugin/shorthand | 9---------
M.config/git/config | 10+++++++---
M.config/nvim/init.lua | 40+++++++++++++++++++++++-----------------
M.config/nvim/lua/keybindings.lua | 130+------------------------------------------------------------------------------
M.config/sh/aliases | 14+++++++-------
M.config/sh/functions | 88++++++++++++++++++++++++++++++++++++++++++++-----------------------------------
M.config/vim/keybindings.vim | 64++++++++++++++++++++++++++++++++++++++++++++++++++++++----------
M.config/vim/plugin/plugin.vim | 11+++++++++++
M.config/vim/vimrc | 15++++++++++++++-
A.local/bin/sh/extract.sh | 25+++++++++++++++++++++++++
M.local/share/vim/plugins | 44+++++++++++++++++++++++++-------------------
M.profile | 25+++++++++++++------------
17 files changed, 232 insertions(+), 265 deletions(-)

diff --git a/.bash_profile b/.bash_profile @@ -1,4 +1,4 @@ -[ -n "$1" ] && XDG_ROOT="$1" || XDG_ROOT="$HOME" - [ -f "${XDG_ROOT}"/.profile ] && . "${XDG_ROOT}"/.profile -[ -f "${XDG_CONFIG_HOME}"/bash/bashrc ] && . "${XDG_CONFIG_HOME}"/bash/bashrc +set -o vi +PS1='\w> ' +[ -f "$XDG_CONFIG_HOME/bash_unstaged" ] && . "$XDG_CONFIG_HOME/bash_unstaged" diff --git a/.config/.gitignore b/.config/.gitignore @@ -8,8 +8,6 @@ !X11/xinitrc !alacritty/ !alacritty/** -!bash/ -!bash/bashrc !clink !clink/clink_settings !cmd/ diff --git a/.config/alacritty/alacritty.yml b/.config/alacritty/alacritty.yml @@ -1,5 +1,4 @@ import: - - ~/.config/alacritty/mac.yml - ~/.config/alacritty/windows.yml - ~/.config/alacritty/unstaged.yml diff --git a/.config/bash/aliases b/.config/bash/aliases @@ -1,4 +0,0 @@ -which startx >&/dev/null && alias startx="startx \"$XDG_CONFIG_HOME/X11/xinitrc\" vt1" -which wget >&/dev/null && alias wget="wget --hsts-file=\"$XDG_CACHE_HOME/wget-hsts\"" -which nvim >&/dev/null && alias vim="nvim" && alias vi="nvim" -which elinks >&/dev/null && alias elinks="elinks ddg.gg" diff --git a/.config/bash/bashrc b/.config/bash/bashrc @@ -1,9 +0,0 @@ -set -o vi - -PATH_EXPORTS=( "${ESSENTIAL_PATH_EXPORTS[@]}" "${OTHER_PATH_EXPORTS[@]}" ) - -export PATH="${PATH}:${PATH_EXPORTS[*]}" - -PS1='\w> ' - -[ -f "$XDG_CONFIG_HOME/bash/unstaged" ] && . "$XDG_CONFIG_HOME/bash/unstaged" diff --git a/.config/bash/plugin/shorthand b/.config/bash/plugin/shorthand @@ -1,9 +0,0 @@ -# One letter bindings for important commands - -[ ! -z "${EDITOR}" ] && alias e=${EDITOR} - -alias c=clear - -which git >&/dev/null && alias g=git - -which pass >&/dev/null & alias p=pass diff --git a/.config/git/config b/.config/git/config @@ -7,6 +7,8 @@ cl = clone cm = commit --message co = checkout + cot = checkout --theirs + coo = checkout --ours con = config d = diff ds = diff --staged @@ -20,9 +22,11 @@ pu = push put = push --tags puo = push -u origin - rs = remote set-url - rso = remote set-url origin - rv = remote --verbose + r = reset + rs = reset --soft + res = remote set-url + reso = remote set-url origin + rev = remote --verbose sm = submodule st = status suir = submodule update --init --recursive diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua @@ -2,8 +2,6 @@ vim.g.mapleader = ' ' local set = vim.opt local g = vim.g -set.packpath="$XDG_DATA_HOME/nvim" - g.loaded_node_provider = 0 g.loaded_ruby_provider = 0 g.loaded_perl_provider = 0 @@ -30,30 +28,38 @@ g.netrw_banner = 0 g.netrw_liststyle = 3 vim.cmd([[ -" TODO use lua api -source $XDG_DATA_HOME/vim/vimrc + source $XDG_DATA_HOME/vim/hyper-red.vim +]]) -function! s:load_plugins(t) abort +function load_plugns() + vim.cmd([[ + set packpath+=$XDG_DATA_HOME/vim + packadd fzf packadd fzf.vim - packadd nvim-dap - packadd nvim-dap-ui - packadd nvim-lspconfig packadd vim-fugitive packadd vim-ninja-feet packadd vim-surround packadd vim-tmux-navigator packadd vim-unimpaired packadd vim-xcode + packadd vim-dispatch - lua require"dapui".setup() - lua require"lspconfig".clangd.setup{} - lua require"unstaged" -endfunction + packadd nvim-dap + packadd nvim-dap-ui + packadd nvim-lspconfig + ]]) + require"dapui".setup() + require"lspconfig".clangd.setup{} + require"unstaged" -augroup user_cmds - autocmd! - autocmd VimEnter * call timer_start(20, function('s:load_plugins')) -augroup END -]]) + require('dap').adapters.cppdbg = { + type = 'executable', + command = 'lldb-vscode', + name = 'cppdbg' + } + + 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,26 +1,6 @@ --- keybindings local set = vim.opt -function save_and_build() --- TODO require vim-dispatch - vim.cmd('wall') - vim.cmd('Make') -end - -function toggle_list(is_local_buffer) - -- TODO implement toggle for all buffers - local optset=vim.o - if optset.list then - optset.list=false - else - optset.list=true - end -end - local map = vim.keymap.set -map('n', "U", '<c-r>') -map('n', "<c-r>", '"') - -map('n', "z/", ':%s/') +vim.cmd[[source $XDG_CONFIG_HOME/vim/keybindings.vim]] vim.api.nvim_create_autocmd('LspAttach', { callback = function(args) @@ -41,49 +21,13 @@ vim.api.nvim_create_autocmd('LspAttach', { end }) -vim.cmd([[ -function! DiffWithSaved() - let filetype=&ft - diffthis - vnew | r # | normal! 1Gdd - diffthis - exe "setlocal bt=nofile bh=wipe nobl noswf ro ft=" . filetype -endfunction -]]) - function file_mv_helper() vim.cmd('normal! 0i"A"0y$A p0imv j0') end -- general -map("n", "<leader>aa", ":argadd **<cr>") -map("n", "<leader>co", ":copen<cr>") -map("n", "<leader>cd", ":cdo<space>s/") map("n", "<leader>ec", ":edit $XDG_CONFIG_HOME/nvim/init.lua<cr>") -map("n", "<leader>ek", ":edit $XDG_CONFIG_HOME/nvim/lua/keybindings.lua<cr>") -map("n", "<leader>et", ":set expandtab<cr>") -map("n", "<leader>lb", ":ls<CR>:b<space>") -map("n", "<leader>lo", ":lopen<cr>") -map("n", "<leader>ld", ":ldo<space>s/") -map("n", "<leader>p", ":Rg<cr>") map("n", "<leader>sc", ":source $XDG_CONFIG_HOME/nvim/init.lua<cr>") -map("n", "<leader>so", ":source %<cr>") -map("n", "<leader>spp", ":set paste<cr>") -map("n", "<leader>spa", ":set path+=**<cr>") -map("n", "<leader>tl", ":lua toggle_list(true)<CR>") -map("n", "<leader>tt", ":tabnew<cr>") -map("n", "<leader>vg", ":vimgrep<space>") -map("n", "<leader>wd", ":call DiffWithSaved()<cr>") - --- quick write and quit -map("n", "<Leader>qq", ":q<CR>") -map("n", "<Leader>ww", ":w<CR>") -map("n", "<leader><cr>", ":noh<CR>") - --- buffers -map("n", "<leader>sc", ":source ~/.config/vim/vimrc<enter>") -map("n", "<leader>ss", ":split<enter>") -map("n", "<leader>vv", ":vsplit<enter>") -- nvim-dap map("n", "<leader>dd", ":lua require'dap'.continue()<cr>") @@ -108,77 +52,5 @@ map("n", "<leader>dcb", ":lua require'dap'.ToggleConditionalBreakpoint()") -- map("n", "<leader>do", ":call GotoWindow(require'dap'.session_windows.output)<CR>") -- map("n", "<leader>dtcb", ":call vimspector#CleanLineBreakpoint()<CR>") -map("n", "<leader>bb", ":lua save_and_build()<CR>") -map("n", "<leader>bc", ":Make clean<CR>") - - --- development -map("n", "<leader>oc", ":grepadd /:: %") -map("n", "<leader>oh", ":grepadd /:: %") - -vim.keymap.set('n', '\\f', ":CommandTGit<cr>") -vim.keymap.set('n', '\\F', ":CommandTFind<cr>") -vim.keymap.set('n', '\\g', ":CommandTGit<cr>") -vim.keymap.set('n', '\\b', ":CommandTBuffer<cr>") - - --- quick navigation -map("n", "<leader>fb", ":b *") -map("n", "<leader>ff", ":find *") -map("n", "<leader>fs", ":set foldmethod=syntax<cr>") - - --- file helpers -map("n", "<leader>fmv", "lua file_mv_helper()") - --- doc functions -function doc_quick_underline(n) - if (n == 1) then - vim.cmd('normal! yypv$r=') - else - vim.cmd('normal! yypv$r-') - end -end - -function reverse_date() - vim.cmd('normal! dt/wwpldeBP') -end - -map("n", "<leader>h1", ":lua doc_quick_underline(1)<cr>") -map("n", "<leader>h2", ":lua doc_quick_underline(2)<cr>") - - -map("n", "<leader>ct", ":ChecklistToggleCheckbox<cr>") -map("n", "<leader>ce", ":ChecklistEnableCheckbox<cr>") --- map("n", "<leader>cd", ":ChecklistDisableCheckbox<cr>") - --- vim.g.checklist_filetypes:append('adoc', 'md') - --- vim-fugitive -map("n", "<leader>gb", ":G blame<cr>") -map("n", "<leader>gd", ":Gvdiff<cr>") -map("n", "<leader>gg", ":Ggrep<space>") -map("n", "<leader>gr", ":G reset %<cr>") -map("n", "<leader>gwq", ":Gwq<cr>") -map("n", "<leader>lg", ":Glgrep<space>") - --- useful -map("n", "<leader>nn", ":set number<cr>") - -- neovim diagnostics map("n", "<leader>sd", ":lua vim.diagnostic.open_float()<cr>") - --- netrw keybindings -map("n", "<leader>sf", ":Ex<cr>") - --- subst with power -map("n", "cn", "*``cgn") -map("n", "cN", "*``cgN") -vim.cmd([[ -let g:mc = "y/\\V\<C-r>=escape(@\", '/')\<CR>\<CR>" -vnoremap <expr> cn g:mc . "``cgn" -]]) - --- nb --- TODO open a fuzzy finder quickly. Even better use fuzzy finder without chdir -map("n", "<leader>nb", ":chdir $NB_PATH<cr> | :pwd<cr>") diff --git a/.config/sh/aliases b/.config/sh/aliases @@ -1,7 +1,6 @@ # [xdg] alias abook='abook --config "$XDG_CONFIG_HOME"/abook/abookrc --datafile "$XDG_DATA_HOME"/abook/addressbook' alias abook='abook -C "$XDG_CONFIG_HOME"/abook/abookrc --datafile "$XDG_DATA_HOME"/abook/addressbook' -alias btpd='btpd -d "$XDG_DATA_HOME"/btpd' alias dict='dict -c "$XDG_CONFIG_HOME"/dict/dictrc' alias mbsync='mbsync -c "$XDG_CONFIG_HOME"/isync/mbsyncrc' alias startx='startx "$XDG_CONFIG_HOME/X11/xinitrc" vt1' @@ -28,27 +27,28 @@ alias n='cd_and_ls' alias cf="quickopen cd d" alias ef="quickopen ${EDITOR} f" alias gf='$EDITOR $(git ls-files | ${FUZZER})' -alias vf="quickopen ${VISUAL} f" # TODO make it work for linux alias of="quickopen open f" # This won't work with dash # dash want's alias \- -# alias -- -='cd -' +alias -- -='cd -' # [shorthands] +alias a=attach alias '?d'='sr duckduckgo' alias cls=clear alias d='download' alias e='${EDITOR}' -alias f=find_ -alias g='git' +alias f=quickopen alias g=git alias l=lfcd alias le=less -alias m=make +alias m=smartmake alias v="VIMINIT='' nvim" -alias x=extract_archive +alias x=extract.sh # [longhands] alias girl='grep -irl' alias gir='grep -ir' + +alias voom='VIM_DIR=$XDG_DATA_HOME/vim voom' diff --git a/.config/sh/functions b/.config/sh/functions @@ -1,54 +1,66 @@ -# TODO implement [dest_dir] functionality -# Iterate over each arguments -# Treat last argument as dest folder? or use -d -extract_archive () { - test $# -lt 1 && { printf "Usage: $0 <archive>\n"; exit 1; } - test -f $1 || { printf "$0: $1: No such file \n"; exit 1; } - lowercase_ext=$(printf "%s" "$1" | rev | cut -d '.' -f1 | tr '[:upper:]' '[:lower:]' | rev) - case $lowercase_ext in - z) 7z x "$1" ;; - bz2) bzip2 -d "$1" ;; - bz) bzip2 -d "$1" ;; - gz) gunzip -d "$1" ;; - rar) unrar x "$1" ;; - tar) tar -xvf "$1" ;; - tgz) tar -zxvf "$1" ;; - zip) unzip "$1" ;; - *) printf "'$1' Error. Unsupported filetype.\n" >&2 ;; - esac -} - md() { mkdir "$@" && cd "$@" } +attach() { + if there abduco && [ $# -eq 0 ]; then + sesh_name=$(abduco -l | tail -n +2 | cut -f3 | $FUZZER) + abduco -a $sesh_name || { + echo "Do you want to create session: $sesh_name? (press any key)"; + read a && abduco -c $sesh_name mtm; + } + fi + [ $# -gt 0 ] && abduco -a $1 +} + # TODO make it non-interruptable insult() { - if type sl 1>/dev/null; then - sl - else - printf "You are a noob for typing '$1'\n" + if there sl; then + sl else printf "You are a noob for typing '$1'\n" sleep 5 fi } +smartmake() { + if there fmake && there errorformat; then + $(fmake) $* | errorformat + else + make + fi +} + thwart() { - alias $1="insult '$1'" + alias $1="insult '$1'" } quickopen() { - if ! type "${FUZZER}" 2>/dev/null; then + if ! there "${FUZZER}"; then printf '${FUZZER} not available\n' + exit 1 + fi + + # TODO maybe add -type in the future TODO add $name + #if [ $# -gt 0 ]; then + # name="-name $@" + #fi + # 2>/dev/null + if if [ -d .git ]; then + optional_files="$(git ls-files) |" + somethin="$(git ls-files | ${FUZZER})" + else maxdepth=${1:-3} somethin="$(find . -maxdepth $maxdepth | ${FUZZER})" fi + if [ -z "$somethin" ]; then + return; + elif [ -f "$somethin" ]; then + $EDITOR "$somethin" + elif [ -d "$somethin" ]; then + cd "$somethin" else - test "$#" -lt 1 && print "usage: $0 <command> [find -type]" - test -z "$2" && 2=f - ${1} "$(find . -type $2 -maxdepth 3 2>/dev/null | ${FUZZER})" + printf '%s: is neither a file nor a directory\n' "$somethin" + exit 1 fi } -cd_and_ls() { - cd $* && ls -} +cd_and_ls() { cd $* && ls } download() { # TODO use wget if curl not available @@ -59,14 +71,12 @@ find_() { find . -name "*$**" } -vim_plug() { - export VIM_PLUGINS_DIR="$XDG_DATA_HOME"/vim/pack/voom/opt - export VIM_DIR="$XDG_DATA_HOME"/vim - voom $@ +vim_plug() { export + VIM_PLUGINS_DIR="$XDG_DATA_HOME"/vim/pack/voom/opt export + VIM_DIR="$XDG_DATA_HOME"/vim voom $@ } nvim_plug() { - export VIM_PLUGINS_DIR="$XDG_DATA_HOME"/nvim/pack/voom/opt - export VIM_DIR="$XDG_DATA_HOME"/nvim - voom $@ + export VIM_PLUGINS_DIR="$XDG_DATA_HOME"/nvim/pack/voom/opt + export VIM_DIR="$XDG_DATA_HOME"/nvim voom $@ } diff --git a/.config/vim/keybindings.vim b/.config/vim/keybindings.vim @@ -1,26 +1,34 @@ " 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 :b * +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>sp :set paste<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<enter> -nnoremap <leader>ss :split<enter> -nnoremap <leader>vv :vsplit<enter> +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> @@ -31,6 +39,23 @@ 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.'")' @@ -43,6 +68,9 @@ 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> @@ -54,18 +82,25 @@ nnoremap <leader>wq :wq<cr> nnoremap <leader>ww :w<cr> nnoremap <leader>qq :q<cr> -" Fugitive -nnoremap <space>gd :Gvdiff<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 -map <leader>gt :!sh -c "ctags `rg --files`"<CR> -set tags+=.git/tags +nnoremap<leader>gt :!sh -c "ctags `git --ls-files`"<CR> nnoremap <CR> :noh<CR><CR>:<backspace> -" Markdown +" 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' @@ -118,3 +153,12 @@ 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 @@ -63,3 +63,14 @@ function! ChooseFile() 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 @@ -7,6 +7,8 @@ else endif endif +set complete-=i + " General set nocompatible set mouse= @@ -85,6 +87,8 @@ function! s:load_plugins(t) abort 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 @@ -92,8 +96,17 @@ function! s:load_plugins(t) abort 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')) diff --git a/.local/bin/sh/extract.sh b/.local/bin/sh/extract.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# TODO implement [dest_dir] functionality +# Currently extracts to the current directory +# Iterate over each arguments +# Treat last argument as dest folder? or use -d +# Allow extraction of multple archives in the order +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 + *.z) 7z x "$1" ;; + *.bz2) bzip2 -d "$1" ;; + *.bz) bzip2 -d "$1" ;; + *.gz) gunzip -d "$1" ;; + *.rar) unrar x "$1" ;; + *.tar) tar -xvf "$1" ;; + *.tar.gz) tar -xvf "$1" ;; + *.tgz) tar -zxvf "$1" ;; + *.zip) unzip "$1" ;; + *.mp4) + audio_codec=$(ffprobe -show_streams -select_streams a "$1" | grep codec_name | cut -f2 -d "=") + ffmpeg -i "$1" -c:a copy $(basename $1).${audio_codec} + ;; + +*) printf "'$1' Error. Unsupported filetype.\n" >&2 ;; +esac diff --git a/.local/share/vim/plugins b/.local/share/vim/plugins @@ -1,29 +1,32 @@ +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-surround.git +tpope/vim-dispatch tpope/vim-fugitive -tommcdo/vim-ninja-feet.git +tpope/vim-surround.git tpope/vim-unimpaired -pope/vim-repeat.git -christoomey/vim-tmux-navigator -tpope/vim-dispatch -yegappan/mru -radenling/vim-dispatch-neovim -evansalter/vim-checklist tpope/vim-vinegar tpope/vim-vinegar -ferranpm/vim-maildir -joereynolds/vim-minisnip/ -keith/swift.vim -preservim/tagbar -cfdrake/vim-pbxproj -kana/vim-submode -jerrymarino/xcodebuild.vim -gfontenot/vim-xcode -junegunn/fzf.vim vim-scripts/gitignore -OmniSharp/omnisharp-vim - +torrancew/vim-openscad +yegappan/mru +https://github.com/bfrg/vim-jqplay +notmuch-vim/notmuch-vim # https://git.sr.ht/~torresjrjr/birck.vim # rcarriga/nvim-dap-ui @@ -31,3 +34,6 @@ OmniSharp/omnisharp-vim # terrortylor/nvim-comment # neovim/nvim-lspconfig # puremourning/vimspector +# xolox/vim-misc +# xolox/vim-easytags +# preservim/tagbar diff --git a/.profile b/.profile @@ -1,12 +1,11 @@ #!/bin/sh -export GREP_COLOR='1;35;40' - [ -n "$1" ] && XDG_ROOT="$1" || XDG_ROOT="$HOME" # XDG 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_DESKTOP_DIR="$XDG_DATA_HOME/desktop" export XDG_DOCUMENTS_DIR="$XDG_DATA_HOME/documents" @@ -41,7 +40,6 @@ export ELINKS_CONFDIR="$XDG_CONFIG_HOME/elinks" export FFMPEG_DATADIR="$XDG_DATA_HOME"/ffmpeg export GNUPGHOME="$XDG_DATA_HOME/gnupg" -export ATOM_HOME="$XDG_DATA_HOME"/atom export NODE_REPL_HISTORY="$XDG_DATA_HOME"/node_repl_history export PASSWORD_STORE_DIR="$XDG_DATA_HOME"/pass export HISTFILE="$XDG_DATA_HOME"/history @@ -49,11 +47,8 @@ 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 EM_PORTS="$XDG_DATA_HOME"/emscripten/cache export CARGO_HOME="$XDG_DATA_HOME"/cargo export GEM_HOME="$XDG_DATA_HOME"/gem -export TERMINFO="$XDG_DATA_HOME/terminfo" -export TERMINFO_DIRS="$XDG_DATA_HOME/terminfo":/usr/share/terminfo export VSCODE_PORTABLE="$XDG_DATA_HOME/vscode" export GRADLE_USER_HOME="$XDG_DATA_HOME"/gradle export SQLITE_HISTORY="$XDG_DATA_HOME/sqlite_history" @@ -62,7 +57,6 @@ export SONGDL_HOME="${XDG_DATA_HOME}/music/" export PSQL_HISTORY="$XDG_CACHE_HOME/pg/psql_history" export NUGET_PACKAGES="$XDG_CACHE_HOME"/NuGetPackages -export EM_CACHE="$XDG_CACHE_HOME"/emscripten/cache export GEM_SPEC_CACHE="$XDG_CACHE_HOME"/gem # Make `history` print timestamp @@ -70,7 +64,7 @@ HISTTIMEFORMAT="%F %T " HISTCONTROL=erasedups # Local executables -export PATH=${PATH}:${HOME}/.local/bin:${HOME}/.local/bin/sh:${XDG_DATA_HOME}/npm/bin:${XDG_DATA_HOME}/.cargo/bin:${XDG_DATA_HOME}/gem/bin +export PATH=${PATH}:${HOME}/.local/bin:${HOME}/.local/bin/sh:${XDG_DATA_HOME}/npm/bin:${XDG_DATA_HOME}/.cargo/bin:${GOPATH}/bin:${XDG_DATA_HOME}/gem/bin chance() { # Hit or miss @@ -83,10 +77,15 @@ there() { } # Setup editor - -export VISUAL=vim -export EDITOR="$(there nvi && echo nvi || echo vi)" -export FUZZER=sk +# TODO until I grok the shell and able to control the clipboard and +# registers with terminal level keybings. I am not going back to vi/nvi +#alias vim=vi +#alias nvim=vi +export VISUAL=nvim +export EDITOR=nvim +there $EDITOR || unset $EDITOR +export FUZZER=fzy +there $FUZZER || unset $FUZZER export BROWSER=lynx export SURFRAW_browser="$BROWSER" @@ -102,3 +101,5 @@ export LESS_TERMCAP_se=$'\e[0m' export CLICOLOR=1 export LSCOLORS="xxexcxdxbxegxdxbagxcxd" export LS_COLORS="di=0:ln=34:so=32:pi=33:ex=31:bd=34;46:cd=0;43:su=0;41:sg=30;46:tw=0;42:ow=0;43" +export GREP_COLOR='1;35;40' +