Last active
April 12, 2021 09:17
-
-
Save kytta/b71b2e2192d087ba4aedd44bbff870ab to your computer and use it in GitHub Desktop.
My ZSH config (includes powerlevel10k)
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
# Temporarily change options. | |
'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 | |
setopt no_unset extended_glob | |
zmodload zsh/langinfo | |
if [[ ${langinfo[CODESET]:-} != (utf|UTF)(-|)8 ]]; then | |
local LC_ALL=${${(@M)$(locale -a):#*.(utf|UTF)(-|)8}[1]:-en_US.UTF-8} | |
fi | |
# Unset all configuration options. | |
unset -m 'POWERLEVEL9K_*' | |
# The list of segments shown on the left. | |
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( | |
user # current user | |
dir # current directory | |
vcs # git status | |
prompt_char # prompt symbol | |
) | |
# The list of segments shown on the right. | |
typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=( | |
status # exit code of the last command | |
command_execution_time # duration of the last command | |
virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html) | |
anaconda # conda environment (https://conda.io/) | |
pyenv # python environment (https://github.com/pyenv/pyenv) | |
nvm # node.js version from nvm (https://github.com/nvm-sh/nvm) | |
context # user@hostname | |
) | |
# Basic style options that define the overall look of your prompt. | |
typeset -g POWERLEVEL9K_BACKGROUND= # transparent background | |
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_{LEFT,RIGHT}_WHITESPACE= # no surrounding whitespace | |
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR=' ' # separate segments with a space | |
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_SEPARATOR= # no end-of-line symbol | |
# To enable default icons for all segments, don't define POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION | |
# or set it to '${P9K_VISUAL_IDENTIFIER}'. | |
typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER}' | |
typeset -g POWERLEVEL9K_MODE=nerdfont-complete | |
# When set to true, icons appear before content on both sides of the prompt. | |
typeset -g POWERLEVEL9K_ICON_BEFORE_CONTENT=true | |
# Don't add an empty line before each prompt. | |
typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=false | |
################################[ prompt_char: prompt symbol ]################################ | |
# Green prompt symbol if the last command succeeded. | |
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=76 | |
# Red prompt symbol if the last command failed. | |
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=196 | |
# Default prompt symbol. | |
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='❯' | |
# Prompt symbol in command vi mode. | |
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION='❮' | |
# Prompt symbol in visual vi mode. | |
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION='Ⅴ' | |
# Prompt symbol in overwrite vi mode. | |
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIOWR_CONTENT_EXPANSION='▶' | |
typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=true | |
typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL='' | |
##################################[ dir: current directory ]################################## | |
typeset -g POWERLEVEL9K_DIR_FOREGROUND=23 | |
# If directory is too long, shorten some of its segments to the shortest | |
# possible unique prefix. | |
typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_unique | |
typeset -g POWERLEVEL9K_SHORTEN_DELIMITER= | |
typeset -g POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=23 | |
typeset -g POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=39 | |
typeset -g POWERLEVEL9K_DIR_ANCHOR_BOLD=true | |
local anchor_files=( | |
.java-version | |
.git | |
.hg | |
.node-version | |
.nvmrc | |
.python-version | |
.ruby-version | |
.shorten_folder_marker | |
.svn | |
.terraform | |
CVS | |
Cargo.toml | |
composer.json | |
go.mod | |
package.json | |
) | |
typeset -g POWERLEVEL9K_SHORTEN_FOLDER_MARKER="(${(j:|:)anchor_files})" | |
# Don't shorten this many last directory segments. They are anchors. | |
typeset -g POWERLEVEL9K_SHORTEN_DIR_LENGTH=1 | |
# Shorten directory if it's longer than this even if there is space for it. | |
typeset -g POWERLEVEL9K_DIR_MAX_LENGTH=15% | |
# When `dir` segment is on the last prompt line, try to shorten it enough to leave at least this | |
# many columns for typing commands. | |
typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS=40 | |
typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT=50 | |
# Enable special styling for non-writable directories. | |
typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=true | |
typeset -g POWERLEVEL9K_DIR_CLASSES=() | |
#####################################[ vcs: git status ]###################################### | |
# Branch icon. Set this parameter to '\uF126 ' for the popular Powerline branch icon. | |
typeset -g POWERLEVEL9K_VCS_BRANCH_ICON='\uF126 ' | |
POWERLEVEL9K_VCS_BRANCH_ICON=${(g::)POWERLEVEL9K_VCS_BRANCH_ICON} | |
# Untracked files icon. | |
typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON='?' | |
POWERLEVEL9K_VCS_UNTRACKED_ICON=${(g::)POWERLEVEL9K_VCS_UNTRACKED_ICON} | |
# Formatter for Git status. | |
# Example output: master ⇣42⇡42 *42 merge ~42 +42 !42 ?42. | |
# | |
# VCS_STATUS_* parameters are set by gitstatus plugin. See reference: | |
# https://github.com/romkatv/gitstatus/blob/master/gitstatus.plugin.zsh. | |
function my_git_formatter() { | |
emulate -L zsh | |
if [[ -n $P9K_CONTENT ]]; then | |
# If P9K_CONTENT is not empty, use it. It's either "loading" or from vcs_info (not from | |
# gitstatus plugin). VCS_STATUS_* parameters are not available in this case. | |
typeset -g my_git_format=$P9K_CONTENT | |
return | |
fi | |
if (( $1 )); then | |
# Styling for up-to-date Git status. | |
local meta='%f' # default foreground | |
local clean='%76F' # green foreground | |
local modified='%178F' # yellow foreground | |
local untracked='%39F' # blue foreground | |
local conflicted='%196F' # red foreground | |
else | |
# Styling for incomplete and stale Git status. | |
local meta='%244F' # grey foreground | |
local clean='%244F' # grey foreground | |
local modified='%244F' # grey foreground | |
local untracked='%244F' # grey foreground | |
local conflicted='%244F' # grey foreground | |
fi | |
local res | |
local where # branch name, tag or commit | |
if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then | |
res+="${clean}${POWERLEVEL9K_VCS_BRANCH_ICON}" | |
where=${(V)VCS_STATUS_LOCAL_BRANCH} | |
elif [[ -n $VCS_STATUS_TAG ]]; then | |
res+="${meta}#" | |
where=${(V)VCS_STATUS_TAG} | |
else | |
res+="${meta}@" | |
where=${VCS_STATUS_COMMIT[1,8]} | |
fi | |
# If local branch name or tag is at most 32 characters long, show it in full. | |
# Otherwise show the first 12 … the last 12. | |
(( $#where > 32 )) && where[13,-13]="…" | |
res+="${clean}${where//\%/%%}" # escape % | |
# Show tracking branch name if it differs from local branch. | |
if [[ -n ${VCS_STATUS_REMOTE_BRANCH:#$VCS_STATUS_LOCAL_BRANCH} ]]; then | |
res+="${meta}:${clean}${(V)VCS_STATUS_REMOTE_BRANCH//\%/%%}" # escape % | |
fi | |
# ⇣42 if behind the remote. | |
(( VCS_STATUS_COMMITS_BEHIND )) && res+=" ${clean}⇣${VCS_STATUS_COMMITS_BEHIND}" | |
# ⇡42 if ahead of the remote; no leading space if also behind the remote: ⇣42⇡42. | |
(( VCS_STATUS_COMMITS_AHEAD && !VCS_STATUS_COMMITS_BEHIND )) && res+=" " | |
(( VCS_STATUS_COMMITS_AHEAD )) && res+="${clean}⇡${VCS_STATUS_COMMITS_AHEAD}" | |
# *42 if have stashes. | |
(( VCS_STATUS_STASHES )) && res+=" ${clean}*${VCS_STATUS_STASHES}" | |
# 'merge' if the repo is in an unusual state. | |
[[ -n $VCS_STATUS_ACTION ]] && res+=" ${conflicted}${VCS_STATUS_ACTION}" | |
# ~42 if have merge conflicts. | |
(( VCS_STATUS_NUM_CONFLICTED )) && res+=" ${conflicted}~${VCS_STATUS_NUM_CONFLICTED}" | |
# +42 if have staged changes. | |
(( VCS_STATUS_NUM_STAGED )) && res+=" ${modified}+${VCS_STATUS_NUM_STAGED}" | |
# !42 if have unstaged changes. | |
(( VCS_STATUS_NUM_UNSTAGED )) && res+=" ${modified}!${VCS_STATUS_NUM_UNSTAGED}" | |
# ?42 if have untracked files. It's really a question mark, your font isn't broken. | |
# See POWERLEVEL9K_VCS_UNTRACKED_ICON above if you want to use a different icon. | |
# Remove the next line if you don't want to see untracked files at all. | |
(( VCS_STATUS_NUM_UNTRACKED )) && res+=" ${untracked}${POWERLEVEL9K_VCS_UNTRACKED_ICON}${VCS_STATUS_NUM_UNTRACKED}" | |
typeset -g my_git_format=$res | |
} | |
functions -M my_git_formatter 2>/dev/null | |
# Disable the default Git status formatting. | |
typeset -g POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true | |
# Install our own Git status formatter. | |
typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${$((my_git_formatter(1)))+${my_git_format}}' | |
typeset -g POWERLEVEL9K_VCS_LOADING_CONTENT_EXPANSION='${$((my_git_formatter(0)))+${my_git_format}}' | |
# Enable counters for staged, unstaged, etc. | |
typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED,CONFLICTED,COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=-1 | |
# Icon color. | |
typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_COLOR=76 | |
typeset -g POWERLEVEL9K_VCS_LOADING_VISUAL_IDENTIFIER_COLOR=244 | |
# Custom icon. | |
typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_EXPANSION= | |
# Custom prefix. | |
# typeset -g POWERLEVEL9K_VCS_PREFIX='%fon ' | |
# Show status of repositories of these types. You can add svn and/or hg if you are | |
# using them. If you do, your prompt may become slow even when your current directory | |
# isn't in an svn or hg reposotiry. | |
typeset -g POWERLEVEL9K_VCS_BACKENDS=(git) | |
# These settings are used for respositories other than Git or when gitstatusd fails and | |
# Powerlevel10k has to fall back to using vcs_info. | |
typeset -g POWERLEVEL9K_VCS_CLEAN_FOREGROUND=76 | |
typeset -g POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND=76 | |
typeset -g POWERLEVEL9K_VCS_MODIFIED_FOREGROUND=178 | |
##########################[ status: exit code of the last command ]########################### | |
# Enable OK_PIPE, ERROR_PIPE and ERROR_SIGNAL status states to allow us to enable, disable and | |
# style them independently from the regular OK and ERROR state. | |
typeset -g POWERLEVEL9K_STATUS_EXTENDED_STATES=true | |
# Status on success. | |
typeset -g POWERLEVEL9K_STATUS_OK=false | |
# Status when it's just an error code (e.g., '1'). | |
typeset -g POWERLEVEL9K_STATUS_ERROR=false | |
# Status when some part of a pipe command fails but the overall exit status is zero. It may look | |
# like this: 1|0. | |
typeset -g POWERLEVEL9K_STATUS_OK_PIPE=true | |
typeset -g POWERLEVEL9K_STATUS_OK_PIPE_FOREGROUND=70 | |
typeset -g POWERLEVEL9K_STATUS_OK_PIPE_VISUAL_IDENTIFIER_EXPANSION='✔' | |
# Status when the last command was terminated by a signal. | |
typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL=true | |
typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_FOREGROUND=160 | |
# Use terse signal names: "INT" instead of "SIGINT(2)". | |
typeset -g POWERLEVEL9K_STATUS_VERBOSE_SIGNAME=false | |
typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_VISUAL_IDENTIFIER_EXPANSION='↵' | |
# Status when some part of a pipe command fails and the overall exit status is also non-zero. | |
# It may look like this: 1|0. | |
typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE=true | |
typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_FOREGROUND=160 | |
typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_VISUAL_IDENTIFIER_EXPANSION='↵' | |
###################[ command_execution_time: duration of the last command ]################### | |
# Show duration of the last command if takes longer than this many seconds. | |
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3 | |
# Show this many fractional digits. Zero means round to seconds. | |
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0 | |
# Execution time color. | |
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=240 | |
# Duration format: 1d 2h 3m 4s. | |
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s' | |
# Custom icon. | |
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_VISUAL_IDENTIFIER_EXPANSION= | |
##################################[ context: user@hostname ]################################## | |
# Default context color. | |
typeset -g POWERLEVEL9K_CONTEXT_FOREGROUND=180 | |
# Default context format: %n is username, %m is hostname. | |
typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE='%n@%m' | |
# Context color when running with privileges. | |
typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=178 | |
# Context format when running with privileges: bold user@hostname. | |
typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE='%B%n@%m' | |
# Don't show context unless running with privileges or in SSH. | |
typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_{CONTENT,VISUAL_IDENTIFIER}_EXPANSION= | |
# Custom icon. | |
# typeset -g POWERLEVEL9K_CONTEXT_VISUAL_IDENTIFIER_EXPANSION='⭐' | |
# Custom prefix. | |
# typeset -g POWERLEVEL9K_CONTEXT_PREFIX='%fwith ' | |
###[ virtualenv: python virtual environment (https://docs.python.org/3/library/venv.html) ]### | |
# Python virtual environment color. | |
typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=226 | |
# Don't show Python version next to the virtual environment name. | |
typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false | |
# Separate environment name from Python version only with a space. | |
typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER= | |
# Custom icon. | |
# typeset -g POWERLEVEL9K_VIRTUALENV_VISUAL_IDENTIFIER_EXPANSION='⭐' | |
#####################[ anaconda: conda environment (https://conda.io/) ]###################### | |
# Anaconda environment color. | |
typeset -g POWERLEVEL9K_ANACONDA_FOREGROUND=226 | |
# Don't show Python version next to the anaconda environment name. | |
typeset -g POWERLEVEL9K_ANACONDA_SHOW_PYTHON_VERSION=false | |
# Separate environment name from Python version only with a space. | |
typeset -g POWERLEVEL9K_ANACONDA_{LEFT,RIGHT}_DELIMITER= | |
# Custom icon. | |
# typeset -g POWERLEVEL9K_ANACONDA_VISUAL_IDENTIFIER_EXPANSION='⭐' | |
################[ pyenv: python environment (https://github.com/pyenv/pyenv) ]################ | |
# Pyenv color. | |
typeset -g POWERLEVEL9K_PYENV_FOREGROUND=226 | |
# Don't show the current Python version if it's the same as global. | |
typeset -g POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW=false | |
# Custom icon. | |
# typeset -g POWERLEVEL9K_PYENV_VISUAL_IDENTIFIER_EXPANSION='⭐' | |
##########[ nodenv: node.js version from nodenv (https://github.com/nodenv/nodenv) ]########## | |
# Nodenv color. | |
typeset -g POWERLEVEL9K_NODENV_FOREGROUND=70 | |
# Don't show node version if it's the same as global: $(nodenv version-name) == $(nodenv global). | |
typeset -g POWERLEVEL9K_NODENV_PROMPT_ALWAYS_SHOW=false | |
# Custom icon. | |
# typeset -g POWERLEVEL9K_NODENV_VISUAL_IDENTIFIER_EXPANSION='⭐' | |
##############[ nvm: node.js version from nvm (https://github.com/nvm-sh/nvm) ]############### | |
# Nvm color. | |
typeset -g POWERLEVEL9K_NVM_FOREGROUND=70 | |
# Custom icon. | |
# typeset -g POWERLEVEL9K_NVM_VISUAL_IDENTIFIER_EXPANSION='⭐' | |
############[ nodeenv: node.js environment (https://github.com/ekalinin/nodeenv) ]############ | |
# Nodeenv color. | |
typeset -g POWERLEVEL9K_NODEENV_FOREGROUND=70 | |
# Don't show Node version next to the environment name. | |
typeset -g POWERLEVEL9K_NODEENV_SHOW_NODE_VERSION=false | |
# Separate environment name from Node version only with a space. | |
typeset -g POWERLEVEL9K_NODEENV_{LEFT,RIGHT}_DELIMITER= | |
# Custom icon. | |
# typeset -g POWERLEVEL9K_NODEENV_VISUAL_IDENTIFIER_EXPANSION='⭐' | |
##############################[ node_version: node.js version ]############################### | |
# Node version color. | |
typeset -g POWERLEVEL9K_NODE_VERSION_FOREGROUND=70 | |
# Show node version only when in a directory tree containing package.json. | |
typeset -g POWERLEVEL9K_NODE_VERSION_PROJECT_ONLY=true | |
# Custom icon. | |
# typeset -g POWERLEVEL9K_NODE_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' | |
# Transient prompt trims down prompt when accepting a command line. | |
typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=off | |
# Instant prompt mode. | |
typeset -g POWERLEVEL9K_INSTANT_PROMPT=off | |
# Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized. | |
typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true | |
} | |
(( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]} | |
'builtin' 'unset' 'p10k_config_opts' |
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
### oh-my-zsh ### | |
export ZSH="/Users/nick/.oh-my-zsh" # install path | |
export UPDATE_ZSH_DAYS=14 # autoupdate | |
DEFAULT_USER="nick" | |
ENABLE_CORRECTION="true" | |
HIST_STAMPS="dd.mm.yyyy" # history output format | |
plugins=( | |
docker git git-flow sudo wakatime wd | |
) | |
### Theme ### | |
source $ZSH/oh-my-zsh.sh | |
source ~/.powerlevel10k/powerlevel10k.zsh-theme | |
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh | |
export EDITOR='nano' # preferred editor | |
alias -g sudoedit='sudo $EDITOR' # sudoedit (for sudo plugin) | |
### Completion ### | |
autoload -U compinit promptinit | |
compinit | |
promptinit | |
zstyle ':completion:*' menu select=long-list select=0 | |
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} | |
### Error correction ### | |
setopt CORRECT_ALL | |
SPROMPT="Did you mean %r instead of %R? ([Y]es/[N]o/[E]dit/[A]bort) " | |
setopt autocd | |
# History | |
export HISTFILE=~/.zsh_history | |
export HISTSIZE=10000 | |
export SAVEHIST=$HISTSIZE | |
setopt APPEND_HISTORY | |
setopt HIST_IGNORE_ALL_DUPS | |
setopt HIST_IGNORE_SPACE | |
setopt HIST_REDUCE_BLANKS | |
### Aliases ### | |
alias -g dps='docker ps --format "table {{.ID}}\t{{.Image}}\t{{.Status}}\t{{.Names}}"' | |
alias -g o='open' | |
alias -g ow='open -a' | |
alias -g doco='docker-compose' | |
alias -g doc='docker' | |
# gitignore | |
function gi() { curl -L -s https://www.gitignore.io/api/$@ ;} | |
# docker ps with live update | |
function dpsl() { | |
clear; | |
while true | |
do | |
docker ps --format "table {{.ID}}\t{{.Image}}\t{{.Status}}\t{{.Names}}"; | |
sleep 10; | |
clear; | |
done | |
} | |
export ANDROID_HOME="/Users/nick/dev/android-sdk" | |
export GOPATH="/Users/nick/go" | |
export PATH="$PATH:$GOPATH/bin" | |
export PATH="$HOME/.poetry/bin:$PATH" | |
export PATH="/usr/local/opt/ruby/bin:$PATH" | |
export PATH="/usr/local/lib/ruby/gems/2.6.0/bin:$PATH" | |
export PATH="/usr/local/opt/gnu-getopt/bin:$PATH" | |
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES # fixes python multiprocessing | |
### pyenv ### | |
eval "$(pyenv init - zsh)" | |
### nvm ### | |
declare -a NODE_GLOBALS=(`find ~/.nvm/versions/node -maxdepth 3 -type l -wholename '*/bin/*' | xargs -n1 basename | sort | uniq`) | |
NODE_GLOBALS+=("node") | |
NODE_GLOBALS+=("nvm") | |
NODE_GLOBALS+=("pnpm") | |
NODE_GLOBALS+=("pnpx") | |
load_nvm () { | |
export NVM_DIR=~/.nvm | |
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" | |
} | |
for cmd in "${NODE_GLOBALS[@]}"; do | |
eval "${cmd}(){ unset -f ${NODE_GLOBALS}; load_nvm; ${cmd} \$@ }" | |
done | |
### jenv ### | |
export PATH="$HOME/.jenv/bin:$PATH" | |
eval "$(jenv init -)" | |
function docker_deep_clean() { | |
echo "Removing exited containers..." | |
echo "=============================" | |
docker ps --filter status=dead --filter status=exited -aq | xargs docker rm -v | |
echo "" | |
echo "Removing unused images..." | |
echo "=========================" | |
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs docker rmi | |
echo "" | |
echo "Removing unused volumes..." | |
echo "==========================" | |
docker volume ls -qf dangling=true | xargs docker volume rm | |
echo "" | |
echo "Done." | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment