diff --git a/apps/de/bspwm/config b/apps/de/bspwm/config index 6ead26d..bb94ef4 100755 --- a/apps/de/bspwm/config +++ b/apps/de/bspwm/config @@ -4,11 +4,11 @@ NUM_DESKTOPS="$(xrq bspwm.num_desktops)" REVERSE_DESKTOP_ORDERING="$(xrq bspwm.reverse_desktop_ordering)" REVERSE_MONITOR_DESKTOPS="$(xrq bspwm.reverse_monitor_desktops)" BSPWM_MONITORS=$(bspc query -M) -MONITOR_COUNT=$(<<< "$BSPWM_MONITORS" wc -w | awk '{ printf $1 }') +MONITOR_COUNT=$(echo "$BSPWM_MONITORS" | wc -w | awk '{ printf $1 }') PER_MONITOR=$((NUM_DESKTOPS / MONITOR_COUNT)) DESKTOPS=$(seq "$NUM_DESKTOPS") -[ "$REVERSE_MONITOR_DESKTOPS" -eq 1 ] && BSPWM_MONITORS=$(<<< "$BSPWM_MONITORS" tac) +[ "$REVERSE_MONITOR_DESKTOPS" -eq 1 ] && BSPWM_MONITORS=$(echo "$BSPWM_MONITORS" | tac) bspc config normal_border_color "$(xrq bspwm.normal_border_color)" bspc config focused_border_color "$(xrq bspwm.focused_border_color)" @@ -28,7 +28,7 @@ bspc rule -a "*" split_dir=right i=1 for mon in $BSPWM_MONITORS; do max=$((i + PER_MONITOR - 1)) - screens= + screens="" for j in $(seq $i $max); do screens="${screens}${j} " done diff --git a/apps/git/config b/apps/git/config index 9130934..7678bf7 100644 --- a/apps/git/config +++ b/apps/git/config @@ -19,14 +19,11 @@ followRedirects = true [diff] - tool = cat + tool = nvimdiff [difftool] prompt = false -[multidiff] - tool = nvimdiff -f - [alias] d = difftool s = status @@ -52,20 +49,10 @@ [mergetool "nvimdiff"] cmd = nvimdiff $BASE $LOCAL $REMOTE $MERGED -c '$wincmd w' -c '$wincmd J' -[mergetool "cat"] - cmd = cat $BASE $LOCAL $REMOTE $MERGED - -[mergetool "echo"] - cmd = echo $BASE $LOCAL $REMOTE $MERGED - -[mergetool "vimmultidiff"] - cmd = vim-multi-diff-builder $BASE $LOCAL $REMOTE $MERGED - [pager] branch = false # remove ansi codes, pad each file's diff with newlines, show as diff, remove top padding - # diff = vimpager -c 'silent %sm/\\e[^mK]*[mK]//g' -c 'silent %s/^diff/\\r\\rdiff/' -c 'silent set ft=diff' -c 'silent execute \"normal gg2dd\"' - diff = less + diff = vimpager -c 'silent %sm/\\e[^mK]*[mK]//g' -c 'silent %s/^diff/\\r\\rdiff/' -c 'silent set ft=diff' -c 'silent execute \"normal gg2dd\"' [url "git@github.com:postmates"] insteadOf = https://github.com/postmates diff --git a/apps/neovim/plugins.vim b/apps/neovim/plugins.vim index 187ffa8..f15beb4 100644 --- a/apps/neovim/plugins.vim +++ b/apps/neovim/plugins.vim @@ -43,7 +43,7 @@ let g:polyglot_disabled = ['cue', 'cuesheet'] " let g:fzf_layout = { 'window': 'enew' } " check if we're using vim as the manpage viewer before loading session plugins -if exists('asmanviewer') +if exists('asmanviewer') || exists('nosession') let g:prosession_dir = '/dev/null' else Plug 'tpope/vim-obsession' " session ease-of-use diff --git a/apps/shell/fish/aliases.fish b/apps/shell/fish/aliases.fish index 805f318..85cce3f 100755 --- a/apps/shell/fish/aliases.fish +++ b/apps/shell/fish/aliases.fish @@ -110,7 +110,7 @@ function g end end alias gs "git status" -alias gd "git d" +alias gd "git diff" alias gds "gd --staged" # alias gdv "git dv" # TODO: what is this? alias gpl "git pull" @@ -156,6 +156,7 @@ alias wifi "sudo nmtui" alias year 'cal (date +%Y)' alias y year alias pa pulsemixer +alias vd vdiff # games aliases # this sometimes fixes steam dynamic library issues? diff --git a/bin/vdiff b/bin/vdiff new file mode 100755 index 0000000..91f9ef3 --- /dev/null +++ b/bin/vdiff @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +repo_root="$(git rev-parse --show-toplevel)" +pushd "$repo_root" &> /dev/null || ( echo "Repo doesn't exist!"; exit 2 ) +td="$(mktemp -p "$pdir" -d "vdiff.XXXXXXXX")" +trap "rm -rf \"$td\"" EXIT +files="$(git diff --name-only "$@")" + +args=() +vcmd="" +for f in $files; do + d="$(dirname "$td/$f")" + rfn="$(basename "$f")" + fn="$rfn._@HEAD" + cfn="$rfn" + + mkdir -p "$d" + git --no-pager show HEAD:"$f" > "$d/$fn" 2>/dev/null || \ + echo "" > "$d/$fn" + cp "$f" "$d/$cfn" 2>/dev/null || echo "" > "$d/$cfn" + + if [ -z "$args" ]; then + args+=($d/$fn -c) + vcmd="vert diffsplit $d/$cfn" + else + vcmd="$vcmd | tabnew | e $d/$fn | vert diffsplit $d/$cfn" + fi +done + +remaps="nnoremap k :tabnext | nnoremap j :tabprev" +nvim "${args[@]}" "$vcmd | tabnext | $remaps" + +rm -rf "$td" +popd &> /dev/null || ( echo "Could not return to original directory" && exit 4 ) diff --git a/bin/vim-multi-diff-builder b/bin/vim-multi-diff-builder deleted file mode 100755 index 746437e..0000000 --- a/bin/vim-multi-diff-builder +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env sh - -td="$(mktemp -p "$pdir" -d "tmp_vim_git_multi_diff.XXXXXXXX")" -trap "rm -rf \"$td\"" EXIT - -files="$(git diff --name-only "$@")" - -for f in $files; do - d="$(dirname "$td/$f")" - rfn="$(basename "$f")" - fn="$rfn._@HEAD" - cfn="$rfn._@DISK" - mkdir -p "$d" - git --no-pager show HEAD:"$f" > "$d/$fn" 2>/dev/null || \ - echo "" > "$d/$fn" - cp "$f" "$d/$cfn" - nvim -d "$d/$fn" "$d/$cfn" - exit 3 -done - -ls -R "$td" -rm -rf "$td" diff --git a/bin/vimpager b/bin/vimpager index f7af268..106fd04 100755 --- a/bin/vimpager +++ b/bin/vimpager @@ -1,6 +1,7 @@ #!/usr/bin/env sh nvim \ + -c 'let nosession=1' \ -c 'silent setlocal nobuflisted buftype=nofile bufhidden=wipe noswapfile' \ "$@" \ -