
unsetopt always_last_prompt
autoload -U colors && colors
zle_highlight+=(paste:none)
unsetopt BEEP
autoload -U compinit
compinit

bindkey "\e[3~" delete-char
bindkey '^[[F' end-of-line
bindkey '^[[H' beginning-of-line
bindkey '^[[6~' end-of-line
bindkey '^[[5~' beginning-of-line

HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt HIST_REDUCE_BLANKS
setopt EXTENDED_HISTORY
setopt INC_APPEND_HISTORY
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_IGNORE_SPACE
setopt HIST_SAVE_NO_DUPS
setopt HIST_REDUCE_BLANKS
setopt HIST_VERIFY
setopt HIST_BEEP
setopt SHARE_HISTORY
 
HN=`hostname -s`

PP=">"; if [[ $USER == "root" ]] then PP=">>" fi
PROMPT="%n@${HN}:%{$fg[white]%}%~%{$reset_color%} $PP "

alias a='alias'
alias h='history -d -10000'
alias L='last -16'
alias ls='ls -F'
alias ll='ls -lsh'
alias lt='ls -ltrh'
alias lla='ls -lsah'
alias lta='ls -ltrah'
alias s='ssh'
alias sr='ssh -l root'
alias rs='rsync -va --delete --stats'
alias p='ps -ef | grep ${LOGNAME}'
alias P='ps -ef'
alias af='apt-cache search'
alias ai='apt-get install'
alias sd='lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL'

alias ga='git add -v .'
alias gb='git branch'
alias gs='git status'
alias gl="git log -32 --reverse --date=local --format='%h  %cd  %s'"
alias gc='git commit -m'
alias gu='git checkout'
alias gp='git push'
alias y='yazi'
alias f='fzf'

export TERM=xterm-256color
export COLORTERM=truecolor


PATH=/db/bin:"$PATH"
if [ -f /db/go/bin/go ]; then
  PATH="$PATH":/db/go/bin:$(/db/go/bin/go env GOPATH)/bin
  export CGO_ENABLED=0
fi

tcsh_autolist() { if [[ -z ${LBUFFER// } ]]
    then BUFFER="ls " CURSOR=3 zle list-choices
    else zle expand-or-complete-prefix; fi }
zle -N tcsh_autolist
bindkey '^I' tcsh_autolist

if [ -f /etc/zshcomp ]; then
    source /etc/zshcom
fi

[ -f /etc/zsh/zshcomp ] && source /etc/zsh/zshcomp

if [ -f /db/etc/omp.json ]; then
  if (( $+commands[oh-my-posh] )); then
    eval "$(oh-my-posh init zsh --config /db/etc/omp.json )";
  fi
fi

if (( $+commands[lsd] )); then
  alias lx='lsd --icon never --tree -la'
  alias ll='lsd --icon never -la'
  alias lt='lsd --icon never -latr'
  alias ls='lsd --icon never -a'
fi
