|
## TEMPLATE TO USE THEME ## |
|
export ZSH=$HOME/.oh-my-zsh |
|
export DEFAULT_USER='haidv' |
|
TERM=xterm-256color |
|
DISABLE_MAGIC_FUNCTIONS=true |
|
ZSH_AUTOSUGGEST_MANUAL_REBIND=1 |
|
COMPLETION_WAITING_DOTS=true |
|
DISABLE_UNTRACKED_FILES_DIRTY=true |
|
|
|
# Set name of the theme to load. Optionally, if you set this to "random" |
|
# it'll load a random theme each time that oh-my-zsh is loaded. |
|
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes |
|
ZSH_THEME="powerlevel10k/powerlevel10k" |
|
|
|
############ POWERLEVEL THEME SETTINGS ############## |
|
POWERLEVEL9K_MODE='awesome-fontconfig' |
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs nvm) |
|
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(disk_usage time) |
|
|
|
POWERLEVEL9K_PROMPT_ADD_NEWLINE=true |
|
POWERLEVEL9K_PROMPT_ON_NEWLINE=true |
|
POWERLEVEL9K_SHOW_RULER=true |
|
POWERLEVEL9K_RULER_CHAR='─' |
|
POWERLEVEL9K_RULER_BACKGROUND=none |
|
POWERLEVEL9K_RULER_FOREGROUND=237 |
|
|
|
POWERLEVEL9K_LEFT_SEGMENT_END_SEPARATOR= |
|
POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR= |
|
POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR=' ' |
|
POWERLEVEL9K_RIGHT_SEGMENT_END_SEPARATOR= |
|
POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR= |
|
POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR= |
|
POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS= |
|
|
|
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 |
|
POWERLEVEL9K_SHORTEN_STRATEGY="truncate_middle" |
|
|
|
POWERLEVEL9K_DIR_SHOW_WRITABLE=true |
|
|
|
POWERLEVEL9K_DISK_USAGE_NORMAL_BACKGROUND=none |
|
POWERLEVEL9K_DISK_USAGE_WARNING_BACKGROUND=magenta |
|
POWERLEVEL9K_DISK_USAGE_CRITICAL_BACKGROUND=red |
|
POWERLEVEL9K_TIME_BACKGROUND=none |
|
POWERLEVEL9K_TIME_FOREGROUND=white |
|
|
|
POWERLEVEL9K_DIR_HOME_BACKGROUND=none |
|
POWERLEVEL9K_DIR_HOME_SUBFOLDER_BACKGROUND=none |
|
POWERLEVEL9K_DIR_ETC_BACKGROUND=none |
|
POWERLEVEL9K_DIR_DEFAULT_BACKGROUND=none |
|
POWERLEVEL9K_DIR_NOT_WRITABLE_BACKGROUND=none |
|
|
|
POWERLEVEL9K_DIR_HOME_FOREGROUND=blue |
|
POWERLEVEL9K_DIR_HOME_SUBFOLDER_FOREGROUND=blue |
|
POWERLEVEL9K_DIR_ETC_FOREGROUND=blue |
|
POWERLEVEL9K_DIR_DEFAULT_FOREGROUND=blue |
|
POWERLEVEL9K_DIR_NOT_WRITABLE_FOREGROUND=red |
|
|
|
POWERLEVEL9K_OS_ICON_BACKGROUND="white" |
|
POWERLEVEL9K_OS_ICON_FOREGROUND="blue" |
|
|
|
POWERLEVEL9K_VCS_GIT_ICON='%fon %F{040}\uf1d3 ' |
|
POWERLEVEL9K_VCS_GIT_GITHUB_ICON='%fon %F{040}\uf09b ' |
|
POWERLEVEL9K_VCS_GIT_BITBUCKET_ICON='%fon %F{040}\uf171 ' |
|
POWERLEVEL9K_VCS_GIT_GIT_GITLAB_ICON='%fon %F{040}\uf296 ' |
|
|
|
POWERLEVEL9K_VCS_CLEAN_BACKGROUND=none |
|
POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND=none |
|
POWERLEVEL9K_VCS_MODIFIED_BACKGROUND=none |
|
POWERLEVEL9K_VCS_LOADING_BACKGROUND=none |
|
POWERLEVEL9K_VCS_CLEAN_FOREGROUND="040" |
|
POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND="red" |
|
POWERLEVEL9K_VCS_MODIFIED_FOREGROUND="yellow" |
|
POWERLEVEL9K_VCS_LOADING_FOREGROUND="grey" |
|
|
|
POWERLEVEL9K_VCS_UNTRACKED_ICON=$'%{\b?%}' |
|
POWERLEVEL9K_VCS_UNSTAGED_ICON=$'%{\b!%}' |
|
POWERLEVEL9K_VCS_STAGED_ICON=$'%{\b+%}' |
|
|
|
POWERLEVEL9K_DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_COLOR=red |
|
POWERLEVEL9K_LOCK_ICON=$'\uf023' |
|
|
|
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX='' |
|
local p='%F{%(?.green.red)}${${${KEYMAP:-0}:#vicmd}:+❯}${${$((!${#${KEYMAP:-0}:#vicmd})):#0}:+❮}%f ' |
|
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="$p" |
|
|
|
POWERLEVEL9K_NVM_BACKGROUND=none |
|
POWERLEVEL9K_NVM_FOREGROUND=green |
|
POWERLEVEL9K_NODE_ICON='%fvia %F{green}⬢' |
|
|
|
############ END- POWERLEVEL THEME SETTINGS ############## |
|
ENABLE_CORRECTION="false" |
|
HIST_STAMPS="mm/dd/yyyy" |
|
plugins=( |
|
poetry |
|
git |
|
yarn |
|
git-extras |
|
bundler |
|
osx |
|
ruby |
|
rvm |
|
sudo |
|
sublime |
|
history |
|
history-substring-search |
|
last-working-dir |
|
compleat zsh-completions |
|
zsh-history-substring-search |
|
zsh-autosuggestions |
|
zsh-syntax-highlighting |
|
zsh-syntax-highlighting-filetypes |
|
warhol |
|
zsh-kubernetes |
|
nano |
|
vagrant |
|
python |
|
colored-man |
|
colorize |
|
pip |
|
docker |
|
docker-compose |
|
docker-machine |
|
emoji-clock |
|
vim |
|
xcode |
|
kube-ps1 |
|
npm |
|
minikube |
|
) |
|
autoload -U compinit && compinit -d ~/.cache/zsh/zcompdump-$ZSH_VERSION |
|
source $ZSH/oh-my-zsh.sh |
|
PROMPT=$PROMPT'$(kube_ps1) ' |
|
bindkey '\e[A' history-beginning-search-backward |
|
bindkey '\e[B' history-beginning-search-forward |
|
|
|
export CLICOLOR=1 |
|
export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx |
|
|
|
source '/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc' |
|
source '/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc' |
|
|
|
### zsh highlight ### |
|
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh |
|
|
|
### PECO configurartion for crt + r #### |
|
|
|
function peco-select-history() { |
|
local tac |
|
if which tac > /dev/null; then |
|
tac="tac" |
|
else |
|
tac="tail -r" |
|
fi |
|
BUFFER=$(\history -n 1 | \ |
|
eval $tac | \ |
|
peco --query "$LBUFFER") |
|
CURSOR=$#BUFFER |
|
zle clear-screen |
|
} |
|
zle -N peco-select-history |
|
bindkey '^r' peco-select-history |
|
|
|
### Set Git language to English ### |
|
#alias git='LANG=en_US git' |
|
alias git='LANG=en_GB git' |
|
|
|
alias -g B='`git branch -a | peco --prompt "GIT BRANCH>" | head -n 1 | sed -e "s/^\*\s*//g"`' |
|
alias -g R='`git reflog | peco | cut -d" " -f1`' |
|
alias -g C='`git log --oneline | peco | cut -d" " -f1`' |
|
alias -g o='open' |
|
|
|
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh" |
|
|
|
### alias for make and make install gcc ### |
|
# Usage: `mgcc make && mgcc make install` |
|
alias -g mgcc='`CXX="g++ -Wno-unused-local-typedefs"`' |
|
|
|
### Language for shell when start ### |
|
export LC_ALL=en_US.UTF-8 |
|
export LANG=en_US.UTF-8 |
|
|
|
### GOLANG Configuration ### |
|
export GOPATH=$HOME/go |
|
export PATH=$PATH:/User/haidv/go/bin |
|
export PATH="/usr/local/sbin:$PATH" |
|
export PATH=$PATH:$(go env GOPATH)/bin |
|
export PATH=/usr/local/bin:$PATH |
|
export GOPROXY=https://goproxy.io |
|
|
|
##################################### |
|
### Kubernetes ###################### |
|
##################################### |
|
|
|
alias kctx='kubectx' |
|
alias kns='kubens' |
|
alias kt='kubectl top' |
|
alias ktn='kubectl top nodes' |
|
alias ktp='kubectl top pods' |
|
|
|
### PYTHON Configuration ### |
|
alias python='python3' |
|
export PYENV_ROOT="$HOME/.pyenv" |
|
export PATH="$PYENV_ROOT/bin:$PATH" |
|
if command -v pyenv 1>/dev/null 2>&1; then |
|
\eval "$(pyenv init -)" |
|
fi |
|
|
|
### Terraform alias ### |
|
alias tf='terraform' |
|
|
|
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change. |
|
export PATH=/usr/local/gcc-8.2/bin:$PATH |
|
|
|
# Add Vault |
|
export PATH="$PATH:/Applications" |
|
autoload -U +X bashcompinit && bashcompinit |
|
complete -o nospace -C /Applications/vault vault |
|
|
|
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change. |
|
export PATH="$PATH:$HOME/.rvm/bin" |
|
export PATH="/usr/local/sbin:$PATH" |
|
|
|
# Clean out your Docker container/image |
|
|
|
alias docker-clean-unused='docker system prune --all --force --volumes' |
|
alias docker-clean-all='docker stop $(docker container ls -a -q) && docker system prune -a -f --volumes' |
|
alias docker-clean-containers='docker container stop $(docker container ls -a -q) && docker container rm $(docker container ls -a -q)' |
|
|
|
# View Docker Service status, usage: [command] <service name> |
|
|
|
alias docker-service-ps="docker service ps --format 'table {{.ID}}\t{{.Name}}\t{{.Node}}\t{{.CurrentState}}'" |
|
|
|
# View Network inspect for all container |
|
|
|
alias docker-network-inspect="docker container inspect --format '{{json .NetworkSettings.Networks}}' $(docker container ls -lq) | jq '.'" |
|
|
|
# View task running in swarm node, usage: [command] <node name> |
|
alias docker-node-task="docker node ps --format 'table {{.ID}}\t{{.Name}}\t{{.Node}}\t{{.CurrentState}}'" |
|
|
|
### TMUX ### |
|
set -g status-position bottom |
|
set -g status-bg colour237 |
|
set -g status-fg colour137 |
|
set -g status-attr dim |
|
set -g status-left '#[fg=colour197]#(~/bin/internet_info.sh) #{tasks_status} ' |
|
set -g status-right '#[fg=colour81]♪ #(~/bin/now_playing.sh) #(~/bin/battery.sh) #[fg=colour255,bg=colour241,bold] %a %m-%d #[fg=colour255,bg=colour241,bold] %H:%M:%S #[fg=colour165]#[bg=default] #H ' |
|
set -g status-right-length 100 |
|
set -g status-left-length 70 |
|
|
|
################# |
|
|
|
###### NANO #### |
|
|
|
alias nano='/usr/local/Cellar/nano/4.8/bin/nano --tabstospaces' |
|
|
|
|
|
############ AWS |
|
export AWS_DEFAULT_PROFILE=haidv |
|
export AWS_SDK_LOAD_CONFIG=true |
|
|
|
### Alias |
|
alias update="source ~/.zshrc" |
|
alias c=clear |
|
|
|
### Colorise the top Tabs of Iterm2 with the same color as background |
|
echo -e "\033]6;1;bg;red;brightness;18\a" |
|
echo -e "\033]6;1;bg;green;brightness;26\a" |
|
echo -e "\033]6;1;bg;blue;brightness;33\a" |
|
|
|
|
|
# Add this at the BOTTOM |
|
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" |
|
# Load RVM into a shell session *as a function* |
|
|
|
## Lazydocker |
|
alias lzd='lazydocker' |
|
export PATH="$PYENV_ROOT/versions/anaconda3-2019.03/bin/:$PATH" |
|
alias dbpp="docker build --progress=plain" |
|
alias dia="docker images -a" |
|
alias dps="docker ps -a" |
|
|
|
## GCLOUD |
|
CLOUD_SDK_HOME=/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk |
|
source "${CLOUD_SDK_HOME}/completion.zsh.inc" |
|
|
|
|
|
# added by Anaconda3 5.3.0 installer |
|
# >>> conda init >>> |
|
# !! Contents within this block are managed by 'conda init' !! |
|
__conda_setup="$(CONDA_REPORT_ERRORS=false '/anaconda3/bin/conda' shell.bash hook 2> /dev/null)" |
|
if [ $? -eq 0 ]; then |
|
\eval "$__conda_setup" |
|
else |
|
if [ -f "/anaconda3/etc/profile.d/conda.sh" ]; then |
|
# . "/anaconda3/etc/profile.d/conda.sh" # commented out by conda initialize |
|
CONDA_CHANGEPS1=false conda activate base |
|
else |
|
\export PATH="/anaconda3/bin:$PATH" |
|
fi |
|
fi |
|
unset __conda_setup |
|
# <<< conda init <<< |
|
# added by Anaconda3 5.3.0 installer |
|
# >>> conda init >>> |
|
# !! Contents within this block are managed by 'conda init' !! |
|
__conda_setup="$(CONDA_REPORT_ERRORS=false '/Users/haidv/anaconda3/bin/conda' shell.bash hook 2> /dev/null)" |
|
if [ $? -eq 0 ]; then |
|
\eval "$__conda_setup" |
|
else |
|
if [ -f "/Users/haidv/anaconda3/etc/profile.d/conda.sh" ]; then |
|
# . "/Users/haidv/anaconda3/etc/profile.d/conda.sh" # commented out by conda initialize |
|
CONDA_CHANGEPS1=false conda activate base |
|
else |
|
\export PATH="/Users/haidv/anaconda3/bin:$PATH" |
|
fi |
|
fi |
|
unset __conda_setup |
|
# <<< conda init <<< |
|
|
|
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* |
|
|
|
# >>> conda initialize >>> |
|
# !! Contents within this block are managed by 'conda init' !! |
|
__conda_setup="$('/Users/haidv/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)" |
|
if [ $? -eq 0 ]; then |
|
eval "$__conda_setup" |
|
else |
|
if [ -f "/Users/haidv/anaconda3/etc/profile.d/conda.sh" ]; then |
|
. "/Users/haidv/anaconda3/etc/profile.d/conda.sh" |
|
else |
|
export PATH="/Users/haidv/anaconda3/bin:$PATH" |
|
fi |
|
fi |
|
unset __conda_setup |
|
# <<< conda initialize <<< |
|
|
|
export PATH="/usr/local/sbin:$PATH" |
|
export PATH="$HOME/.poetry/bin:$PATH" |
|
|
|
function get_cluster_short() { |
|
echo "$1" | cut -d . -f1 |
|
} |
|
|
|
KUBE_PS1_CLUSTER_FUNCTION=get_cluster_short |
|
|
|
function get_namespace_upper() { |
|
echo "$1" | tr '[:lower:]' '[:upper:]' |
|
} |
|
|
|
export KUBE_PS1_NAMESPACE_FUNCTION=get_namespace_upper |
|
|
|
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH" |
|
|
|
## fzf config with ripgrep to preview file in search panel |
|
|
|
export FZF_BASE="/usr/local/bin" |
|
|
|
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh |
|
export FZF_DEFAULT_OPTS='--height=70% --preview="cat {}" --preview-window=right:60%:wrap' |
|
|
|
#### WELCOME ### |
|
# Cow-spoken fortunes every time you open a terminal |
|
# git clone https://github.com/bkendzior/cowfiles.git ~/.cowsay |
|
function cowsayfortune { |
|
NUMOFCOWS=`cowsay -l | tail -n +2 | wc -w` |
|
WHICHCOW=$((RANDOM%$NUMOFCOWS+1)) |
|
THISCOW=`cowsay -l | tail -n +2 | sed -e 's/\ /\'$'\n/g' | sed $WHICHCOW'q;d'` |
|
|
|
#echo "Selected cow: ${THISCOW}, from ${WHICHCOW}" |
|
fortune | cowsay -f $THISCOW -W 100 | lolcat |
|
} |
|
|
|
cowsayfortune |
|
# fortune | cowsay -f daragon_and_cow | lolcat |
|
################ |
|
## minikue ##### |
|
alias mk="minikube" |