-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc
139 lines (112 loc) · 3.52 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
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Themes
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="robbyrussell"
# Plugins
# plugins=(git)
source $ZSH/oh-my-zsh.sh
# Add Brew to zsh
eval "$(/opt/homebrew/bin/brew shellenv)"
#Prefix
PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜$reset_color )"
# Git Prompt (Slow!)
# PROMPT+='%{$fg[cyan]%}%c%{$reset_color%}$(git_prompt_info):'
# PWD (Fast!)
PROMPT+='$fg[cyan]%* $fg[blue][$fg[red]%d$fg[blue]] $fg[yellow]✘:$reset_color'
# ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg_bold[blue]%}git:(%{$fg[red]%}"
# ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
# ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%})%{$fg[yellow]%} ✘"
# ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})%{$fg[yellow]%} ✔"
# 🦑 🌿 🌲 🌎 🦊 🚀 🦌 ⛺ ⛰ 🏔 🏕 🔥
# Righthand Prompt
# RPROMPT="$ZSH_THEME_GIT_PROMPT_PREFIX"
# File and directory shortcuts
alias ...='cd ../../'
alias ..='cd ../'
alias filecount="ls -1R | grep -v ^$ | grep -v :$ | wc -l"
alias functions="functions +"
alias grep='grep --color=auto'
# Git shortcuts
alias gb="git branch"
alias gc="git clean -f -d -x "
alias gd="git diff"
alias gf="git fetch --all --prune"
alias gf="git fetch origin main"
alias gl="git log --pretty=oneline"
alias gp="git pull"
alias gr="git reset --soft HEAD~1"
alias gs="git status -uno"
alias todo="git diff | grep -A 3 TODO"
alias xc="/Applications/Xcode\ 14.3.1.app/Contents/MacOS/Xcode"
# Dev shortcuts
alias ft="./tools/npe/npe generate feature-toggles"
alias dl="xcrun simctl openurl booted \"ebay://link?nav=webview&url=https://www.ebay.co.uk/explore\""
# See https://the.exa.website/
alias la='exa -bhHla'
alias ll='exa -bhHl'
alias ls='exa -bhHl'
# Reload your zsh profile
alias reload="source ~/.zshrc"
# Set screenshot default directory
alias updatescreenshots="defaults write com.apple.screencapture location ~/Pictures/Screenshots; killall SystemUIServer"
# Load/unload GlobalProtect
alias {unloadvpn,unloadglobalprotect,killvpn}="launchctl unload /Library/LaunchAgents/com.paloaltonetworks.gp.pangp*"
alias {loadvpn,loadglobalprotect,startvpn}="launchctl load /Library/LaunchAgents/com.paloaltonetworks.gp.pangp*"
# Hide macOS Upgrade Notifications
alias hideupdates="defaults write com.apple.systempreferences AttentionPrefBundleIDs 0"
# Delete Xcode Derived Data
function ddd() {
rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf ~/.Trash/*
DIR="/Users/robbking/Library/Developer/Xcode/DerivedData"
if [ "$(ls $DIR)" ]; then
echo 'Something went wrong, try cleaning manually.'
open $DIR
else
echo 'Successfully removed all Xcode derived data!'
git status
fi
}
# Count files by extension
function filetypecount() {
find . -iname "*.$@" | wc -l
}
function branchDate() {
command git reflog show --date=iso "$@"
}
# GREP, then copy the output
function cgrep() {
command grep "$@" | sed 's/^ *//g' | tr '\n' ' ' | pbcopy
pbpaste
}
function cd() {
builtin cd "$@";
command exa -bhHll
}
function listFunctions() {
functions +
}
function stash(){
command git stash push -m "$@"
}
function vpn() {
if [ "$@" == "on" ]; then
loadvpn
echo "VPN enabled!"
else
unloadvpn
echo "VPN disabled!"
fi
}
function wifipassword() {
security find-generic-password -wa "$@"
}
function gitsearch() {
for stash in $(git stash list | cut -d: -f1); do
echo "Searching in $stash..."
git stash show -p $stash | grep "$@" && echo "Found in $stash"
done
}