source "${ZDOTDIR:-$HOME}/.dotfiles/zsh/functions/short-uptime.zsh"
source "${ZDOTDIR:-$HOME}/.dotfiles/zsh/functions/figlet-sample.zsh"
source "${ZDOTDIR:-$HOME}/.dotfiles/zsh/functions/prettify-json.zsh"
+source "${ZDOTDIR:-$HOME}/.dotfiles/zsh/functions/status.zsh"
################################################################################
# Load Modules
# ENV VARIABLES
################################################################################
# Terminal related
-export TERM=xterm-256color-italic
+export TERM=xterm-256color
# Paths
# export JAVA_HOME=$(/usr/libexec/java_home) # Enable if using JDK, otherwise disable for performance
export XDG_CONFIG_HOME=$HOME/.config
-export GOPATH=$HOME/Projects/go
+export GOPATH=$HOME/projects/go
export ANDROID_HOME=$HOME/Library/Android/sdk
export ANDROID_NDK_HOME=$HOME/Library/Android/sdk/ndk-bundle
-export NVM_DIR=$HOME/.nvm
export PATH=$PATH:$HOME:${GOPATH//://bin:}/bin
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_NDK_HOME:/Applications/calibre.app/Contents/MacOS
-# Python related variables
-export VIRTUAL_ENV_DISABLE_PROMPT=1
-export WORKON_HOME=$HOME/.virtualenvs
-export PROJECT_HOME=$HOME/Documents/projects
-
# GPG
export GPG_TTY=$(tty)
export FZF_DEFAULT_COMMAND='/usr/bin/env rg --color never --files --hidden -g \!.git'
export FZF_DEFAULT_OPTS='--preview ''bat --style=numbers --color=always {} | head -500'''
-if [[ -s "/opt/homebrew/bin/brew" ]]; then
- export FZF_VIM_PATH=/opt/homebrew/opt/fzf
-else
- if [[ -s "/usr/local/bin/brew" ]]; then
- export FZF_VIM_PATH=/usr/local/opt/fzf
- else
- export FZF_VIM_PATH=/usr/share/doc/fzf/examples
- fi
-fi
################################################################################
# SECRET ENV VARS!!
fi
if [[ -s "/opt/homebrew/bin/brew" ]]; then
+ # Brew Setup
export PATH=/opt/homebrew/bin:/opt/homebrew/sbin:$PATH
-fi
-
-# Z
-if [[ -s "/opt/homebrew/bin/brew" ]]; then
+ export FZF_VIM_PATH=/opt/homebrew/opt/fzf
. /opt/homebrew/etc/profile.d/z.sh
+ . /opt/homebrew/opt/asdf/libexec/asdf.sh
else
+ # FZF Vim (Linux)
+ if [[ -s "/usr/local/bin/brew" ]]; then
+ export FZF_VIM_PATH=/usr/local/opt/fzf
+ else
+ export FZF_VIM_PATH=/usr/share/doc/fzf/examples
+ fi
+
+ # Z (Linux)
if [[ -s "/usr/libexec/z.sh" ]]; then
. /usr/libexec/z.sh
else
. /usr/local/etc/profile.d/z.sh
fi
fi
-fi
-# ASDF
-if ! command -v brew &> /dev/null; then
+ # ASDF (Linux)
if [[ -s "/opt/asdf-vm/asdf.sh" ]]; then
. /opt/asdf-vm/asdf.sh
else
. $HOME/.asdf/asdf.sh
fi
-else
- . $(brew --prefix asdf)/libexec/asdf.sh
fi
+# ASDF Java
if [[ -s "~/.asdf/plugins/java/set-java-home.zsh" ]]; then
. ~/.asdf/plugins/java/set-java-home.zsh
fi
--- /dev/null
+function tool_versions() {
+ if [[ -s ".tool-versions" ]]; then
+ echo '.tool-versions'
+ return
+ fi
+ echo "${HOME}/.tool-versions"
+}
+
+function env_info_provider() { echo "%{%F{green}%}n/a"; }
+function env_info {
+ echo "[%{%F{cyan}%}ENV%{%F{black}%} $(env_info_provider)%{%F{black}%}]"
+}
+
+function python_info {
+ pythoninfo=`cat "$(tool_versions)" | rg python | cut -d ' ' -f 2`
+ pythoninfo=${ASDF_PYTHON_VERSION:-$pythoninfo}
+ venv="${VIRTUAL_ENV##*/}"
+ echo "%{%F{green}%}py%{%F{black}%} ${pythoninfo:-no}@${venv:-default}"
+}
+
+function rust_info {
+ rustinfo=`cat "$(tool_versions)" | rg rust | cut -d ' ' -f 2`
+ rustinfo=${ASDF_RUST_VERSION:-$rustinfo}
+ echo "%{%F{red}%}rs%{%F{black}%} ${rustinfo:-no}"
+}
+
+function node_info {
+ nodeinfo=`cat "$(tool_versions)" | rg nodejs | cut -d ' ' -f 2`
+ nodeinfo=${ASDF_NODEJS_VERSION:-$nodeinfo}
+ echo "%{%F{yellow}%}js%{%F{black}%} ${nodeinfo:-no}"
+}
+
+function git_info {
+ branch=$(git branch --show-current 2> /dev/null)
+
+ if [ ! -z $branch ]; then
+ echo -n "@%F{cyan}$branch%f"
+
+ status_output=$(git status --short)
+
+ if echo "$status_output" | rg -q '^??'; then
+ echo -n "%{%F{magenta}%}?%f"
+ fi
+
+ if echo "$status_output" | rg -q '^ M'; then
+ echo -n "%{%F{magenta}%}!%f"
+ fi
+
+ if echo "$status_output" | rg -q '^ D'; then
+ echo -n "%{%F{magenta}%}×%f"
+ fi
+
+ if echo "$status_output" | rg -q '^A '; then
+ echo -n "%{%F{green}%}+%f"
+ fi
+ fi
+}
+
+function status {
+ echo '%{%F{black}%}$(env_info) $(node_info) $(rust_info) $(python_info)'
+}
alias gm='git merge'
alias gp='git push'
-# Graphicsmagick override
-if command -v brew &> /dev/null; then
- alias grm="$(brew --prefix)/bin/gm"
-fi
-
# JS friendly tree
alias arbol="tree -I 'node_modules|bower_components|doc|__pycache__|\.pyc'"
-
-# Load Script Version Managers because they slow
-alias enable-nvm='source $(brew --prefix nvm)/nvm.sh'
-alias workon="echo 'DISABLED: run enable-virtualenvwrapper to enable'"
-alias enable-virtualenvwrapper="unalias workon; source /usr/local/bin/virtualenvwrapper.sh"
-alias enable-rvm="source $HOME/.rvm/scripts/rvm"
-alias t="things.sh"
autoload -Uz promptinit && promptinit
-function tool_versions() {
- if [[ -s ".tool-versions" ]]; then
- echo '.tool-versions'
- return
- fi
- echo "${HOME}/.tool-versions"
-}
-
if [[ "$TERM" == (dumb|linux|*bsd*) ]] || (( $#prompt_argv < 1 )); then
prompt 'off'
fi
-#
-# Functions
-#
-
-function env_info_provider() { echo "%{%F{green}%}n/a"; }
-function env_info {
- echo "[%{%F{cyan}%}ENV%{%F{black}%} $(env_info_provider)%{%F{black}%}]"
-}
-
-function python_info {
- pythoninfo=`cat "$(tool_versions)" | rg python | cut -d ' ' -f 2`
- pythoninfo=${ASDF_PYTHON_VERSION:-$pythoninfo}
- venv="${VIRTUAL_ENV##*/}"
- echo "%{%F{green}%}py%{%F{black}%} ${pythoninfo:-no}@${venv:-default}"
-}
-
-function rust_info {
- rustinfo=`cat "$(tool_versions)" | rg rust | cut -d ' ' -f 2`
- rustinfo=${ASDF_RUST_VERSION:-$rustinfo}
- echo "%{%F{red}%}rs%{%F{black}%} ${rustinfo:-no}"
-}
-
-function node_info {
- nodeinfo=`cat "$(tool_versions)" | rg nodejs | cut -d ' ' -f 2`
- nodeinfo=${ASDF_NODEJS_VERSION:-$nodeinfo}
- echo "%{%F{yellow}%}js%{%F{black}%} ${nodeinfo:-no}"
-}
-
-function git_info {
- branch=$(git branch --show-current 2> /dev/null)
-
- if [ ! -z $branch ]; then
- echo -n "@%F{cyan}$branch%f"
-
- status_output=$(git status --short)
-
- if echo "$status_output" | grep -q '^??'; then
- echo -n "%{%F{magenta}%}?%f"
- fi
-
- if echo "$status_output" | grep -q '^ M'; then
- echo -n "%{%F{magenta}%}!%f"
- fi
-
- if echo "$status_output" | grep -q '^ D'; then
- echo -n "%{%F{magenta}%}×%f"
- fi
-
- if echo "$status_output" | grep -q '^A '; then
- echo -n "%{%F{green}%}+%f"
- fi
- fi
-}
-
-function box_name {
- [ -f ~/.box-name ] && cat ~/.box-name || hostname -s
-}
-
#
# ZLE widgets
#
# Define prompts.
PROMPT='
%{%F{black}%}$(env_info) $(node_info) $(rust_info) $(python_info)
-%{%F{magenta}%}%n%{%f%}@%{%F{yellow}%}$(box_name)%{%f%} %{%B%F{green}%}${PWD/#$HOME/~}%{%f%b%}$(git_info)%{%f%}
+%{%F{magenta}%}%n%{%f%}@%{%F{yellow}%}$(hostname -s)%{%f%} %{%B%F{green}%}${PWD/#$HOME/~}%{%f%b%}$(git_info)%{%f%}
%(?,,%{${%B%F{white}%}[%?]%{%f%b%} )%% '
}