-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzshrc
77 lines (61 loc) · 1.99 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
## .zshrc
test $ZSHRC_LOADED && return
ZSHRC_LOADED=1
export shell="zsh"
## settings common to all shells
source ~/.commonrc
zstyle :compinstall filename '/usr/home/atc135/.zshrc'
autoload -Uz compinit
compinit
function git_repo_name_prompt() {
local repo_path repo_name
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
repo_path=$(git rev-parse --git-dir 2>/dev/null)
if [[ "$repo_path" == ".git" ]]; then
repo_name=$(basename $(pwd));
else
repo_name=$(basename $(dirname $repo_path));
fi
echo "[$repo_name]"
fi
}
## oh-my-zsh
export ZSH=$HOME/.oh-my-zsh
DISABLE_AUTO_UPDATE="true"
DISABLE_MAGIC_FUNCTIONS=true
ZSH_THEME=""
## history
#HISTFILE=~/.zsh_history
#HISTSIZE=5000
#SAVEHIST=5000
#setopt appendhistory
unsetopt share_history
setopt no_share_history
HIST_STAMPS="yyyy-mm-dd" # omz history wrapper
plugins=( pass terraform kubectl docker golang screen history ssh-agent kube-ps1 aws gcloud )
if ! [[ "$HOME" =~ "^/pass" ]] ; then
plugins+=(git git-prompt)
fi
# conditional plugins
#test -x "$(which aws_completer 2>/dev/null)" && plugins+='aws'
source $ZSH/oh-my-zsh.sh
KUBE_PS1_COLOR_SYMBOL="%F{cyan}"
KUBE_PS1_ENABLED=off
## theme configuration
NEWLINE=$'\n'
ZSH_THEME_GIT_PROMPT_PREFIX='('
ZSH_THEME_GIT_PROMPT_SUFFIX=')'
aws_prompt() {
if [ -n "$AWS_PROFILE" ] ; then
echo "%{$fg[cyan]%}$(aws_prompt_info) $(aws_expiry -time-left 2>/dev/null -silent) "
fi
}
## disable git prompt when $HOME is in /pass
if ! [[ "$HOME" =~ "^/pass" ]] ; then
PROMPT='%{$fg[cyan]%}[%*] %{$fg_bold[green]%}%n@%m%{$fg_bold[blue]%} %(3~|%-1~/…/%1~|%2~) %{$reset_color%}%{$fg[magenta]%}$(git_repo_name_prompt)%{$reset_color%} $(kube_ps1)$NEWLINE$(aws_prompt)%{$fg_bold[blue]%}%% %{$reset_color%}'
else
PROMPT='%{$fg[cyan]%}[%*] %{$fg_bold[green]%}%n@%m%{$fg_bold[blue]%} %(3~|%-1~/…/%1~|%2~) %{$reset_color%}$NEWLINE%{$fg_bold[blue]%}%% %{$reset_color%}'
fi
#export TZ='America/New_York'
## direnv
test -e "$(which direnv 2>/dev/null)" && eval "$(direnv hook zsh)"