Last active
March 28, 2023 18:05
-
-
Save donaldG21/734a54895962e136e4146b0b3bf3a274 to your computer and use it in GitHub Desktop.
My powerlevel10k zsh profile
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
# 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 your oh-my-zsh installation. | |
export ZSH="$HOME/.oh-my-zsh" | |
ZSH_THEME="powerlevel10k/powerlevel10k" | |
zmodload -i zsh/complist | |
autoload -U compinit && compinit | |
# zsh History | |
setopt HIST_EXPIRE_DUPS_FIRST | |
setopt HIST_IGNORE_DUPS | |
setopt HIST_IGNORE_ALL_DUPS | |
setopt HIST_IGNORE_SPACE | |
setopt HIST_FIND_NO_DUPS | |
setopt HIST_SAVE_NO_DUPS | |
# FZF CONFIGS | |
export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --border' | |
plugins=( | |
docker | |
docker-compose | |
fzf | |
fzf-tab | |
git | |
history | |
kubectl | |
z | |
zsh-autocomplete | |
zsh-autosuggestions | |
F-Sy-H | |
) | |
source $ZSH/oh-my-zsh.sh | |
source <(kubectl completion zsh) | |
# Powerlevel10k CONFIGS | |
# Compilation flags | |
# export ARCHFLAGS="-arch x86_64" | |
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. | |
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh | |
typeset -g POWERLEVEL9K_DIR_CLASSES=( | |
'~/Dev(|/*)' DEV ' ' | |
'~' HOME ' ' | |
'*' DEFAULT ' ' | |
) | |
################################################################ | |
# Segment to display chruby information | |
# see https://github.com/postmodern/chruby/issues/245 for chruby_auto issue with ZSH | |
prompt_chruby() { | |
local v=${(M)RUBY_ENGINE:#$~_POWERLEVEL9K_CHRUBY_SHOW_ENGINE_PATTERN} | |
[[ $_POWERLEVEL9K_CHRUBY_SHOW_VERSION == 1 && -n $RUBY_VERSION ]] && v+=${v:+ }$RUBY_VERSION | |
_p9k_prompt_segment "$0" "red" "red" 'RUBY_ICON' 0 '' "${v//\%/%%}" | |
} | |
_p9k_prompt_chruby_init() { | |
typeset -g "_p9k__segment_cond_${_p9k__prompt_side}[_p9k__segment_index]"='$RUBY_ENGINE' | |
} | |
_p9k_declare -b POWERLEVEL9K_CHRUBY_SHOW_VERSION 1 | |
_p9k_declare -b POWERLEVEL9K_CHRUBY_SHOW_ENGINE 1 | |
_p9k_declare -s POWERLEVEL9K_CHRUBY_SHOW_ENGINE_PATTERN | |
if (( _POWERLEVEL9K_CHRUBY_SHOW_ENGINE )); then | |
: ${_POWERLEVEL9K_CHRUBY_SHOW_ENGINE_PATTERN=*} | |
fi | |
# Dir Settings | |
typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v3 | |
typeset -g POWERLEVEL9K_LOCK_ICON='' | |
# Time Settings | |
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3 | |
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=1 | |
# VCS Settings | |
typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_EXPANSION='' | |
typeset -g POWERLEVEL9K_VCS_PREFIX='%fon ' | |
typeset -g POWERLEVEL9K_VCS_BRANCH_ICON=' ' | |
typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON=' ' | |
# Node version Settings | |
typeset -g POWERLEVEL9K_NODE_VERSION_VISUAL_IDENTIFIER_EXPANSION='' | |
typeset -g POWERLEVEL9K_NODE_VERSION_PROJECT_ONLY=false | |
# Prompt Settings | |
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( | |
dir # current directory | |
vcs # git status | |
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 | |
node_version # node.js version | |
chruby # ruby version | |
time # current time | |
) | |
# Set personal aliases, overriding those provided by oh-my-zsh libs, | |
# plugins, and themes. Aliases can be placed here, though oh-my-zsh | |
# users are encouraged to define aliases within the ZSH_CUSTOM folder. | |
# For a full list of active aliases, run `alias`. | |
# Aliases | |
if [ -x "$(command -v colorls)" ]; then | |
alias ls="colorls --sd" | |
alias la="colorls --sd -al" | |
fi | |
if [ -x "$(command -v bat)" ]; then | |
alias cat="bat" | |
fi | |
alias get-ports="netstat -tulnp | grep LISTEN" | |
alias get-router="ip route | grep default" | |
alias get-ip="hostname -I" | |
# if [ -x "$(command -v pnpm)" ]; then | |
# alias npm="pnpm" | |
# fi | |
# PATH management | |
# If you come from bash you might have to change your $PATH. | |
# export PATH=$HOME/bin:/usr/local/bin:$PATH | |
export ZSH_COMPDUMP=$ZSH/cache/.zcompdump-$HOST | |
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 | |
# pnpm | |
# export PNPM_HOME="/Users/donald/Library/pnpm" | |
# export PATH="$PNPM_HOME:$PATH" | |
# pnpm endsource /usr/local/share/zsh/site-functions/_aws | |
export PATH="/opt/homebrew/opt/libpq/bin:$PATH" | |
# Ruby manager | |
source /opt/homebrew/opt/chruby/share/chruby/chruby.sh | |
# source /opt/homebrew/opt/chruby/share/chruby/auto.sh | |
chruby ruby-3.1.3 | |
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's a preview of my shell terminal: