mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2023-02-13 20:55:19 -05:00
Replaced navigation aliases with up() function
This commit is contained in:
parent
b5929750bc
commit
6cc985f5ca
1 changed files with 18 additions and 5 deletions
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"
|
||||
|
|
Loading…
Reference in a new issue