# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
bindkey -v
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/r0r5chach/.zshrc'

autoload -Uz compinit
compinit
# End of lines added by compinstall

# Aliases
alias ls='ls --color=auto'
alias grep='grep --color=auto'

# Prompt Config
SUCCESS="%F{blue}ʘ‿ʘ%f" # What to display upon Command success
FAIL="%F{red}⊙︿⊙%f" # What to display upon Command failure

preexec() {
	    preexec_called=1
}

precmd() { # Generates command success output for next prompt
	if [ "$?" != 0 ] && [ "$preexec_called" = 1 ]; then 
		COMMAND_SUCCESS=$FAIL; unset preexec_called;
	else 
		COMMAND_SUCCESS=$SUCCESS; unset preexec_called;	
	fi
}

setopt PROMPT_SUBST # Allows prompt to call functions

PROMPT='$(echo $COMMAND_SUCCESS)[%n@%m %~]$ '

# Keybinds
bindkey "^[[H" beginning-of-line # Home moves cursor to start of line
bindkey "^[[F" end-of-line # End moves cursor to end of line 
bindkey "^[[3~" delete-char # Delete deletes a character
bindkey "^[[1;5C" forward-word # Ctrl+Right moves foward a word
bindkey "^[[1;5D" backward-word # Ctrl+Left moves backward a word

/home/r0r5chach/.config/zsh/init
