zmodload -i zsh/complist
autoload -U compaudit compinit && compinit

unsetopt flowcontrol

unsetopt menucomplete
setopt list_ambiguous
setopt complete_in_word
setopt glob_complete
unsetopt complete_aliases
setopt always_to_end
setopt auto_param_slash
setopt interactivecomments
setopt no_nomatch
setopt no_nullglob
setopt no_listbeep

bindkey -M menuselect '^o' accept-and-infer-next-history
zle -C all-matches complete-word _generic
bindkey '^Xa' all-matches
zstyle ':completion:*' menu select=2
zstyle ':completion:*' verbose yes
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
zstyle ':completion:*' list-colors ''
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w"
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
zstyle ':completion::complete:*' use-cache 1
zstyle ':completion::complete:*' cache-path "$HOME/.cache/zsh/completion/"
zstyle ':completion:all-matches:*' old-matches only
zstyle ':completion:all-matches::::' completer _all_matches

zstyle ':completion:*:*:*:users' ignored-patterns \
        adm amanda apache at avahi avahi-autoipd beaglidx bin cacti canna \
        clamav daemon dbus distcache dnsmasq dovecot fax ftp games gdm \
        gkrellmd gopher hacluster haldaemon halt hsqldb ident junkbust kdm \
        ldap lp mail mailman mailnull man messagebus  mldonkey mysql nagios \
        named netdump news nfsnobody nobody nscd ntp nut nx obsrun openvpn \
        operator pcap polkitd postfix postgres privoxy pulse pvm quagga radvd \
        rpc rpcuser rpm rtkit scard shutdown squid sshd statd svn sync tftp \
        usbmux uucp vcsa wwwrun xfs '_*'
zstyle '*' single-ignored show

source $HOME/.sh_aliases
source $HOME/.sh_functions
source $HOME/.sh_colorize
source $HOME/.zsh_aliases

# correct_all is stupid and whoever thought it was a good idea to set it is stupid.
setopt correct nocorrect_all

if [ -z "$HISTFILE" ]; then
    HISTFILE=$HOME/.zsh_history
fi
HISTSIZE=30000
SAVEHIST=100000
setopt append_history
setopt extended_history
setopt hist_expire_dups_first
setopt hist_ignore_dups
setopt hist_ignore_space
setopt hist_verify
setopt inc_append_history
setopt share_history
setopt extendedglob notify
bindkey '[3~' delete-char

if [ -f ~/.profile ]; then
	source ~/.profile
fi

autoload -Uz vcs_info

zstyle ':vcs_info:*' stagedstr '%F{28}●'
zstyle ':vcs_info:*' unstagedstr '%F{11}●'
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r'
zstyle ':vcs_info:*' enable git svn cvs darcs hg
zstyle ':vcs_info:*' disable bzr


if [[ -e NEXT_TO_RUN ]]
then
    cat NEXT_TO_RUN
fi
export PATH=$PATH:/sbin/
export TERMINAL=wezterm
export MPD_HOST=127.0.0.1
export MPD_PORT=6969
export EDITOR="emacs -nw"

function reload_gtk_theme() {
  theme=$(gsettings get org.gnome.desktop.interface gtk-theme)
  gsettings set org.gnome.desktop.interface gtk-theme ''
  sleep 1
  gsettings set org.gnome.desktop.interface gtk-theme $theme
}
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

## By /home/libkyy/.local/share/flutter/bin/cache/flutter_tools.snapshot
export PATH=$PATH:$HOME/.emacs.d/bin
export PATH=$PATH:$HOME/bin
export PATH=$PATH:$HOME/.config/emacs/bin
export PATH=$PATH:$HOME/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/



export XDG_DATA_DIRS=$XDG_DATA_DIRS:$HOME
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
export PATH=$HOME/.local/share/ponyup/bin:$PATH

export PATH=$PATH:$HOME.millennium/ext/bin
export PATH="$PATH:$HOME/Code/flutter/bin"
export PATH="$PATH:$HOME/Android/Sdk/cmdline-tools/bin"
export SSH_AUTH_SOCK=/home/$USER/.bitwarden-ssh-agent.sock

# pnpm
export PNPM_HOME="/home/linly/.local/share/pnpm"
case ":$PATH:" in
  *":$PNPM_HOME:"*) ;;
  *) export PATH="$PNPM_HOME:$PATH" ;;
esac
# pnpm end
