forked from driesvints/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 1
/
aliases.zsh
81 lines (65 loc) · 2.18 KB
/
aliases.zsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Shortcuts
alias copyssh="id_rsa.pub"
alias reloadshell="source \$HOME/.zshrc"
alias reloaddns="dscacheutil -flushcache && sudo killall -HUP mDNSResponder"
alias c="clear"
# Search history
alias hg="history | grep -i"
# Search running processes
alias wg="what | grep -v grep | grep -i"
alias what="ps waux"
# LS aliases
_LS="/usr/local/opt/coreutils/libexec/gnubin/ls -AlFo --color --group-directories-first"
alias ll="$_LS"
alias la="$_LS -a"
alias lh="$_LS -h"
alias ls="$_LS"
alias lt="$_LS -t"
alias lll='ll|less'
alias lhl='lh|less'
# I always forget how to create a tarball
alias htar="echo 'tar czf <name.tar.gz> <directory>'"
# Directories
alias dotfiles="cd \$DOTFILES"
alias library="cd \$HOME/Library"
# Laravel
alias a="php artisan"
alias fresh="php artisan migrate:fresh --seed"
alias seed="php artisan db:seed"
# Vagrant
alias v="vagrant global-status"
alias vup="vagrant up"
alias vhalt="vagrant halt"
alias vssh="vagrant ssh"
alias vreload="vagrant reload"
alias vrebuild="vagrant destroy --force && vagrant up"
# Git
# alias gst="git status"
# alias gb="git branch"
# alias gc="git checkout"
# alias gl="git log --oneline --decorate --color"
# alias amend="git add . && git commit --amend --no-edit"
# alias commit="git add . && git commit -m"
# alias diff="git diff"
# alias force="git push --force"
# alias nuke="git clean -df && git reset --hard"
# alias pop="git stash pop"
# alias pull="git pull"
# alias push="git push"
# alias resolve="git add . && git commit --no-edit"
# alias stash="git stash -u"
# alias unstage="git restore --staged ."
# alias wip="commit wip"
# PHP switching
# https://localheinz.com/blog/2020/05/05/switching-between-php-versions-when-using-homebrew/
installedPhpVersions=($(brew ls --versions | ggrep -E 'php(@.*)?\s' | ggrep -oP '(?<=\s)\d\.\d' | uniq | sort))
for phpVersion in ${installedPhpVersions[*]}; do
value="{"
for otherPhpVersion in ${installedPhpVersions[*]}; do
if [ "${otherPhpVersion}" != "${phpVersion}" ]; then
value="${value} brew unlink php@${otherPhpVersion};"
fi
done
value="${value} brew link php@${phpVersion} --force --overwrite; } &> /dev/null && php -v"
alias "${phpVersion}"="${value}"
done