mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-17 21:24:49 +10:00
Replaced navigation aliases with up() function
This commit is contained in:
23
.bashrc
23
.bashrc
@@ -106,11 +106,24 @@ ex ()
|
||||
alias doas="doas --"
|
||||
|
||||
# navigation
|
||||
alias ..='cd ..'
|
||||
alias ...='cd ../..'
|
||||
alias .3='cd ../../..'
|
||||
alias .4='cd ../../../..'
|
||||
alias .5='cd ../../../../..'
|
||||
up () {
|
||||
local d=""
|
||||
local limit="$1"
|
||||
|
||||
# Default to limit of 1
|
||||
if [ -z "$limit" ] || [ "$limit" -le 0 ]; then
|
||||
limit=1
|
||||
fi
|
||||
|
||||
for ((i=1;i<=limit;i++)); do
|
||||
d="../$d"
|
||||
done
|
||||
|
||||
# perform cd. Show error if cd fails
|
||||
if ! cd "$d"; then
|
||||
echo "Couldn't go up $limit dirs.";
|
||||
fi
|
||||
}
|
||||
|
||||
# vim and emacs
|
||||
alias vim="nvim"
|
||||
|
||||
Reference in New Issue
Block a user