Skip to content

Instantly share code, notes, and snippets.

@quanglochuynh
Created December 6, 2024 15:21
Show Gist options
  • Save quanglochuynh/2093ca13a2abdc1f5afd54cda8ea53c3 to your computer and use it in GitHub Desktop.
Save quanglochuynh/2093ca13a2abdc1f5afd54cda8ea53c3 to your computer and use it in GitHub Desktop.
Powerlevel10k config
# Generated by Powerlevel10k configuration wizard
'builtin' 'local' '-a' 'p10k_config_opts'
[[ ! -o 'aliases' ]] || p10k_config_opts+=('aliases')
[[ ! -o 'sh_glob' ]] || p10k_config_opts+=('sh_glob')
[[ ! -o 'no_brace_expand' ]] || p10k_config_opts+=('no_brace_expand')
'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand'
() {
emulate -L zsh -o extended_glob
# Rainbow theme colors
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
dir # current directory
vcs # git status
newline # \n
prompt_char # prompt symbol
)
typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
status # exit code of the last command
command_execution_time # duration of the last command
background_jobs # presence of background jobs
direnv # direnv status
virtualenv # python virtual environment
nodeenv # node.js environment
kubecontext # current kubernetes context
terraform # terraform workspace
time # current time
)
# Shorten directory to only show the current directory
typeset -g POWERLEVEL9K_DIR_SHORTENED_DIR_MAX_LENGTH=1
# Rainbow colors for different segments
typeset -g POWERLEVEL9K_DIR_FOREGROUND=039 # Light blue
typeset -g POWERLEVEL9K_VCS_FOREGROUND=213 # Pink
typeset -g POWERLEVEL9K_STATUS_OK_FOREGROUND=084 # Light green
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_FOREGROUND=226 # Yellow
# Enable rainbow prompt
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND=240
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX=''
typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX=''
typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX=''
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_SUFFIX=''
typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_SUFFIX=''
typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_SUFFIX=''
# VCS settings
typeset -g POWERLEVEL9K_VCS_CLEAN_FOREGROUND=076
typeset -g POWERLEVEL9K_VCS_MODIFIED_FOREGROUND=227
typeset -g POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND=214
typeset -g POWERLEVEL9K_VCS_CONFLICTED_FOREGROUND=196
# Directory settings
typeset -g POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=039
typeset -g POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=039
typeset -g POWERLEVEL9K_DIR_ANCHOR_BOLD=true
# Prompt character
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=076
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=196
# Command execution time
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=101
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=2
# Status
typeset -g POWERLEVEL9K_STATUS_OK=true
typeset -g POWERLEVEL9K_STATUS_OK_FOREGROUND=076
typeset -g POWERLEVEL9K_STATUS_ERROR_FOREGROUND=196
# Enable transient prompt
typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=always
# Instant prompt mode
typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet
typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_last
typeset -g POWERLEVEL9K_SHORTEN_DIR_LENGTH=1
# Hot reload
(( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]}
'builtin' 'unset' 'p10k_config_opts'
}
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# Path to oh-my-zsh installation
export ZSH="$HOME/.oh-my-zsh"
# Set theme to powerlevel10k
ZSH_THEME="powerlevel10k/powerlevel10k"
# Plugins
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
docker
docker-compose
kubectl
npm
yarn
node
history
colored-man-pages
command-not-found
)
source $ZSH/oh-my-zsh.sh
# User configuration
export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='vim'
else
export EDITOR='nvim'
fi
# Aliases
alias zshconfig="nvim ~/.zshrc"
alias p10kconfig="nvim ~/.p10k.zsh"
alias ls="ls --color=auto"
alias ll="ls -la"
alias la="ls -A"
alias l="ls -CF"
alias ..="cd .."
alias ...="cd ../.."
alias grep="grep --color=auto"
# History configuration
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.zsh_history
setopt SHARE_HISTORY
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_IGNORE_SPACE
# Load powerlevel10k configuration
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
export PATH="/usr/local/git/bin:$PATH"
export PATH="/usr/local/opt/brew/bin:$PATH"
export PATH="/opt/homebrew/bin:$PATH"
export PATH="/opt/homebrew/opt/node@18/bin:$PATH"
export PATH="/opt/homebrew/opt/node@18/bin:$PATH"
export JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/platform-tools
export NVM_DIR="$HOME/.nvm"
. "$(brew --prefix nvm)/nvm.sh"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment