# fuzzy finder
source /usr/share/doc/fzf/examples/key-bindings.zsh
source /usr/share/doc/fzf/examples/completion.zsh

bindkey '^H' fzf-cd-widget
time source /usr/share/virtualenvwrapper/virtualenvwrapper.sh

alias preview="fzf --preview 'bat --color \"always\" {}'"
alias rg="rg -S -p"
alias ldict="dict.cc.py en de"
alias bat='batcat'
alias unp='dtrx'
alias clearr="printf '\033[2J\033[3J\033[1;1H'"

ppvagrant() {
	pushd -q ~/source/ilabs/platform-prov/vagrant
	export VAGRANT_INET=1
	export VAGRANT_SYNC_HOST='/home/dario/source/ilabs/'
	export VAGRANT_SYNC_GUEST='/src'
	export VAGRANT_SYNC_EXCLUDE='.git|venv|node_modules|.app.tar'
	export VB_NO_UI=1

	command vagrant $*

	popd -q
}


rga-fzf() {
RG_PREFIX="rga --files-with-matches"
	local file
	file="$(
	FZF_DEFAULT_COMMAND="$RG_PREFIX '$1'" \
		fzf --sort --preview="[[ ! -z {} ]] && rga --pretty --context 5 {q} {}" \
		--phony -q "$1" \
		--bind "change:reload:$RG_PREFIX {q}" \
		--preview-window="70%:wrap"
		)" &&
			echo "opening $file" &&
			xdg-open "$file"
}


export PYENV_ROOT="$HOME/source/pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"

export PATH=/usr/lib/cargo/bin/:$PATH:/home/dario/.local/bin/

export BAT_THEME="ansi-dark"
