# Enable colors (optional) autoload -U colors && colors # Function to get battery percentage get_battery() { bat="" if acpiconf -i 0 > /dev/null 2>&1 ; then bat=$(acpiconf -i 0 | awk -F: '/Remaining capacity/ {print $2}' | xargs echo -n) bat=${bat%*%} state=$(acpiconf -i 0 | awk -F: '/State/ {print $2}' | xargs echo -n) if [ -n "$bat" ]; then if [ "$bat" -lt 20 ]; then [ "$state" = "charging" ] && echo -n "🔌$bat%%" [ "$state" != "charging" ] && echo -n "đŸĒĢ$bat%%" else [ "$state" = "charging" ] && echo -n "🔌$bat%%" [ "$state" != "charging" ] && echo -n "🔋$bat%%" fi fi fi } is_local() { # information: %F{231}%K{24}@%m%k%f # warning: %F{232}%K{214}@%m%k%f # critical %F{255}%K{160}@%m%k%f if [ -n "$SSH_CLIENT" ]; then # if user root, then red, other else, green # must be a xterm 256 color code echo "%B%(!.%F{202}.%F{10})%n%F{232}%K{214}@%m%k%f%b%{$reset_color%}" else #echo "%B%(!.%F{202}.%F{10})%n@%m%f%b%{$reset_color%}" echo "%B%(!.%F{202}.%F{10})%n@%m%f%b%{$reset_color%}" fi } setopt prompt_subst # if root then #, other else $ local user_symbol='%# [%?]' # Set PROMPT and RPROMPT using prompt expansion #precmd() { # print -P '╭─%F{cyan}%n@%m%f: %~' #} #PROMPT="╭─%F{cyan}%n@%m%f: %~ PROMPT="╭─$(is_local): %~ ╰─%B${user_symbol}%b " RPROMPT='%F{cyan}[%D{%H:%M:%S}] $(get_battery)%f' source $HOME/.config/zsh/antidote/antidote.zsh antidote load $HOME/.config/zsh/zsh_plugins.txt # load comptetions autoload -Uz compinit && compinit #bindkey -e # search up arrow key bindkey '^[[A' history-search-backward # search down arrow key bindkey '^[[B' history-search-forward # History ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#8b9193" HISTSIZE=5000 HISTFILE=~/.zsh_history SAVEHIST=$HISTSIZE HISTDUP=erase setopt appendhistory setopt sharehistory setopt hist_ignore_space setopt hist_ignore_all_dups setopt hist_save_no_dups setopt hist_ignore_dups setopt hist_find_no_dups # completion non case sensitive zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' #completion with ls color zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" # aLiases [ "$(uname -s)" = "FreeBSD" ] && alias ls='ls --color' alias v='nvim' export PATH="$HOME/.local/bin:$HOME/etict/bin:$PATH"