diff --git a/.config/git/ignore b/.config/git/ignore index c00eb1d..2ebab4c 100644 --- a/.config/git/ignore +++ b/.config/git/ignore @@ -37,6 +37,7 @@ cache/ *_build/ cmake*build*/ __pycache__/ +node_modules/ # Logs *.log diff --git a/.config/nvim/init/keys.vim b/.config/nvim/init/keys.vim index c9d9f38..2fedb17 100644 --- a/.config/nvim/init/keys.vim +++ b/.config/nvim/init/keys.vim @@ -15,7 +15,7 @@ let @t = ':%s/^\(\(\t\)*\) /\1\t/g :%s/^\(\(\t\)*\) /\1\t/g :%s/^\(\(\t\)*\) " Sane yanking map Y y$ " Disable Ex mode - https://vi.stackexchange.com/q/457 -nnoremap Q @q +nnoremap Q :wqa noremap q: " Alias replace all to S diff --git a/.local/bin/scripts/b b/.local/bin/scripts/b index 6f7887d..554bee9 100755 --- a/.local/bin/scripts/b +++ b/.local/bin/scripts/b @@ -204,7 +204,7 @@ if test "$bat" -o "$batplain"; then if which cj >/dev/null; then json=true for file in "${bat[@]}"; do - case $file in (*.json);; (*) json=false;; esac + case $file in (*.json|*.geojson);; (*) json=false;; esac done fi if $json @@ -228,7 +228,7 @@ if test "$ls" -o $# -le $(echo "$flags" | wc -w); then if test '$tree' then $elevate tree -a --dirsfirst --du -h -C -L 3 $flags $(printf "'%s' " "${ls[@]:-.}") elif which exa 2>/dev/null >&2 - then $elevate exa --color=always --long --group --classify --all --all --sort=changed --reverse $flags $(printf "'%s' " "${ls[@]:-.}") + then $elevate exa --icons --color=always --long --group --classify --all --all --sort=changed --reverse $flags $(printf "'%s' " "${ls[@]:-.}") else $elevate ls -l $(test $# -gt ${#ls[@]} && echo '-d') --color=always --human-readable --si --group-directories-first --file-type --dereference-command-line-symlink-to-dir --all $flags $(printf "'%s' " "${ls[@]:-.}") fi " || $elevate ls $(test $# -gt ${#ls[@]} && echo "-d") --color=always --human-readable --si --dereference-command-line --all --sort=none $flags "${ls[@]:-.}" diff --git a/.local/bin/scripts/dif b/.local/bin/scripts/dif index e8b03f2..b28e85b 100755 --- a/.local/bin/scripts/dif +++ b/.local/bin/scripts/dif @@ -9,9 +9,11 @@ case "$mime" in --report-identical-files --label="$1" --label="$2" <(ff "$1") <(ff "$2") ;; (*sqlite*) sqldiff "$@" ;; -(*) # Use wiked-diff only for text <10MB - if expr "$mime" : "text/" >/dev/null && test 10000000 -gt "$(stat --format=%s *.geojson | paste -s -d'+' | bc)" +(text/*) + # Use wiked-diff only for text <10MB + if test 10000000 -gt "$(stat --format=%s *.geojson | paste -s -d'+' | bc)" then wiked-diff "$@" - else diff-color --report-identical-files "$@" + else diff --color=always --unified=1 --report-identical-files "$@" fi;; +(*) diff-color --report-identical-files "$@";; esac | less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen diff --git a/.local/bin/scripts/git-fork b/.local/bin/scripts/git-fork index 03f44c1..ca9d337 100755 --- a/.local/bin/scripts/git-fork +++ b/.local/bin/scripts/git-fork @@ -21,6 +21,7 @@ else repo="$1" && shift cd "$(expr "$4" \| "$repo")" fi user="${1:-$repo}" -git remote remove upstream 2>/dev/null +git remote remove upstream 2>/dev/null || true git remote add upstream "$(git-repo "${3:-github.com}" "$repo" "$user")" git remote -v +exec $SHELL diff --git a/.local/bin/scripts/netkeeper b/.local/bin/scripts/netkeeper index ade9442..73df7d4 100755 --- a/.local/bin/scripts/netkeeper +++ b/.local/bin/scripts/netkeeper @@ -1,7 +1,7 @@ #!/bin/sh -e # Keeps the Internet at bay if test -e "$JOURNAL"; then - echo "What do you want to do? Check your journal!" + echo "What do you want to do? Check your journal!" >&2 while test $(echo "$intention" | wc -c) -lt 10 do read intention done diff --git a/.local/bin/scripts/quickref b/.local/bin/scripts/quickref new file mode 100755 index 0000000..dcbc3bf --- /dev/null +++ b/.local/bin/scripts/quickref @@ -0,0 +1,19 @@ +#!/bin/sh +test-colors + +cat <<'EOF' +Globbing: +- ${VAR#pattern} :: delete shortest match from beginning +: file='sdf/fd' && echo ${file#sdf/} +- ${VAR##pattern} :: delete longest match from beginning +- ${VAR%pattern} :: delete shortest match from end +- ${VAR%%pattern} :: delete longest match from end +- ${VAR/search/replace} :: Regex replacement (kinda?) +Examples: +- ${VAR:*} :: retain the part before the last colon +- ${VAR##*/} :: retain the basename +- ${VAR%.*} :: remove extension +- [[https://unix.stackexchange.com/a/486694][argument from end of list]] :: + : eval x=\$$(($#-1)) + (uses arithmetic substitution, a non-POSIX feature) +EOF diff --git a/.local/bin/scripts/rgain b/.local/bin/scripts/rgain index 7385ef6..280e8d6 100755 --- a/.local/bin/scripts/rgain +++ b/.local/bin/scripts/rgain @@ -1,3 +1,3 @@ #!/bin/sh # Recursively add replaygain to the given files or from the current directory -r128gain -r --skip-tagged --preserve-times 1 "${@:-.}" +r128gain $(test -f "$1" || echo '--recursive') --skip-tagged --preserve-times 1 "${@:-.}" diff --git a/.local/bin/scripts/power-save b/.local/bin/scripts/save-power similarity index 85% rename from .local/bin/scripts/power-save rename to .local/bin/scripts/save-power index 9934f9a..11ecb93 100755 --- a/.local/bin/scripts/power-save +++ b/.local/bin/scripts/save-power @@ -1,5 +1,7 @@ #!/bin/sh # TODO set brightness +pkill electron +pkill discord pkill signal pkill aw-server pkill aw-qt diff --git a/.local/bin/scripts/test-tiv b/.local/bin/scripts/test-tiv index 0de4f40..524347e 100755 --- a/.local/bin/scripts/test-tiv +++ b/.local/bin/scripts/test-tiv @@ -4,7 +4,7 @@ set -x size=10 if test $# -eq 0 - then args=$DATA/images/*.png + then args=$DATA/4-media/images/*.png else echo "$1" | grep -v -e "\." -e "/" && size=$1 && shift fi cols="$(expr $(tput cols) / $size / 3 \| 1)"