diff --git a/.config/shell/functions b/.config/shell/functions index a2bc894..08999e8 100644 --- a/.config/shell/functions +++ b/.config/shell/functions @@ -159,15 +159,6 @@ alias jcj='jcl -o json-pretty -u' alias grp='grep --line-number --ignore-case --binary-files=without-match --directories=skip' alias grpr='grp --recursive' -# Use grep and sed to replace $1 with $2 recursively -rpl() { - grep --null --recursive --files-with-matches "$1" | - xargs -0 sed -i "/${1}/{ - s//${2}/g - w /dev/stdout - }" -} - # Recover stray swap files from neovim alias vrec="ls $XDG_DATA_HOME/nvim/swap | sed 's/\%/\//g' | sed 's|\(.*\)\..*|\1|' | head -1 | xargs -r nvim" diff --git a/.local/bin/scripts/box b/.local/bin/scripts/box deleted file mode 100755 index 8f2fd9c..0000000 --- a/.local/bin/scripts/box +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -note "box/$(date +%F)-$1" diff --git a/.local/bin/scripts/dif b/.local/bin/scripts/dif index cb90710..2287416 100755 --- a/.local/bin/scripts/dif +++ b/.local/bin/scripts/dif @@ -1,4 +1,4 @@ #!/bin/sh set -o pipefail # interactive diff with pagination -diff --color=always --report-identical-files -U 2 "$@" | less --quit-if-one-screen +diff --color=always --report-identical-files -U 2 "$@" | diffr --colors refine-added:none:background:0x33,0x66,0x33:bold --colors added:none:background:0x33,0x44,0x33 --colors refine-removed:none:background:0x66,0x33,0x33:bold --colors removed:none:background:0x44,0x33,0x33 | less --RAW-CONTROL-CHARS --quit-on-intr diff --git a/.local/bin/scripts/git-cdiff b/.local/bin/scripts/git-cdiff new file mode 100755 index 0000000..d33e005 --- /dev/null +++ b/.local/bin/scripts/git-cdiff @@ -0,0 +1,5 @@ +#!/bin/sh +# create a diff of diffs - https://stackoverflow.com/a/23527631 +dif "${@:3}" <(git show $1) <(git show $2) + +#git range-diff $1~..$1 $2~..$2 "${@:3}" diff --git a/.local/bin/scripts/note b/.local/bin/scripts/note deleted file mode 100755 index 555d4b8..0000000 --- a/.local/bin/scripts/note +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -p=$PWD -cd $HOME/daten/Dropbox/dokumente/notes -loc=$1 -case $1 in - log|jrnl) shift; file=journal/${1:-jrnl}.txt;; #date +%F >>$file;; - idea) shift; file=ideas/${1:-README}.md;; - box) shift; file=box/$1.md;; - write) shift; file=writings/$1.md;; - msg) shift; file=archive/messages/$1.md;; - *) file=${1:-README}.md;; -esac -comment=$(test -f $file && echo Update || echo Create) -test "$2" && echo "$2" >>$file || $EDITOR + $file -git add $file && git commit -m "$(test "$(dirname $file)" != "." && echo "${loc%%/*}: ")$comment $(basename $file)" && git push -cd $p diff --git a/.local/bin/scripts/rpl b/.local/bin/scripts/rpl new file mode 100755 index 0000000..fddd10e --- /dev/null +++ b/.local/bin/scripts/rpl @@ -0,0 +1,8 @@ +#!/bin/sh +# Use grep and sed to replace $1 with $2 recursively and print what is done +grep --null --recursive --files-with-matches "$1" | + xargs -0 sed -i "/${1}/{ + s//${2}/g + w /dev/stdout + }" + diff --git a/.local/bin/scripts/wr b/.local/bin/scripts/wr deleted file mode 100755 index 71d8a0c..0000000 --- a/.local/bin/scripts/wr +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -note write "$@"