Created
July 18, 2023 07:03
-
-
Save jperocho/d7bd9ba3c5e62a1e9b9ce7cc28ad2228 to your computer and use it in GitHub Desktop.
My .zshrc config V2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Colors | |
autoload -Uz colors | |
colors | |
export TERM="xterm-256color" | |
# History | |
HISTFILE=~/.zsh_history | |
HISTSIZE=10000 | |
SAVEHIST=10000 | |
setopt INC_APPEND_HISTORY_TIME | |
export PATH=/opt/rocm/bin:$PATH | |
# Pyenv | |
export PYENV_ROOT="$HOME/.pyenv" | |
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" | |
eval "$(pyenv init -)" | |
#export PATH="/home/bhong/.pyenv/versions/3.11.3/bin:$PATH" | |
# Alias | |
alias ..="cd .." | |
alias ...="cd ../.." | |
alias ls="ls --color=auto" | |
alias l="ls -lah --color=auto" | |
# Git alias | |
alias gst="git status" | |
alias ga="git add" | |
alias gl="git pull" | |
alias gp="git push" | |
alias gcam="git commit -am" | |
alias gcmsg="git commit -m" | |
alias gco="git checkout" | |
# Prompt | |
autoload -Uz promptinit | |
promptinit | |
# Format the vcs_info_msg_0_ variable for git branch | |
autoload -Uz vcs_info | |
precmd() { vcs_info } | |
zstyle ':vcs_info:git:*' formats '%b' | |
# Custom Prompt | |
setopt prompt_subst | |
PROMPT_CHAR=$'\n%(!.#.$) ' | |
CWD=$'%F{cyan}%(4~|%1~|%~)%f' | |
PS1='$CWD %F{red}${vcs_info_msg_0_}%f $(aws_profile)$PROMPT_CHAR' | |
# Date date and time Format | |
RPROMPT='[ %B%F{cyan}%D{%I:%M:%S %p}%b%f ]' | |
# AWS Profile Prompt | |
function aws_profile { | |
if [[ $AWS_PROFILE ]]; then | |
echo "%F{yellow}AWS: $AWS_PROFILE%f " | |
fi | |
} | |
# Node Version Manager | |
export NVM_DIR="$HOME/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion | |
# load nvmrc | |
autoload -U add-zsh-hook | |
load-nvmrc() { | |
local node_version="$(nvm version)" | |
local nvmrc_path="$(nvm_find_nvmrc)" | |
if [ -n "$nvmrc_path" ]; then | |
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")") | |
if [ "$nvmrc_node_version" = "N/A" ]; then | |
nvm install | |
elif [ "$nvmrc_node_version" != "$node_version" ]; then | |
nvm use | |
fi | |
elif [ "$node_version" != "$(nvm version default)" ]; then | |
echo "Reverting to nvm default version" | |
nvm use default | |
fi | |
} | |
add-zsh-hook chpwd load-nvmrc | |
load-nvmrc | |
# Zsh Auto Suggestions | |
. ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment