if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
    source ${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh
fi

export ZSH=$HOME/.oh-my-zsh
export EDITOR="nvim"
export VISUAL="nvim-qt"

ZSH_THEME="powerlevel10k/powerlevel10k"
CASE_SENSITIVE="true"

zstyle ':omz:update' mode auto      # update automatically without asking
zstyle ':omz:update' frequency 7

plugins=(zsh-autosuggestions sudo web-search copypath gitignore zoxide)

source $ZSH/oh-my-zsh.sh

alias vim='nvim'
alias vi='nvim'
alias ws='web_search'

zstyle ':completion:*' completer _complete _approximate
zstyle ':completion:*' group-name ''
zstyle ':completion:*' menu select
zstyle ':completion:*' file-list all

zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path "$XDG_CACHE_HOME/zsh/.zcompcache"

zstyle :compinstall filename "$HOME/.zshrc"

autoload -Uz compinit; compinit
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
bindkey -v # bind keys to vim mode

eval "$(zoxide init zsh)"

# set up ruby if installed
if (($+commands[ruby] )); then
    export GEM_HOME="$(ruby -e 'puts Gem.user_dir')"
    path+=("$GEM_HOME/bin")
fi

# set up pyenv if installed
export PYENV_ROOT="$HOME/.pyenv"
if (($+commands[pyenv] )); then
    export PATH="$PYENV_ROOT/bin:$PATH"
    eval "$(pyenv init -)"
fi

path+=("$HOME/.local/bin/")

export PATH
[[ ! -f "$HOME/.p10k.zsh" ]] || source "$HOME/.p10k.zsh"

# put your paths and aliases here to avoid merge conflicts 
[[ ! -f "$HOME/.myzsh" ]] || source "$HOME/.myzsh"
[[ -f "$HOME/.profile" ]] && . "$HOME/.profile"
