Added Dotfiles
This commit is contained in:
parent
9cd2220adb
commit
9ea4faff29
17 changed files with 622 additions and 0 deletions
28
zsh/aliases.d/cd.zsh
Normal file
28
zsh/aliases.d/cd.zsh
Normal file
|
@ -0,0 +1,28 @@
|
|||
# CD
|
||||
alias ..='cd ../'
|
||||
alias ...='cd ../../'
|
||||
alias ....='cd ../../../'
|
||||
alias .....='cd ../../../../'
|
||||
|
||||
# Go up [n] directories
|
||||
function up()
|
||||
{
|
||||
local cdir="$(pwd)"
|
||||
if [[ "${1}" == "" ]]; then
|
||||
cdir="$(dirname "${cdir}")"
|
||||
elif ! [[ "${1}" =~ ^[0-9]+$ ]]; then
|
||||
echo "Error: argument must be a number"
|
||||
elif ! [[ "${1}" -gt "0" ]]; then
|
||||
echo "Error: argument must be positive"
|
||||
else
|
||||
for i in {1..${1}}; do
|
||||
local ncdir="$(dirname "${cdir}")"
|
||||
if [[ "${cdir}" == "${ncdir}" ]]; then
|
||||
break
|
||||
else
|
||||
cdir="${ncdir}"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
cd "${cdir}"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue