From 3c99b8cb344e9b5c9aa4c73d1dd5a3bd66b4ff35 Mon Sep 17 00:00:00 2001 From: Jan Andrle Date: Wed, 27 Mar 2024 14:14:42 +0100 Subject: [PATCH] :zap: rm unused `cd` aliases in favou `cd.` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …quickly create cd aliases on demand --- .bash/.bash_aliases | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/.bash/.bash_aliases b/.bash/.bash_aliases index 70c02f8..ab61c13 100644 --- a/.bash/.bash_aliases +++ b/.bash/.bash_aliases @@ -45,17 +45,12 @@ history_most_used(){ LC_ALL=C cat ~/.bash_history | cut -d ';' -f 2- | §awk 1 | alias §less='less -R -S' -alias §cd.='clear;§ls' -§cd..(){ cd $(eval printf '../'%.0s {1..$1}); } -§cd(){ - [[ "$1" == '--help' ]] && echo -e " - Usage: §cd NUMBER|PATH - See: dirs -v - " && return 0 - [[ -z "$1" ]] && dirs -v | sed 1d && return 0 - [[ $1 =~ ^[0-9]+$ ]] && cd "$(dirs -l +$1)" && dirs -v | sed 1d && return 0 - builtin pushd "$1" >/dev/null && pushd . +cd.(){ + [[ -z "$1" ]] && return 1 + [[ -z "$2" ]] && local p="$(pwd)" || local p="$(readlink -f $2)" + alias cd.$1="cd ${p}"; } +alias m='cd.' alias cd-vifm='cd `vifm --choose-dir -`' mkcd(){ mkdir -p -- "$1" && cd -P -- "$1"; }