Summary Files Commits Branches @commit @diff @stats
path: root / bash
diff options
context:
space:
mode:
Commit6e0ced908d9f277d8d30499db2b5263ad9164b9d (patch)
Author
 Syndamia <kamen@syndamia.com>
2026-11-08 15:59:35 +0200
Committer
 Syndamia <kamen@syndamia.com>
2026-11-08 15:59:35 +0200
Filesc8106b88d48a810b93d61dc75a950d80ab432294 /bash
.files-6e0ced908d9f277d8d30499db2b5263ad9164b9d.tar
.files-6e0ced908d9f277d8d30499db2b5263ad9164b9d.tar.gz
.files-6e0ced908d9f277d8d30499db2b5263ad9164b9d.zip
Parente49c4e77e37156959a1e5813a145a88eebb91317 (diff)
chore(bash): More generic cd repo implementation
1 files changed, 4 insertions, 3 deletions
-rw-r--r--bash/.bashrc7
diff --git a/bash/.bashrc b/bash/.bashrc
index 6350dbb..546b414 100644
--- a/bash/.bashrc
+++ b/bash/.bashrc
@@ -296,8 +296,9 @@ export PROMPT_COMMAND="shell_var_fix;"
alias bd="popd" # back directory
alias fd="repushd"
+ export CDREPO_PREFIX="$HOME/Programming"
cdrepo() {
- cd "$HOME/Programming/$1/$2"
+ cd "$CDREPO_PREFIX/$1/$2"
}
# Huge thanks to: https://stackoverflow.com/a/39729507
_cdrepo_comp() {
@@ -310,11 +311,11 @@ export PROMPT_COMMAND="shell_var_fix;"
while IFS= read line
do
[ -z "$line" ] && continue
- line="${line##"$HOME"/Programming/"$_folder"/}/"
+ line="${line##"$CDREPO_PREFIX/$_folder/"}/"
line="${line// /\\ }"
COMPREPLY+=("$line")
done <<EOF
-$(compgen -d "$HOME"/Programming/"$_folder"/"$2")
+$(compgen -d "$CDREPO_PREFIX/$_folder/$2")
EOF
}