From c114b867d29f3f604c7f159753eebcdf79a19877 Mon Sep 17 00:00:00 2001 From: Julian Scharrenbach Date: Fri, 19 Dec 2025 13:40:21 +0100 Subject: [PATCH] new alias function --- .bash_aliases | 19 +++++++++++++++++++ .bashrc_local | 4 ++++ 2 files changed, 23 insertions(+) diff --git a/.bash_aliases b/.bash_aliases index 985c7bd..d68bc86 100644 --- a/.bash_aliases +++ b/.bash_aliases @@ -15,6 +15,25 @@ alias ....='cd ../../..' alias .....='cd ../../../..' alias p='cd -' +# if cd gets a path to a file, it should change to the directory of this very file +cd() { + local target="$1" + + # If no argument, go to home directory (default cd behavior) + if [ -z "$target" ]; then + builtin cd + return $? + fi + + # If target is a file, cd to its directory + if [ -f "$target" ]; then + builtin cd "$(dirname "$target")" + else + # Otherwise, use normal cd behavior + builtin cd "$target" + fi +} + # cdl=move to directory and instantly list its contents # everyone needs this ;-) cdl(){ diff --git a/.bashrc_local b/.bashrc_local index 5aad5c2..fb6acbb 100644 --- a/.bashrc_local +++ b/.bashrc_local @@ -24,3 +24,7 @@ bind '"\e[D": backward-char' # vi editing mode set -o vi + +export PYENV_ROOT="$HOME/.pyenv" +[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH" +eval "$(pyenv init - bash)"