export CARGO_HOME="$HOME/.cargo"
export RUSTUP_HOME="$HOME/.rustup"
export PATH="$HOME/.cargo/bin:$HOME/.local/bin:$PATH"

if command -v tmux &>/dev/null && [ -z "$TMUX" ] && [ -z "$SSH_CONNECTION" ]; then
  tmux new
fi

alias c="claude"
alias t="tmux"
alias v="vim"
alias ts="vim ~/.tmux.conf"
alias vs="vim ~/.vimrc"
alias zs="vim ~/.zshrc"
alias zr="exec $SHELL && . ~/.zshrc"
alias ll="ls -alh"
alias df="df -H"
alias f="vren"

zmodload zsh/complist
zstyle ':completion:*' menu select
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
autoload -Uz compinit
compinit
bindkey -M menuselect '^n' down-line-or-history
bindkey -M menuselect '^p' up-line-or-history
#bindkey -M menuselect '^j' accept-and-menu-complete

HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.zsh_history
setopt SHARE_HISTORY
setopt HIST_IGNORE_DUPS

case $OSTYPE in
  darwin*)
    alias ls="ls -aG"
    alias ll="ls -alhG"
    alias date=/opt/homebrew/bin/gdate
    alias u="brew update && brew upgrade && brew doctor"
    export PATH="/opt/homebrew/bin:$PATH"
    ;;
  linux*)
    alias ls="ls -a --color=auto"
    alias ll="ls -alh --color=auto"
    alias u="sudo pacman -Syu --noconfirm"
    fpath=(/usr/share/zsh/site-functions $fpath)
    ;;
esac

for p in /opt/homebrew/share /usr/share/zsh/plugins; do
  [ -f "$p/zsh-autosuggestions/zsh-autosuggestions.zsh" ] && source "$p/zsh-autosuggestions/zsh-autosuggestions.zsh"
  [ -f "$p/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ] && source "$p/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
  [ -f "$p/zsh-history-substring-search/zsh-history-substring-search.zsh" ] && source "$p/zsh-history-substring-search/zsh-history-substring-search.zsh"
done

bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down

chpwd() { ls }

for f in ~/.zsh/plugin/*.zsh; do source "$f"; done


