# The following lines were added by compinstall
zstyle :compinstall filename '/home/lanxu/.zshrc'

autoload -U compinit promptinit colors
compinit
promptinit
colors
# End of lines added by compinstall
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
setopt notify

# Ignore lines prefixed with '#'.
setopt interactivecomments

# Ignore duplicate in history.
setopt hist_ignore_dups

# Prevent record in history entry if preceding them with at least one space
setopt hist_ignore_space

# This will set the default prompt to the walters theme
#prompt grml

# You may need to manually set your language environment
export LANG=fi_FI.UTF-8

# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
  export EDITOR='vim'
else
  export EDITOR='vim'
fi

# Syntax highlighting
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source ~/.zplugins

alias top=htop
alias ll="ls -lh"
alias la="ls -a"
alias lp="lastpass.sh"
alias ranger="TERMCMD=termite ranger"
alias search="search.sh"
#alias ls="ls -N --time-style=long-iso --color=auto"
alias ls="ls --time-style=long-iso --color=auto --human-readable --group-directories-first --classify"
alias rhc='RUBYOPT="-W0" rhc'
# Other
alias fixsteam='find ~/.steam/root/ \( -name "libgcc_s.so*" -o -name "libstdc++.so*" -o -name "libxcb.so*" \) -print -delete'
alias runsteam="LD_PRELOAD='/usr/$LIB/libstdc++.so.6 /usr/$LIB/libgcc_s.so.1 /usr/$LIB/libxcb.so.1 /usr/$LIB/libgpg-error.so' /usr/bin/steam"
alias steamgamesdir='cd ~/.local/share/Steam/SteamApps/common'
alias emsdksetup='source $EMSDK/emsdk_env.sh'
alias runwinesteam="MESA_GL_VERSION_OVERRIDE=3.3COMPAT PULSE_LATENCY_MSEC=60 run-desktop.py ~/.local/share/applications/wine/Programs/Steam/Steam.desktop"
alias rbackup="restic -r rclone:hubic:ChimeraLinux"
# https://github.com/chriskempson/base16-shell
# git clone https://github.com/chriskempson/base16-shell.git ~/.config/base16-shell
source $HOME/.config/base16-shell/scripts/base16-default-dark.sh

# Emscripten
#source /home/lanxu/Koodit/github/emsdk/emsdk_env.sh

#TERM=xterm-256color
#bindkey "${terminfo[khome]}" beginning-of-line
#bindkey "${terminfo[kend]}" end-of-line
export TERMCMD=termite


function auradd {
	pkg=$1
	aur sync --no-view --no-confirm --database custom "$pkg" >&2
	sudo pacman -Sy "$pkg"
}

function aurrm {
	pkg=$1
	rm_out=$(repo-remove /var/cache/pacman/custom/custom.db.tar "$pkg" 2>&1)
	if [[ $rm_out = *"ERROR"* ]]; then
		echo "not found" >&2
	else
		rm -rf /var/cache/pacman/custom/"$pkg"*.pkg.* || true
		echo "$pkg removed"
	fi
	sudo pacman -Sy
	sudo pacman -Rnc "$pkg"
}

function aurupdate {
	aur sync --no-view --no-confirm --database custom -u
	sudo pacman -Syu
}

function c {
	echo "scale=2; $@" | bc
}

function aurls {
	sudo pacman -Sl custom
}
