# Path to your oh-my-zsh installation.
ZSH=/usr/share/oh-my-zsh/

# Autojump
source /usr/share/autojump/autojump.zsh

# ZSH Theme
ZSH_THEME="powerlevel9k/powerlevel9k"

# Use case-sensitive completion.
CASE_SENSITIVE="true"

# Use hyphen-insensitive completion. Case-sensitive completion must be off.
# HYPHEN_INSENSITIVE="true"

# Disable bi-weekly auto-update checks.
DISABLE_AUTO_UPDATE="true"

# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
HIST_STAMPS="yyyy-mm-dd"

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git archlinux autojump command-not-found)


### User configuration

export MANPATH="/usr/local/man:$MANPATH"

export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
export EDITOR='nvim'

# Compilation flags
export ARCHFLAGS="-arch x86_64"

# ssh
export SSH_KEY_PATH="~/.ssh/rsa_id"

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

ZSH_CACHE_DIR=$HOME/.cache/oh-my-zsh
if [[ ! -d $ZSH_CACHE_DIR ]]; then
  mkdir $ZSH_CACHE_DIR
fi

source $ZSH/oh-my-zsh.sh

export PATH="$HOME/opt/i686-elf/bin:$PATH"

alias vpnon="sudo systemctl start openvpn-client@BoltWolf"
alias vpnoff="sudo systemctl stop openvpn-client@BoltWolf"

alias vim=nvim

function masm() (
	set -e
	export WINEPREFIX=~/.wine-masm
	FILENAME="$(basename "$1")"
	EXT="${FILENAME##*.}"
	if [[ "$EXT" = "asm" ]]; then
		FILENAME="${FILENAME%.*}"
	fi
	
	UNIX_PATH="$(dirname "$1")/$FILENAME"
	WINDOWS_PATH=$(echo "$UNIX_PATH" | tr '/' '\\')

	wine ml -nologo -c -coff -Zi "$WINDOWS_PATH.asm"

	wine link /NOLOGO /SUBSYSTEM:CONSOLE /ENTRY:main \
		/LIBPATH:'C:\Irvine' \
		irvine32.lib kernel32.lib user32.lib "$WINDOWS_PATH.obj"

	rm $UNIX_PATH.obj

	wine "$WINDOWS_PATH.exe"
)