-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
general.zshrc
151 lines (127 loc) · 4.45 KB
/
general.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
# vi: filetype=zsh
# general.zshrc
#
# Maintained by Byungjin Park <[email protected]>
# https://www.posquit0.com/
# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR="$( echo $(which nvim) || echo $(which vim) || echo $(which vi) )"
else
export EDITOR="$( echo $(which nvim) || echo $(which vim) || echo $(which vi) )"
fi
# Need to use gpg-agent with pinentry in macOS
export GPG_TTY=$(tty)
# Use ~/.config directory
export XDG_CONFIG_HOME="$HOME/.config"
### Locale {{{
# You may need to manually set your language environment
export LANG="en_US.UTF-8"
export LANGUAGE=
export LC_CTYPE="en_US.UTF-8"
export LC_NUMERIC="en_US.UTF-8"
export LC_TIME="en_US.UTF-8"
export LC_COLLATE="C"
export LC_MONETARY="ko_KR.UTF-8"
export LC_MESSAGES="POSIX"
export LC_PAPER="ko_KR.UTF-8"
export LC_NAME="ko_KR.UTF-8"
export LC_ADDRESS="ko_KR.UTF-8"
export LC_TELEPHONE="ko_KR.UTF-8"
export LC_MEASUREMENT="ko_KR.UTF-8"
export LC_IDENTIFICATION="ko_KR.UTF-8"
export LC_ALL=
### }}}
### History {{{
# Tell it where to save the history
export HISTFILE=$HOME/.zsh_history
# The number of lines from $HISTFILE to read at the start of an interactive session
export HISTSIZE=10000
# The number of lines of your history you want saved
export SAVEHIST=10000
# Ensure that commands are added to the history immediately
setopt inc_append_history
# Record the timestamp of each command in HISTFILE
setopt extended_history
# Skip duplicates while searching
setopt hist_find_no_dups
### }}}
### Path {{{
if [ ! "$PATH_LOADED" = "true" ]; then
# Extend $PATH with Homebrew's sbin directory
[ ! "$PATH" = "*/usr/sbin*" ] && export PATH="/usr/sbin:$PATH"
[ ! "$PATH" = "*/usr/bin*" ] && export PATH="/usr/bin:$PATH"
[ ! "$PATH" = "*/usr/local/sbin*" ] && export PATH="/usr/local/sbin:$PATH"
[ ! "$PATH" = "*/usr/local/bin*" ] && export PATH="/usr/local/bin:$PATH"
### Homebrew {{{
if [[ $OSTYPE == darwin* && $CPUTYPE == arm64 ]]; then
if [ ! "$HOMEBREW_LOADED" = "true" ]; then
eval $(/opt/homebrew/bin/brew shellenv)
export HOMEBREW_LOADED="true"
fi
fi
if [[ $OSTYPE == darwin* && $CPUTYPE == i386 ]]; then
if [ ! "$HOMEBREW_LOADED" = "true" ]; then
eval $(/usr/local/bin/brew shellenv)
export HOMEBREW_LOADED="true"
fi
fi
### }}}
# Extend $PATH with user's binary paths in home directory
[ -d $HOME/.bin ] && export PATH="$HOME/.bin:$PATH"
[ -d $HOME/bin ] && export PATH="$HOME/bin:$PATH"
[ -d $HOME/.local/bin ] && export PATH="$HOME/.local/bin:$PATH"
[ -d $HOME/scripts ] && export PATH="$HOME/scripts:$PATH"
[ -d $HOME/.rbenv/bin ] && export PATH="$HOME/.rbenv/bin:$PATH"
if which rbenv > /dev/null; then
eval "$(rbenv init - zsh)"
fi
# Extend $PATH with Ruby Gem's bin directory
if which ruby > /dev/null && which gem > /dev/null; then
PATH="$(ruby -r rubygems -e 'puts Gem.user_dir')/bin:$PATH"
fi
# Node.js
if which n > /dev/null; then
export N_PREFIX=$HOME/.n
# Extend $PATH with n's bin directory
export PATH="$N_PREFIX/bin:$PATH"
fi
if which kubectl > /dev/null; then
export PATH="$PATH:$HOME/.krew/bin"
fi
export PATH_LOADED="true"
fi
# Go PATH
if which go > /dev/null; then
export GOPATH=$HOME/go
fi
### }}}
### SSH {{{
if [[ "$(uname -s)" == "Darwin" ]]; then
# The macOS allows us to store SSH keys in the keychain
# Use `ssh-add -K /path/to/key` to store SSH keys into the macOS keychain
# Load all SSH keys that have passphrases stored in the macOS keychain
# ssh-add -A
fi
[ -d $HOME/.1password ] && export SSH_AUTH_SOCK=~/.1password/agent.sock
### }}}
### Misc {{{
# Move to that directory, if a command is issued that can't be executed as a normal command and the command is the name of a directory.
setopt auto_cd
# Enable comments in interactive shell
setopt interactive_comments
if which aws-vault > /dev/null; then
if which gopass > /dev/null; then
export AWS_VAULT_BACKEND=pass
export AWS_VAULT_PROMPT=osascript
export AWS_VAULT_PASS_CMD=gopass
export AWS_VAULT_PASS_PASSWORD_STORE_DIR=$HOME/.local/share/gopass/stores/root
export AWS_VAULT_PASS_PREFIX=aws-vault/
fi
fi
if which nvim > /dev/null; then
export KUBE_EDITOR=nvim
fi
if which zoxide > /dev/null; then
eval "$(zoxide init zsh)"
fi
### }}}