-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
132 lines (116 loc) · 4.45 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
# Add Homebrew to the PATH.
eval "$(/opt/homebrew/bin/brew shellenv)"
# Add PHP 8.1 from Homebrew to the PATH.
export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"
export PATH="/opt/homebrew/opt/[email protected]/sbin:$PATH"
# Add brew's version of curl to the PATH
export PATH="$(brew --prefix curl)/bin:$PATH"
# Run Oh My Posh prompt.
# See: https://ohmyposh.dev/
eval "$(oh-my-posh --init --shell zsh --config $HOME/.zsh/adamnorwood.omp.json)"
# Aliases to make life easier.
alias ...='cd ../../'
alias ....='cd ../../../'
alias -g ...='../../'
alias dc='docker-compose'
alias gb='git branch'
alias gbd='git branch -d'
alias gbm='git branch --merge'
alias gcb='git checkout -b'
alias gco='git checkout'
alias grep='grep --color=auto'
alias h='history 1'
alias hs='history 1| grep'
alias hsi='history 1| grep -i'
alias ip='ifconfig | egrep -o "inet ([0-9]{1,3}(\.)?){0,4}" | tr -d "\040\011inet"'
alias l='ls -lAh'
alias sizes='du -hd1|gsort -hr'
# Search current directory, home directory, and www projects folder
# See: http://weblog.bocoup.com/shell-hacking-cdpath/
cdpath=(. $HOME/www/)
# Set up Zsh options. There are many of these that can be tweaked!
# See: https://zsh.sourceforge.io/Doc/Release/Options.html
setopt alwaystoend
setopt appendhistory
setopt autocd
setopt autolist
setopt automenu
setopt autopushd
setopt completeinword
setopt correct
setopt extendedhistory
setopt histexpiredupsfirst
setopt histignoredups
setopt histignorespace
setopt histverify
setopt interactivecomments
setopt listpacked
setopt longlistjobs
setopt nocaseglob
setopt noflowcontrol
setopt promptsubst
setopt pushdignoredups
setopt pushdminus
setopt sharehistory
# Tweak some history options.
export HISTSIZE=10000
export SAVEHIST=10000
export HISTFILE=~/.zsh/.zsh_history
# Set up zsh up/down/home/end key search completions.
autoload -U history-search-end
zle -N history-beginning-search-backward-end history-search-end
zle -N history-beginning-search-forward-end history-search-end
bindkey -e
bindkey "^[[A" history-beginning-search-backward-end
bindkey "^[[B" history-beginning-search-forward-end
bindkey '\e[H' beginning-of-line
bindkey '\e[F' end-of-line
bindkey '[C' forward-word
bindkey '[D' backward-word
# A handy git diff that ignores JS and CSS sourcemaps and compiled files.
function gdiff () {
git diff $1 ':!*.map' ':!*.css' ':!*.min.*'
}
# Use VS Code as the designated editor (for git commit messages, etc.)
export EDITOR='code'
# Set up color for tools that use termcap, like less and man.
export LESS_TERMCAP_mb=$(print -P "%F{cyan}") \
LESS_TERMCAP_md=$(print -P "%B%F{cyan}") \
LESS_TERMCAP_me=$(print -P "%f%b") \
LESS_TERMCAP_so=$(print -P "%K{magenta}") \
LESS_TERMCAP_se=$(print -P "%K{black}") \
LESS_TERMCAP_us=$(print -P "%U%F{yellow}") \
LESS_TERMCAP_ue=$(print -P "%f%u")
# Add files and directories color when running ls
# There's a generator here: http://geoff.greer.fm/lscolors/
export CLICOLOR=1
export LS_COLORS='di=36:ln=1;35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43'
export GREP_COLOR='1;35;40'
# Run zsh-syntax-highlighting (installed via homebrew).
# See: https://github.com/zsh-users/zsh-syntax-highlighting
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# Trick out the zsh completion engine.
# See: https://www.csse.uwa.edu.au/programming/linux/zsh-doc/zsh_23.html
# The following lines were added by compinstall
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _complete _ignored _approximate
zstyle ':completion:*' completions 1
zstyle ':completion:*' glob 1
zstyle ':completion:*' group-name ''
zstyle ':completion:*' insert-unambiguous true
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' matcher-list 'm:{[:lower:]}={[:upper:]}'
zstyle ':completion:*' max-errors 1
zstyle ':completion:*' menu select=0
zstyle ':completion:*' original true
zstyle ':completion:*' prompt 'Did you mean?'
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' verbose true
autoload -Uz compinit
compinit
# See: https://iterm2.com/documentation-shell-integration.html
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
# Just adding a fun image for when the shell first opens. Why? Because I can.
# Require imgcat: https://github.com/eddieantonio/imgcat
# imgcat ~/Pictures/bubble-bobble.png