forked from lewagon/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc
166 lines (134 loc) · 5.67 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
159
160
161
162
163
164
165
166
# Fig pre block. Keep at the top of this file.
[[ -f "$HOME/.fig/shell/zshrc.pre.zsh" ]] && . "$HOME/.fig/shell/zshrc.pre.zsh"
# profiling
if [[ "$ZPROF" = true ]]; then
zmodload zsh/zprof
fi
# zplug framework https://github.com/zplug/zplug
# install zplug if not found
[[ -d ~/.zplug ]] || {
curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh | zsh
source ~/.zplug/zplug
zplug update --self
}
# essential
source ~/.zplug/init.zsh
ZSH=$HOME/.oh-my-zsh
##### history management #####
export HISTFILE=~/.zsh_history
export HISTSIZE=10000
export SAVEHIST=10000
setopt BANG_HIST # Treat the '!' character specially during expansion.
setopt EXTENDED_HISTORY # Write the history file in the ":start:elapsed;command" format.
setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits.
setopt SHARE_HISTORY # Share history between all sessions.
setopt HIST_EXPIRE_DUPS_FIRST # Expire duplicate entries first when trimming history.
setopt HIST_IGNORE_DUPS # Don't record an entry that was just recorded again.
setopt HIST_IGNORE_ALL_DUPS # Delete old recorded entry if new entry is a duplicate.
setopt HIST_FIND_NO_DUPS # Do not display a line previously found.
setopt HIST_IGNORE_SPACE # Don't record an entry starting with a space.
setopt HIST_SAVE_NO_DUPS # Don't write duplicate entries in the history file.
setopt HIST_REDUCE_BLANKS # Remove superfluous blanks before recording entry.
setopt HIST_VERIFY # Don't execute immediately upon history expansion.
setopt correct # try to correct spelling of commands
##### functions ####
timezsh() {
shell=${1-$SHELL}
for i in $(seq 1 10); do /usr/bin/time $shell -i -c exit; done
}
profzsh() {
shell=${1-$SHELL}
ZPROF=true $shell -i -c exit
}
# Add ruby version on prompt (float right)
# if [ -x "$(command -v rbenv)" ]; then RPS1='[$(ruby_prompt_info)]$EPS1'; fi
# custom title
# DISABLE_AUTO_TITLE="true"
# case $TERM in
# xterm*)
# precmd () {print -Pn "\e]0;%~\a"}
# ;;
# esac
##### theme #####
zplug "Mheaus/zsh-theme", from:github, as:theme
# zplug "themes/robbyrussell", from:oh-my-zsh, as:theme
# zplug "ergenekonyigit/lambda-gitster", from:github, as:theme
# zplug "NicolaiRuckel/oh-my-zsh-candy-light", from:github, as:theme
# zplug "denysdovhan/spaceship-prompt", use:spaceship.zsh, from:github, as:theme
# You can change the theme with another one:
# https://github.com/robbyrussell/oh-my-zsh/wiki/themes
# ZSH_THEME="robbyrussell"
##### plugins #####
# installing, updating and loading nvm
export NVM_LAZY_LOAD=true
export NVM_DIR="$HOME/.nvm"
# . "/usr/local/opt/nvm/nvm.sh"
zplug "nvm-sh/nvm", use:nvm.sh # same
# zplug "lukechilds/zsh-nvm"
# oh-my-zsh plugins
# plugins=(gitfast brew rbenv last-working-dir common-aliases zsh-syntax-highlighting history-substring-search z cp osx battery bgnotify)
zplug "plugins/git", from:oh-my-zsh
zplug "plugins/gitfast", from:oh-my-zsh
zplug "plugins/common-aliases", from:oh-my-zsh
zplug "plugins/z", from:oh-my-zsh
zplug "plugins/cp", from:oh-my-zsh
zplug "plugins/osx", from:oh-my-zsh
zplug "plugins/battery", from:oh-my-zsh
zplug "plugins/bgnotify", from:oh-my-zsh
zplug "zsh-users/zsh-syntax-highlighting"
# don't forget to bindkey with zsh-history-substring-search :
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
zplug "zsh-users/zsh-history-substring-search"
zplug "zsh-users/zsh-autosuggestions"
zplug "mdumitru/last-working-dir"
# handle dark/light theme
zplug "pndurette/zsh-lux"
# plugin that reminds you to use existing aliases for commands you just typed
zplug "MichaelAquilina/zsh-you-should-use"
# automatically switch versions of node by looking for a .nvmrc file in the path tree
zplug "aspirewit/zsh-nvm-auto-switch"
# Prevent Homebrew from reporting - https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Analytics.md
# export HOMEBREW_NO_ANALYTICS=1
# Rails and Ruby uses the local `bin` folder to store binstubs.
# So instead of running `bin/rails` like the doc says, just run `rails`
# export PATH="./bin:${PATH}:/usr/local/sbin"
# Encoding stuff for the terminal
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
# export BUNDLER_EDITOR="subl $@ >/dev/null 2>&1"
# Always enable colored `grep` output.
export GREP_OPTIONS='--color=auto';
# set default git main branch to main
export git_main_branch="main"
# iterm shell integration
# test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
# install plugins if some of them are not installed yet
if ! zplug check --verbose; then
printf "Install? [y/N]: "
if read -q; then
echo; zplug install
fi
fi
# essential
zplug load
##### aliases #####
[[ -f "$HOME/.aliases" ]] && source "$HOME/.aliases"
# Github NPM Token variable
# extract //npm.pkg.github.com/:_authToken= value from .npmrc
export GITHUB_TOKEN=$(grep -E '//npm.pkg.github.com/:_authToken=' ~/.npmrc | cut -d '=' -f 2)
# flutter path
export PATH="$PATH:`pwd`/flutter/bin"
# end of profiling
if [[ "$ZPROF" = true ]]; then
zprof
fi
# [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# archey swag from https://github.com/HorlogeSkynet/archey4
archey
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/math/Downloads/google-cloud-sdk/path.zsh.inc' ]; then . '/Users/math/Downloads/google-cloud-sdk/path.zsh.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/Users/math/Downloads/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/math/Downloads/google-cloud-sdk/completion.zsh.inc'; fi
# Fig post block. Keep at the bottom of this file.
[[ -f "$HOME/.fig/shell/zshrc.post.zsh" ]] && . "$HOME/.fig/shell/zshrc.post.zsh"