# export ZDOTDIR=$HOME/.config/zsh
# source "$HOME/.config/zsh/.zshrc"
#!/bin/sh
export PF_SEP=" ~"
export PF_INFO="ascii os kernel wm editor shell pkgs"
source /home/moo/.config/themes/using/colors.sh
export FZF_DEFAULT_OPTS=$FZF_DEFAULT_OPTS'
--multi
--height=50%
--margin=5%,2%,2%,5%
--layout=reverse-list
--border=double
--info=inline
--prompt="Ɛ>"
--pointer="→"
--marker="♡"
--header="CTRL-c or ESC to quit"
--color="dark,fg:magenta"'
#export FZF_DEFAULT_OPTS=$FZF_DEFAULT_OPTS'
# --color=fg:#d8dee9,bg:-1,hl:#5e81ac
# --color=fg+:#d8dee9,bg+:#4c566a,hl+:#81a1c1
# --color=info:#ebcb8b,prompt:#5e81ac,pointer:#5e81ac
# --color=marker:#d8dee9,spinner:#5e81ac,header:#5e81ac
# --color=border:#d8dee9'
#sleep 0.05
pfetch
#echo " REMEMBER YOU IDIOT!"
#echo "  $($HOME/.local/bin/batterycheck)"
#files=( /home/moo/dox/txt-files/banners/*(noe['REPLY=$RANDOM']) )
#cat $files # or $files[1]
#cat $files[1]
HISTFILE="$XDG_DATA_HOME"/zsh/history
HISTSIZE=10000000
SAVEHIST=10000000
setopt share_history
# some useful options (man zshoptions)
setopt autocd extendedglob nomatch menucomplete
setopt interactive_comments
stty stop undef		# Disable ctrl-s to freeze terminal.
zle_highlight=('paste:none')

# beeping is annoying
unsetopt BEEP


# completions
autoload -Uz compinit
zstyle ':completion:*' menu select
# zstyle ':completion::complete:lsof:*' menu yes select
zmodload zsh/complist
# compinit
_comp_options+=(globdots)		# Include hidden files.

autoload -U up-line-or-beginning-search
autoload -U down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search

# Colors
autoload -Uz colors && colors

# Useful Functions
source "$ZDOTDIR/zsh-functions"

# Normal files to source
zsh_add_file "zsh-exports"
zsh_add_file "zsh-vim-mode"
zsh_add_file "zsh-aliases"
zsh_add_file "zsh-prompt"

# Plugins
zsh_add_plugin "zsh-users/zsh-autosuggestions"
zsh_add_plugin "zsh-users/zsh-syntax-highlighting"
zsh_add_plugin "hlissner/zsh-autopair"
zsh_add_completion "esc/conda-zsh-completion" false
# For more plugins: https://github.com/unixorn/awesome-zsh-plugins
# More completions https://github.com/zsh-users/zsh-completions

# Key-bindings
bindkey -s '^o' 'fzffm^M'
bindkey -s '^f' 'zi^M'
bindkey -s '^s' 'ncdu^M'
# bindkey -s '^n' 'nvim $(fzf)^M'
# bindkey -s '^v' 'nvim\n'
bindkey -s '^z' 'zi^M'
bindkey '^[[P' delete-char
bindkey "^p" up-line-or-beginning-search # Up
bindkey "^n" down-line-or-beginning-search # Down
bindkey "^k" up-line-or-beginning-search # Up
bindkey "^j" down-line-or-beginning-search # Down
bindkey -r "^u"
bindkey -r "^d"

# FZF 
# TODO update for mac
[ -f $ZDOTDIR/completion/_fnm ] && fpath+="$ZDOTDIR/completion/"
# export FZF_DEFAULT_COMMAND='rg --hidden -l ""'
compinit

# Edit line in vim with ctrl-e:
autoload edit-command-line; zle -N edit-command-line
# bindkey '^e' edit-command-line

# Environment variables set everywhere
export EDITOR="vim"
export TERMINAL="st"
export BROWSER="firefox"

# For QT Themes
export QT_QPA_PLATFORMTHEME=qt5ct
#[[ -e $HOME/.config/.dircolors ]] && eval "`dircolors --sh $HOME/.config/.dircolors`"

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