From e2a70a92822b22633562e9695c300efec2b5cbeb Mon Sep 17 00:00:00 2001 From: Mohammad Reza Karimi Date: Sat, 24 Jan 2026 19:24:55 -0500 Subject: updates --- bash/dot-config/bash/functions.bash | 56 ++++++++++++++++++++----------------- bash/dot-profile | 1 - 2 files changed, 31 insertions(+), 26 deletions(-) (limited to 'bash') diff --git a/bash/dot-config/bash/functions.bash b/bash/dot-config/bash/functions.bash index a8c0a65..2c9e873 100644 --- a/bash/dot-config/bash/functions.bash +++ b/bash/dot-config/bash/functions.bash @@ -3,64 +3,70 @@ source "${XDG_CONFIG_HOME:-$HOME/.config}"/bash/vardump.bash colors() { - local i - for i in {0..255}; do - printf "\x1b[38;5;${i}mcolor %d\n" "$i" - done - tput sgr0 + local i + for i in {0..255}; do + printf "\x1b[38;5;${i}mcolor %d\n" "$i" + done + tput sgr0 } nman() { - nvim -c "Man $*" -c "wincmd o" -c "nmap q :q" + nvim -c "Man $*" -c "wincmd o" -c "nmap q :q" } lf() { - export LF_CD_FILE=/tmp/.lfcd-$$ - command lf "$@" - if [ -s "$LF_CD_FILE" ]; then - local DIR - DIR="$(realpath "$(cat "$LF_CD_FILE")")" - if [ "$DIR" != "$PWD" ]; then - echo "cd to $DIR" - cd "$DIR" || exit + export LF_CD_FILE=/tmp/.lfcd-$$ + command lf "$@" + if [ -s "$LF_CD_FILE" ]; then + local DIR + DIR="$(realpath "$(cat "$LF_CD_FILE")")" + if [ "$DIR" != "$PWD" ]; then + echo "cd to $DIR" + cd "$DIR" || exit + fi + command rm "$LF_CD_FILE" fi - command rm "$LF_CD_FILE" - fi - unset LF_CD_FILE + unset LF_CD_FILE } se() { - choice="$(fd . ~/.local/bin -d1 -tx -tl --format '{/}' | fzf)" - [ -f "$HOME/.local/bin/$choice" ] && $EDITOR "$HOME/.local/bin/$choice" + choice="$(fd . ~/.local/bin -d1 -tx -tl --format '{/}' | fzf)" + [ -f "$HOME/.local/bin/$choice" ] && $EDITOR "$HOME/.local/bin/$choice" } pS() { - pacman -Slq | fzf --multi --preview 'pacman -Si {1}' | xargs -ro sudo pacman -S + pacman -Slq | fzf --multi --preview 'pacman -Si {1}' | xargs -ro sudo pacman -S } paruS() { - paru -Slq | fzf --multi --preview 'paru -Si {1}' | xargs -ro paru -S + paru -Slq | fzf --multi --preview 'paru -Si {1}' | xargs -ro paru -S } yayS() { - yay -Slq | fzf --multi --preview 'yay -Si {1}' | xargs -ro yay -S + yay -Slq | fzf --multi --preview 'yay -Si {1}' | xargs -ro yay -S } # cp and mv but with rsync # source: https://wiki.archlinux.org/title/Rsync#As_cp/mv_alternative cpr() { - rsync --archive -hh --partial --info=stats1,progress2 --modify-window=1 "$@" + set -xe + local rsync_args="--archive -hh --partial --info=stats1,progress2 --modify-window=1" + if [ "$1" = "-sudo" ]; then + shift + sudo rsync $rsync_args "$@" + else + rsync $rsync_args "$@" + fi } mvr() { - rsync --archive -hh --partial --info=stats1,progress2 --modify-window=1 --remove-source-files "$@" + rsync --archive -hh --partial --info=stats1,progress2 --modify-window=1 --remove-source-files "$@" } - diff --git a/bash/dot-profile b/bash/dot-profile index 072595b..4faa2ee 100644 --- a/bash/dot-profile +++ b/bash/dot-profile @@ -2,7 +2,6 @@ export EDITOR=nvim export SUDO_EDITOR=$EDITOR -export BAT_THEME=ansi export MANPAGER="sh -c 'sed -u -e \"s/\\x1B\[[0-9;]*m//g; s/.\\x08//g\" | bat --paging always -p -lman'" -- cgit v1.2.3-71-gdd5e