new alias function
This commit is contained in:
parent
88ea1cc370
commit
c114b867d2
|
|
@ -15,6 +15,25 @@ alias ....='cd ../../..'
|
||||||
alias .....='cd ../../../..'
|
alias .....='cd ../../../..'
|
||||||
alias p='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
|
# cdl=move to directory and instantly list its contents
|
||||||
# everyone needs this ;-)
|
# everyone needs this ;-)
|
||||||
cdl(){
|
cdl(){
|
||||||
|
|
|
||||||
|
|
@ -24,3 +24,7 @@ bind '"\e[D": backward-char'
|
||||||
|
|
||||||
# vi editing mode
|
# vi editing mode
|
||||||
set -o vi
|
set -o vi
|
||||||
|
|
||||||
|
export PYENV_ROOT="$HOME/.pyenv"
|
||||||
|
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
|
||||||
|
eval "$(pyenv init - bash)"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user