#ZSH-CONFIG

#Configuration of ZSH by: pr073c70r
#Version: 1.3
#Last Update: 03.10.2021
#Info: Runs on Openrc
#Dependency: zsh-syntax-highlighting, zsh-autosuggestions

# PS1='%B%F{ebdbb2}[%f%F{#cc241d}%n%f%F{ebdbb2}@%f%F{#689d6a}%m%f%F{ebdbb2}]%f%b %B%F{ebdbb2}[%F{#fabd2f}%~%f%b%B%F{ebdbb2}]%b %B%F{#fabd2f}${vcs_info_msg_0_}%f%b'$'\n''%B%F{#8ec07c}>%f%b '
PS1='╭%F{#7daea3} ﱮ %f %F{#7daea3}%~%f  ${vcs_info_msg_0_}'$'\n''╰%B%F{#a9b665}%f%b '

zstyle ':completion:*' completer _complete _ignored _approximate
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' menu select=long-list select=0
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' use-compctl true
zstyle :compinstall filename '/home/pr073c70r/.zshrc'
zmodload zsh/complist
autoload -Uz compinit
compinit
_comp_options+=(globdots)

HISTSIZE=10000000
SAVEHIST=10000000
HISTFILE=$XDG_DATA_HOME/histfile
setopt nomatch notify
unsetopt beep
setopt autocd
stty stop undef

bindkey -v

[ -f "$XINITRC" ] && alias startx="startx $XINITRC"

[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc"


# Configs for Git in Prompt
# autoload zsh add-zsh-hook and vcs_info functions (-U autoload w/o substition, -z use zsh style)
autoload -Uz add-zsh-hook vcs_info

# # Enable substitution in the prompt.
setopt prompt_subst

# Run vcs_info just before a prompt is displayed (precmd)
add-zsh-hook precmd vcs_info

# Enable checking for (un)staged changes, enabling use of %u and %c
zstyle ':vcs_info:*' check-for-changes true

# Set custom strings for an unstaged vcs repo changes (*) and staged changes (+)
zstyle ':vcs_info:*' unstagedstr ' +'
zstyle ':vcs_info:*' stagedstr ' *'

# Set the format of the Git information for vcs_info
zstyle ':vcs_info:git:*' formats       '%B%F{#fabd2f}%f%%b %F{#fabd2f}%B%b%f%%b%B%F{#ea6962}%u%c%%b%f'
zstyle ':vcs_info:git:*' actionformats '%B%F{#fabd2f}%f%%b %F{#fabd2f}%B%b%f%%b %F{#a9b665}(%a)%f%B%F{#ea6962}%u%c%%b%f'


#TERMINALCLOCK
#Refresh the Terminalprompt to show running clock
#TMOUT=1
#
#TRAPALRM() {
#	zle reset-prompt
#}

# use the vi keys to navigate the menu completion
bindkey -M menuselect 'h' vi-backward-char
bindkey -M menuselect 'k' vi-up-line-or-history
bindkey -M menuselect 'l' vi-forward-char
bindkey -M menuselect 'j' vi-down-line-or-history

local OS=$(grep -w "ID=..*" < /etc/os-release | sed 's/ID=//')
if [ $OS = "artix" ] || [ $OS = "arch" ]; then
    source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
    source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
else
    source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
    source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
fi

