# Load p10k instant prompt if it exists
# 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

DISABLE_UPDATE_PROMPT=true

# Add custom paths to $PATH
export PATH="$HOME/.local/bin:$PATH"

# Homebrew Configuration
# Add Homebrew's installation directory to the PATH
if [[ -d /opt/homebrew ]]; then
  export PATH="/opt/homebrew/bin:/opt/homebrew/sbin:$PATH"
elif [[ -d /usr/local ]]; then
  export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
fi

# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
export UPDATE_ZSH_DAYS=1

export FZF_DEFAULT_OPTS="$(fzf_theme)"
# Set name of the theme to loading
# ZSH_THEME="powerlevel10k/powerlevel10k"
# ZSH_THEME="robbyrussell"

# Set list of themes to pick from when loading at random
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )

# Uncomment to use case-sensitive completion
# CASE_SENSITIVE="true"

# Uncomment to use hyphen-insensitive completion
# HYPHEN_INSENSITIVE="true"

# Uncomment one of the following lines to change the auto-update behavior
# zstyle ':omz:update' mode disabled  # disable automatic updates
# zstyle ':omz:update' mode auto      # update automatically without asking
# zstyle ':omz:update' mode reminder  # just remind me to update when it's time

# Uncomment to change how often to auto-update (in days)
# zstyle ':omz:update' frequency 13

# Uncomment if pasting URLs and other text is messed up
# DISABLE_MAGIC_FUNCTIONS="true"

# Uncomment to disable colors in ls
# DISABLE_LS_COLORS="true"

# Uncomment to disable auto-setting terminal title
# DISABLE_AUTO_TITLE="true"

# Uncomment to enable command auto-correction
# ENABLE_CORRECTION="true"

# Uncomment to display red dots whilst waiting for completion
# COMPLETION_WAITING_DOTS="true"

# Uncomment to disable marking untracked files under VCS as dirty
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Load zsh hooks
autoload -Uz add-zsh-hook

# move_curor_to_bottom() {
#     [[ -n ${PIN_PROMPT_NEWLINE+1} ]] && echo
#     tput cup $LINES
# }

# move_curor_to_bottom
# add-zsh-hook preexec move_curor_to_bottom

# Uncomment to change the command execution time stamp shown in history command output
# HIST_STAMPS="mm/dd/yyyy"

HISTFILE=~/.zsh_history
HISTSIZE=1000
SAVEHIST=10000

# Set custom folder for oh-my-zsh, if desired
ZSH_CUSTOM=$HOME/.oh-my-zsh/custom

# Plugins to load
plugins=(
    git
    docker
    zsh-syntax-highlighting
    zsh-autosuggestions
    macos
    autoupdate
    zoxide
    eza
)

export ZSH_AUTOSUGGEST_STRATEGY=(
    history
    completion
)

# Source oh-my-zsh.sh
source $ZSH/oh-my-zsh.sh

# User configuration
source ~/.zprofile
# export MANPATH="/usr/local/man:$MANPATH"

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

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# Set personal aliases
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# alias firefox="/Applications/Firefox.app/Contents/MacOS/firefox-bin -P profileName"

# Customize prompt, if .p10k.zsh exists
# [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

# Finalize p10k configuration if p10k function exists
# (( ! ${+functions[p10k]} )) || p10k finalize

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/usr/local/Caskroom/miniforge/base/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/usr/local/Caskroom/miniforge/base/etc/profile.d/conda.sh" ]; then
        . "/usr/local/Caskroom/miniforge/base/etc/profile.d/conda.sh"
    else
        export PATH="/usr/local/Caskroom/miniforge/base/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

# Load completion scripts
autoload -Uz compinit && compinit

# # Customize prompt, if .p10k.zsh in .dotfiles exists
# [[ ! -f ~/.dotfiles/p10k/.p10k.zsh ]] || source ~/.dotfiles/p10k/.p10k.zsh

# Initialize Starship
eval "$(starship init zsh)"
export STARSHIP_CONFIG=~/.config/starship.toml

