From 36077084766d8e00301a2f0f0748d88d0e6fc5e7 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Fri, 24 Sep 2021 20:20:29 +0200 Subject: [PATCH] config/shell: litle corrections, fix cs alias --- .config/shell/browse | 13 ++++++++----- .config/shell/functions | 2 +- .local/bin/scripts/favicon | 3 +-- .local/bin/scripts/git-upstream | 6 +++--- .zprofile | 2 ++ 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.config/shell/browse b/.config/shell/browse index bb8d7a1..31921e8 100644 --- a/.config/shell/browse +++ b/.config/shell/browse @@ -29,11 +29,14 @@ mkcd() { } cd() { - test -d "$DATA" && test "$1" != "-" -a ! -d "$1" -a $# -eq 1 && - dir=$(f --glob "$1*" "$DATA" --maxdepth 2 --type d --max-results 1) && - test -n "$dir" && cd "$dir" && return - builtin cd $1 && + if test -d "$DATA" && test "$1" != "-" -a ! -d "$1" -a $# -eq 1 + then + dir=$(fd --no-ignore --glob "$1*" "$DATA" --maxdepth 2 --type d --max-results 1) + test -n "$dir" && cd "$dir" + else + builtin cd $1 && command ls --file-type --group-directories-first --color=always --format=vertical -w $COLUMNS | head -3 + fi } # ZOXIDE @@ -50,6 +53,6 @@ d() { fi | zfz)" } di() { - test "$1" != "-" -a ! -d "$1" -a $# -eq 1 && local dir=$({ zf "$@"; locz "$@" } | zfz) + test $# -eq 1 && test "$1" = "-" -o -d "$1" || local dir=$({ zf "$@"; locz "$@" } | zfz) cd "${dir:-1}" } diff --git a/.config/shell/functions b/.config/shell/functions index b70f9c7..bb68cbb 100644 --- a/.config/shell/functions +++ b/.config/shell/functions @@ -217,7 +217,7 @@ updateDeps() { done echo name $name depth $depth pattern $oldversion version $version find -maxdepth $depth -type f -name $name | while read f - do echo $f + do highlight $f sed -i "s/\($pattern\)$oldversion/\1$version/gw /dev/stdout" $f done } diff --git a/.local/bin/scripts/favicon b/.local/bin/scripts/favicon index 2bb92af..8c9c165 100755 --- a/.local/bin/scripts/favicon +++ b/.local/bin/scripts/favicon @@ -1,4 +1,3 @@ #!/bin/bash # Extract the icon of a given page using duckduckgo -read -p URL? url -xdg-open "https://icons.duckduckgo.com/ip2/$url.ico" +xdg-open "https://icons.duckduckgo.com/ip2/$1.ico" diff --git a/.local/bin/scripts/git-upstream b/.local/bin/scripts/git-upstream index b5375b5..274e3bc 100755 --- a/.local/bin/scripts/git-upstream +++ b/.local/bin/scripts/git-upstream @@ -2,11 +2,11 @@ # set given repository as upstream or add as a new remote if test "$3" then - local name="$3" + name="$3" git remote remove "$3" 2>/dev/null else - git remote get-url upstream 2>/dev/null && local name="$1" || local name="upstream" + git remote get-url upstream 2>/dev/null && name="$1" || name="upstream" fi -local origin="$(git remote get-url origin)" +origin="$(git remote get-url origin)" git remote add -f $name "$(echo $origin | cut -d':' -f1):$1/${2:-$(echo $origin | cut -d'/' -f2)}" git remote -v diff --git a/.zprofile b/.zprofile index 2da8c23..c8f27df 100644 --- a/.zprofile +++ b/.zprofile @@ -13,6 +13,7 @@ export GNUPGHOME="$XDG_DATA_HOME"/gnupg export KDEHOME="$XDG_STATE_HOME"/kdehome export GOPATH="$XDG_STATE_HOME"/go +export CARGO_HOME="$XDG_DATA_HOME"/cargo export GTK2_RC_FILES="$XDG_CONFIG_HOME"/gtk-2.0/gtkrc export RLWRAP_HOME="$XDG_STATE_HOME"/rlwrap @@ -93,6 +94,7 @@ export CTEST_PROGRESS_OUTPUT=1 export CTEST_OUTPUT_ON_FAILURE=1 export CTEST_PARALLEL_LEVEL=3 + export JOURNAL="$DATA/2-standards/notes/journal" if test -z "${DISPLAY}" && test "$XDG_VTNR" -eq 1 && test -d "$JOURNAL"; then