-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdot_zshrc
187 lines (124 loc) · 4.26 KB
/
dot_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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# .zshrc
export ZRC=$HOME/.zshrc
####################
# Powerlevel10k #
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
source /usr/local/share/powerlevel10k/powerlevel10k.zsh-theme
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
ZSH_DISABLE_COMPFIX=true
#####################
#####################
# OH-MY-ZSH
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# Plugins
plugins=(git brew sudo zsh-autosuggestions zsh-syntax-highlighting web-search python copypath copyfile copybuffer history macos)
# ZSH syntax highlighting
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# ZSH autosuggestions
source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh
source $ZSH/oh-my-zsh.sh
######################
######################
# FZF-TAB-COMPLETION
source $HOME/.oh-my-zsh/custom/plugins/fzf-tab-completion/zsh/fzf-zsh-completion.sh
bindkey '^I' fzf_completion
######################
######################
# ENV MAN
# Generated for envman. Do not edit.
[ -s "$HOME/.config/envman/load.sh" ] && source "$HOME/.config/envman/load.sh"
######################
######################
# iTerm2
export ITERMPLIST="~/Library/Preferences/com.googlecode.iterm2.plist"
######################
######################
# SSH
# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='nano'
else
export EDITOR='vim'
fi
######################
######################
# Aliases
# quickly edit and source .zshrc
alias nz="nano ~/.zshrc"
alias sz=" source ~/.zshrc; echo '~/.zshrc sourced'"
alias bz="bat ~/.zshrc"
# VSCode zshrc
alias cz="code ~/.zshrc"
# Other useful alias
alias grep='grep --color'
alias c="clear"
alias ls='lsd'
alias l='ls -l'
alias la='ls -a'
alias lla='ls -la'
alias lt='ls --tree'
alias ll="ls -lah"
alias lh="ls -a | egrep '^\.'"
alias copy="cp"
alias f='find . | grep'
# thefuck
eval $(thefuck --alias)
# fzf with bat
alias fzf='fzf --preview "bat --color=always --style=numbers --line-range=:500 {}"'
# sudo with aliases
alias sudo='sudo '
# nanorc with sudo
alias nano='nano --rcfile ~/.nanorc'
# IP alias and functions
alias ip0="ifconfig -a | egrep -A 7 '^en0' | grep inet | grep -oE '((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])' | head -n 1"
alias ip1="ifconfig -a | egrep -A 7 '^en1' | grep inet | grep -oE '((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])' | head -n 1"
alias ip2="ifconfig -a | egrep -A 7 '^en2' | grep inet | grep -oE '((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])' | head -n 1"
#alias ip="ip0;ip1;ip2"
alias myip="curl -s http://checkip.dyndns.org/ | sed 's/[a-zA-Z<>/ :]//g'"
# Pretty print the PATH
alias path='echo; tr ":" "\n" <<< "$PATH"; echo;'
# Shutdown information
alias crashlog="log show --predicate 'eventMessage contains \"Previous shutdown cause\"' --last 24h"
# Brew Bundle file
alias brew-file="brew bundle dump --file=~/.config/Brewfile --force"
# Open finder (like windows)
alias finder="open -a Finder"
# Flush DNS
alias flushdns="sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder"
######################
#####################
# Functions
wttr() {
# Get the weather
curl "https://wttr.in/${1:-sherbrooke}"
}
chrome() {
open https://www.gmail.com
open https://calendar.google.com/
open https://keep.google.com/
open https://ti.beauvoir.ca/
}
ip () {
# List all IP addresses
for ((i = 0; i < 10; i++));
do
ifconfig -a | egrep -A 7 "^en$i" | grep inet | grep -oE '((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])' | head -n 1
done
}
pms () {
# Open Pharmascience websites
open https://services-professionnels.pharmascience.com/
open https://pendopharm.com/
open https://carrieres.pharmascience.com/
open https://www.pharmascience.com/
}
giturl () {
# Open git remote url
open `git remote -v | awk '/fetch/{print $2}' | sed -Ee 's#(git@|git://)#http://#' -e 's@com:@com/@'`| head -n1
}
#####################