# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
# 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

#!/bin/sh

# [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
[ -f ~/.dotfiles/fubectl.source ] && source ~/.dotfiles/fubectl.source

# if you want to use this, change your non-ascii font to Droid Sans Mono for Awesome
POWERLEVEL9K_MODE='awesome-patched'
# export ZSH_THEME="powerlevel9k/powerlevel9k"
export ZSH_THEME="powerlevel10k/powerlevel10k"
POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
# https://github.com/bhilburn/powerlevel9k#customizing-prompt-segments
# https://github.com/bhilburn/powerlevel9k/wiki/Stylizing-Your-Prompt
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(user dir vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status rbenv rspec_stats)
# colorcode test
# for code ({000..255}) print -P -- "$code: %F{$code}This is how your text would look like%f"
POWERLEVEL9K_NVM_FOREGROUND='000'
POWERLEVEL9K_NVM_BACKGROUND='072'
POWERLEVEL9K_SHOW_CHANGESET=true

POWERLEVEL9K_DIR_HOME_FOREGROUND="black"
POWERLEVEL9K_DIR_HOME_BACKGROUND="green"
POWERLEVEL9K_DIR_HOME_SUBFOLDER_FOREGROUND="white"
POWERLEVEL9K_DIR_DEFAULT_FOREGROUND="white"
POWERLEVEL9K_DIR_DEFAULT_BACKGROUND="yellow"

POWERLEVEL9K_DIR_ETC_BACKGROUND="grey"
POWERLEVEL9K_DIR_ETC_FOREGROUND="black"

# Customize to your needs...
POWERLEVEL9K_CUSTOM_PYTHON="echo -n '\uf81f' Python"
POWERLEVEL9K_CUSTOM_PYTHON_FOREGROUND="black"
POWERLEVEL9K_CUSTOM_PYTHON_BACKGROUND="blue"

POWERLEVEL9K_OS_ICON_BACKGROUND="black"
POWERLEVEL9K_OS_ICON_FOREGROUND="orange"

POWERLEVEL9K_VCS_CLEAN_FOREGROUND='black'
POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND='black'
POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND='red'
POWERLEVEL9K_VCS_MODIFIED_FOREGROUND='black'
POWERLEVEL9K_VCS_MODIFIED_BACKGROUND='yellow'
# ssh
# export SSH_KEY_PATH="~/.ssh/dsa_id"

# Path to your dotfiles installation.
export DOTFILES=$HOME/.dotfiles

# Path to your oh-my-zsh configuration.
export ZSH=$DOTFILES/oh-my-zsh

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"

# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"

# Uncomment the following line to 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 to disable colors in ls.
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"

# 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="dd/mm/yyyy"
HISTTIMEFORMAT="dd/mm/yyyy"
# Which plugins would you like to load? (plugins can be found in ~/.dotfiles/oh-my-zsh/plugins/*)
# deactivated plugins kubecontext rubocop
# Example format: plugins=(zsh-autosuggestions zsh-completions zsh-syntax-highlighting  zsh-output-highlighting  common-aliases rails git textmate ruby lighthouse docker docker-compose docker-machine)
BUNDLED_COMMANDS=(rubocop)
UNBUNDLED_COMMANDS=(berks foreman mailcatcher rails ruby spin rubocop)
plugins=(zsh-completions zsh-autosuggestions docker fzf bundler brew cask capistrano codeclimate coffee dotenv gem git github grunt helm heroku history iterm2 minikube node redis-cli redis-cli rails rake rake-fast ruby rbenv textmate macos pod zeus terraform)

# Activate Oh-My-Zsh
source $ZSH/oh-my-zsh.sh

# platformIO autocompletion
#
emulate sh -c '. ~/.profile'

# eval "$(_PLATFORMIO_COMPLETE=source platformio)"
# eval "$(_PIO_COMPLETE=source pio)"

#source ~/.profile
complete -o nospace -C /usr/local/bin/terraform terraform

# # tabtab source for yarn package
# # uninstall by removing these lines or running `tabtab uninstall yarn`
# [[ -f /Users/jan/.config/yarn/global/node_modules/tabtab/.completions/yarn.zsh ]] && . /Users/jan/.config/yarn/global/node_modules/tabtab/.completions/yarn.zsh

# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ -f ~/.p10k.zsh ]] && source ~/.p10k.zsh

[ -f "/Users/jan/.shopify-app-cli/shopify.sh" ] && source "/Users/jan/.shopify-app-cli/shopify.sh"
source /Users/Shared/rlm/rlmenvset.sh

# source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

# load autocomplete
fpath=(/usr/local/share/zsh-completions $fpath)
fpath=(~/.dotfiles/completions $fpath)
autoload -U compinit && compinit

# autocompletion for kubectl
if [ $commands[kubectl] ]; then
  source <(kubectl completion zsh)
fi

# kompose for kubernetes autocompletion
source <(kompose completion zsh)

source <(kubeone completion zsh)
source <(tilt completion zsh)
source <(civo completion zsh)

# Set Ruby version manager
if which rbenv >/dev/null; then eval "$(rbenv init -)"; fi


# iTerm2 integration and utilities (e.g., imgcat)
[[ -e "$HOME/.iterm2_shell_integration.zsh" ]] && source "$HOME/.iterm2_shell_integration.zsh"