switched to ohmyzsh

This commit is contained in:
opal
2022-09-05 19:19:25 -04:00
parent 1e09598928
commit a8368426c4
4 changed files with 64 additions and 145 deletions

View File

@@ -1,139 +1,57 @@
#### ~~~~ General ~~~~ #####
HISTFILE=$XDG_CONFIG_HOME/zsh/.history
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
#### ~~~~ Path Additions ~~~~ #####
export PATH=/home/opal/scripts:$PATH # Scripts
export PATH=/home/opal/.config/emacs/bin:$PATH # Doom Path
export PATH=/home/opal/.local/bin:$PATH # .local path
export PATH=/home/opal/.local/share/gem/ruby/3.0.0/bin:$PATH # Ruby
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.config/oh-my-zsh"
export PATH=$HOME/.config/emacs/bin:$PATH # Doom Path
export PATH=$HOME/.local/bin:$PATH
export PATH=$HOME/bin:$PATH
#### ~~~~ Locale ~~~~ #####
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="robbyrussell"
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in $ZSH/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment one of the following lines to change the auto-update behavior
zstyle ':omz:update' mode disabled # disable automatic updates
# zstyle ':omz:update' mode auto # update automatically without asking
# zstyle ':omz:update' mode reminder # just remind me to update when it's time
# Uncomment the following line to change how often to auto-update (in days).
# zstyle ':omz:update' frequency 13
# Uncomment the following line if pasting URLs and other text is messed up.
DISABLE_MAGIC_FUNCTIONS="true"
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
plugins=(git)
source $ZSH/oh-my-zsh.sh
#You may need to manually set your language environment
export LANG=en_US.UTF-8
# #### ~~~~ Import ~~~~ #####
ALIAS_LOCATION="$XDG_CONFIG_HOME/zsh/zsh_aliases"
FUNCTION_LOCATION="$XDG_CONFIG_HOME/zsh/zsh_functions"
. $ALIAS_LOCATION
. $FUNCTION_LOCATION
#### ~~~~ Prompt ~~~~ ####
git_prompt_status() {
local INDEX STATUS
INDEX=$(command git status --porcelain -b 2> /dev/null)
STATUS=""
if $(echo "$INDEX" | command grep -E '^\?\? ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS"
fi
if $(echo "$INDEX" | grep '^A ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS"
elif $(echo "$INDEX" | grep '^M ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS"
elif $(echo "$INDEX" | grep '^MM ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS"
fi
if $(echo "$INDEX" | grep '^ M ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
elif $(echo "$INDEX" | grep '^MM ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
elif $(echo "$INDEX" | grep '^ T ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
fi
if $(echo "$INDEX" | grep '^R ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS"
fi
if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
elif $(echo "$INDEX" | grep '^D ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
elif $(echo "$INDEX" | grep '^AD ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
fi
if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then
STATUS="$ZSH_THEME_GIT_PROMPT_STASHED$STATUS"
fi
if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
fi
if $(echo "$INDEX" | grep '^## [^ ]\+ .*ahead' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_AHEAD$STATUS"
fi
if $(echo "$INDEX" | grep '^## [^ ]\+ .*behind' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_BEHIND$STATUS"
fi
if $(echo "$INDEX" | grep '^## [^ ]\+ .*diverged' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_DIVERGED$STATUS"
fi
if [[ ! -z "$STATUS" ]]; then
echo " [ $STATUS]"
fi
}
prompt_git_branch() {
autoload -Uz vcs_info
precmd_vcs_info() { vcs_info }
precmd_functions+=( precmd_vcs_info )
setopt prompt_subst
zstyle ':vcs_info:git:*' formats '%b'
}
prompt_git_info() {
[ ! -z "$vcs_info_msg_0_" ] && echo "$ZSH_THEME_GIT_PROMPT_PREFIX%F{white}$vcs_info_msg_0_%f$ZSH_THEME_GIT_PROMPT_SUFFIX"
}
prompt_purity_precmd() {
# Pass a line before each prompt
print -P ''
}
prompt_purification_setup() {
# Display git branch
autoload -Uz add-zsh-hook
add-zsh-hook precmd prompt_purity_precmd
ZSH_THEME_GIT_PROMPT_PREFIX=" %F{red}λ%f:"
ZSH_THEME_GIT_PROMPT_DIRTY=""
ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_GIT_PROMPT_ADDED="%F{green}+%f "
ZSH_THEME_GIT_PROMPT_MODIFIED="%F{blue}%f "
ZSH_THEME_GIT_PROMPT_DELETED="%F{red}x%f "
ZSH_THEME_GIT_PROMPT_RENAMED="%F{magenta}➜%f "
ZSH_THEME_GIT_PROMPT_UNMERGED="%F{yellow}═%f "
ZSH_THEME_GIT_PROMPT_UNTRACKED="%F{white}%f "
ZSH_THEME_GIT_PROMPT_STASHED="%B%F{red}%f%b "
ZSH_THEME_GIT_PROMPT_BEHIND="%B%F{red}%f%b "
ZSH_THEME_GIT_PROMPT_AHEAD="%B%F{green}%f%b "
prompt_git_branch
RPROMPT='$(prompt_git_info) $(git_prompt_status)'
PROMPT=$'%F{white}%~ %B%F{blue}>%f%b '
}
prompt_purification_setup
source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
#source <(kubectl completion zsh)
export PATH="$PATH:/root/.local/bin"
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word