-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
158 lines (150 loc) · 5.16 KB
/
.zshrc
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# export PATH=/opt/homebrew/bin:$PATH # the version depends on where homebrew is installed
export PATH=/usr/local/bin:$PATH # Also check the git/gitconfig file
# export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/Contents/Home
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jbr/Contents/Home
# eval "$(/opt/homebrew/bin/brew shellenv)"
eval "$(brew shellenv)"
ZSH_AUTOSUGGEST_CASE_SENSITIVE="false"
source $HOMEBREW_PREFIX/share/zsh-autosuggestions/zsh-autosuggestions.zsh
source $HOMEBREW_PREFIX/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source $HOMEBREW_PREFIX/share/zsh-history-substring-search/zsh-history-substring-search.zsh
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
# Lazy Load NVM
export NVM_DIR="$HOME/.nvm"
nvm() {
unset -f nvm
source "$(brew --prefix nvm)/nvm.sh"
nvm "$@"
}
node() {
unset -f node
source "$(brew --prefix nvm)/nvm.sh"
node "$@"
}
npm() {
unset -f npm
source "$(brew --prefix nvm)/nvm.sh"
npm "$@"
}
# Find and set branch name var if in git repository.
function git_branch_name()
{
branch=$(git symbolic-ref HEAD 2> /dev/null | awk 'BEGIN{FS="/"} {print $NF}')
if [[ $branch == "" ]];
then
:
else
echo '- ('$branch')'
fi
}
# Enable substitution in the prompt.
setopt prompt_subst
# Config for prompt. PS1 synonym.
PROMPT='%F{cyan}%2/%f $(git_branch_name) %F{cyan}>%f '
# Path
export ANDROID_HOME=/Users/be/Library/Android/sdk
# Aliases
alias bootstrap="bash ~/personal/dotfiles/bootstrap.sh"
branch() {
git checkout -b "$1"
git push --set-upstream origin "$1"
}
alias c="clear"
alias chats="open /Applications/WhatsApp.app/ /Applications/Telegram.app/ /Applications/Signal.app/"
clojure() {
java -jar "$@"
}
alias dot="cd ~/personal/dotfiles/"
alias dotfiles="cd ~/personal/dotfiles/"
alias emails="open https://www.gmail.com https://mail.aalto.fi https://webmail.numanconsult.com https://linkedin.com"
extract() {
for file in "$@"; do
if [[ -f $file ]]; then
echo "Extracting $file"
case $file in
*.7z) 7z x "$file";;
*.tar) tar -xvf "$file";;
*.tar.bz2 | *.tbz2) tar --bzip2 -xvf "$file";;
*.tar.gz | *.tgz) tar --gzip -xvf "$file";;
*.bz | *.bz2) bunzip2 "$file";;
*.gz) gunzip "$file";;
*.rar) unrar x "$file";;
*.zip) unzip -uo "$file" -d "$(basename "$file" .zip)";;
*.Z) uncompress "$file";;
*.pax) pax -r < "$file";;
*) echo "Extension not recognized, cannot extract $file";;
esac
else
echo "$file is not a valid file"
fi
done
}
g() {
open "https://www.google.com/search?tbm=isch&q=$1"
}
alias ga='git add'
alias gb='git branch'
gc() {
git commit -m "$1"
}
gch() {
git checkout "$1"
git push --set-upstream origin "$1"
git pull
}
alias gd='clear && git diff'
alias git_branch_cleanup='git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d && git remote prune origin'
alias gl='git pull'
alias gpl='git pull'
alias gp='clear && git push'
alias go='clear && git push && gh pr create --fill'
alias grm='git rebase master'
alias gs='clear && git status'
alias gum='git checkout master && git pull && git checkout -'
alias gurm='git checkout master && git pull && git pull && git checkout - && git rebase master'
gif_compress() {
case $2 in
high) gifsicle --interlace $1 -O3 --colors 64 --output compressed.gif;;
medium) gifsicle --interlace $1 -O3 --colors 128 --output compressed.gif;;
low) gifsicle --interlace $1 -O3 --colors 256 --output compressed.gif;;
*) echo "Usage: gif_compress FILE high/medium/low";;
esac
}
alias ii='clear && http ipinfo.io --print=b'
alias lint='lein bikeshed && clj-kondo --lint src test && lein cljstyle fix'
ll() {
clear
ls -lah "$@"
}
personal_hotspot() {
networksetup -setairportnetwork en0 "Nordic Roadshow" $1
}
pomodoro() {
sleep 1500
notification "Pomodoro over" "25 minutes have passed, you are aware"
}
alias r='lein run || bin/serve'
up() {
echo -e "####################################\n# Software Update \n####################################"
sudo softwareupdate --install --all
echo -e "####################################\n# Brew \n####################################"
brew update
brew upgrade
mas upgrade
brew cask outdated --greedy --verbose | ack --invert-match latest | awk "{print \$1;}" | xargs brew cask upgrade
brew cleanup
brew doctor
echo -e "####################################\n# Pip \n####################################"
pip-sync ~/personal/dotfiles/pip/requirements.txt
echo -e "####################################\n# Npm \n####################################"
npm update -g
echo -e "\n####################################\n# Oh-My-Fish \n####################################"
omf install
omf update
echo -e "####################################\n# Done \n####################################"
}
ws() {
open -na "/Users/be/Applications/WebStorm.app" --args "$@"
}
export PATH=$PATH:$HOME/.maestro/bin