fpath=(~/.zsh $fpath) # Lines configured by zsh-newuser-install HISTFILE=~/.histfile HISTSIZE=1000 SAVEHIST=1000 # End of lines configured by zsh-newuser-install #### #autoload -Uz vcs_info #precmd_vcs_info() { # vcs_info # local STATUS=$(git status --porcelain 2> /dev/null | tail -1) # if [[ -n $STATUS ]]; then # zstyle ':vcs_info:git:*' formats '%F{cyan}%b%f %F{yellow}▲%f ' # else # zstyle ':vcs_info:git:*' formats '%F{cyan}%b%f %F{green}▲%f ' # fi #} #precmd_functions+=( precmd_vcs_info ) # #zstyle ':vcs_info:*' enable git setopt prompt_subst get_git_branch() { git symbolic-ref --short HEAD 2> /dev/null } get_git_status() { local STATUS=$(git status --porcelain 2> /dev/null | tail -1) local BRANCH=$(get_git_branch) if [[ -n $BRANCH ]]; then if [[ -n $STATUS ]]; then echo "%F{cyan}$BRANCH%f %F{yellow}▲%f " else echo "%F{cyan}$BRANCH%f %F{green}▲%f " fi fi } timer=0 timer_show=0 preexec_time() { timer=${timer:-$SECONDS} } precmd_time() { if [ $timer ]; then timer_show=$(($SECONDS-$timer)) unset timer fi } preexec_functions+=(preexec_time) precmd_functions+=(precmd_time) prompt_time() { local out="" if [ $timer_show -lt 3 ]; then timer_display=$out return fi if [ $timer_show -ge 3600 ]; then out+="$(printf '%d' $(($timer_show/3600)))h" fi if [ $timer_show -ge 60 ]; then out+="$(printf '%d' $(($timer_show%3600/60)))m" fi out+="$(printf '%d' $(($timer_show%60)))s" timer_display=$out } precmd_functions+=(prompt_time) binary_clock() { local row0=("⠀" "⠈" "⠐" "⠘" "⠠" "⠨" "⠰" "⠸" "⢀" "⢈") local row1=("⠁" "⠉" "⠑" "⠙" "⠡" "⠩" "⠱" "⠹" "⢁" "⢉") local row2=("⠂" "⠊" "⠒" "⠚" "⠢" "⠪" "⠲" "⠺" "⢂" "⢊") local row3=("⠃" "⠋" "⠓" "⠛" "⠣" "⠫" "⠳" "⠻" "⢃" "⢋") local row4=("⠄" "⠌" "⠔" "⠜" "⠤" "⠬" "⠴" "⠼" "⢄" "⢌") local row5=("⠅" "⠍" "⠕" "⠝" "⠥" "⠭" "⠵" "⠽" "⢅" "⢍") local chars=("${row0[@]}" "${row1[@]}" "${row2[@]}" "${row3[@]}" "${row4[@]}" "${row5[@]}") local hour=$(date +"%H") local minute=$(date +"%M") local second=$(date +"%S") [[ $hour = 0* ]] && hour=${hour:1:1} [[ $minute = 0* ]] && minute=${minute:1:1} [[ $second = 0* ]] && second=${second:1:1} bclock="${chars[$hour+1]} ${chars[$minute+1]} ${chars[$second+1]}" } precmd_functions+=(binary_clock) PROMPT=' %(?.%F{magenta}.%F{red})λ%f %1~ $(get_git_status) ' RPROMPT='%F{yellow}$timer_display%f %(?..%F{red}%?%f )%F{white}$bclock%f' #### # keys autoload -Uz up-line-or-beginning-search autoload -Uz down-line-or-beginning-search zle -N up-line-or-beginning-search zle -N down-line-or-beginning-search bindkey '^?' backward-delete-char # bs delete one char backward bindkey '^[[3~' delete-char # delete delete one char forward bindkey '^[[H' beginning-of-line # home go to the beginning of line bindkey '^[[F' end-of-line # end go to the end of line bindkey '^[[1~' beginning-of-line # home (2) go to the beginning of line bindkey '^[[4~' end-of-line # end (2) go to the end of line bindkey '^[[1;5C' forward-word # ctrl+right go forward one word bindkey '^[[1;5D' backward-word # ctrl+left go backward one word bindkey '^H' backward-kill-word # ctrl+bs delete previous word bindkey '^[[3;5~' kill-word # ctrl+del delete next word bindkey '^J' backward-kill-line # ctrl+j delete everything before cursor bindkey '^[[D' backward-char # left move cursor one char backward bindkey '^[[C' forward-char # right move cursor one char forward bindkey '^[[A' up-line-or-beginning-search # up prev command in history bindkey '^[[B' down-line-or-beginning-search # down next command in history bindkey '^[[5~' history-search-backward # pgup prev in history no search bindkey '^[[6~' history-search-forward # pgdn next in history no search #### # hast =) hast() { a=$(cat); curl -X POST -s -d "$a" https://haste.soulja-boy-told.me/documents | awk -F '"' '{print "https://haste.soulja-boy-told.me/"$4}'; } #### export PATH=$PATH:$HOME/.local/bin