dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit bb980deab22f0ea390245568d19bef0c0ede9d47
parent b470f707e789a799ed0bc4088712c8d6a9b82cae
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Tue, 10 Sep 2019 10:23:21 +0200

Clean up commands, improve POSIX compatibility

Diffstat:
M.commands.sh | 17++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/.commands.sh b/.commands.sh @@ -9,9 +9,8 @@ alias xq="xbps-query" alias xr="sudo xbps-remove" alias cg='c "$(git rev-parse --show-toplevel)"' # cd under git repo -alias ch='cd "$(dirs -lp | sort -u | fzy)"' # cd from history +alias ch='cd "$(dirs | sort -u | fzy)"' # cd from history c() { - dir dir=$(find "${1:-.}" -type d | grep -v '/\.' | fzf) [ -d "$dir" ] && cd "$dir" || return } @@ -24,14 +23,14 @@ O() { if [ "$#" -gt 0 ] && [ -f "$1" ]; then setsid $open "$1" >/dev/null 2>&1 else - IFS= out=$(fzf --query="$1" --exit-0 \ + IFS= out=$(fzf --exit-0 \ --expect=ctrl-o,ctrl-e,ctrl-y \ --preview-window=hidden) key=$(echo "$out" | sed 1q) file=$(echo "$out" | sed 2q | tail -1) if [ -n "$file" ]; then if [ "$key" = ctrl-e ]; then - ${EDITOR:-vim} "$file" + $EDITOR "$file" elif [ "$key" = ctrl-y ]; then printf "%s" "$PWD/$file" | xclip elif [ "$key" = ctrl-o ]; then @@ -94,11 +93,11 @@ news() { } weather() { curl "wttr.in/?m"; } -t_add() { transmission-remote --add --download-dir "$PWD" --encryption-required "$@" } -t_list() { transmission-remote --list } -t_remove() { transmission-remote --torrent "$@" --remove } -t_remove_all() { transmission-remote -tall --remove } -t_stop() { transmission-remote --torrent "$@" --stop } +t_add() { transmission-remote --add --download-dir "$PWD" --encryption-required "$@"; } +t_list() { transmission-remote --list; } +t_remove() { transmission-remote --torrent "$@" --remove; } +t_remove_all() { transmission-remote -tall --remove; } +t_stop() { transmission-remote --torrent "$@" --stop; } t_stop_idle() { for id in $(t-list | grep Done | grep Idle | awk '{ print $1 }' | tr '\n' ','); do t-stop "$id"