# Lines configured by zsh-newuser-install HISTFILE=~/.histfile HISTSIZE=10000 SAVEHIST=10000 bindkey -e # End of lines configured by zsh-newuser-install # The following lines were added by compinstall zstyle :compinstall filename '~/.zshrc' #autoload -U colors && colors autoload -Uz compinit compinit # End of lines added by compinstall # # [[ -z "$TMUX" ]] && exec tmux # My bash aliases alias ls='ls -F -G' alias l='ls -l' alias la='l -a' alias xv='vim -X' genid () { date | sha1sum | sed -e 's/^\([0-9a-z]\{7\}\).\+/\1/' } # thank you claude chpwd() { ls } ggit-branch () { git branch &> /dev/null if [[ $? -eq 0 ]]; then br=$(git branch | \grep \* | sed "s/^\* //") echo " ${br}" fi } setopt prompt_subst setopt auto_pushd CONFIG="~/.config" # [x/y git-branch] % ... pharpend@picklet # [src/foo master] % pharpend@picklet #PROMPT='%B[%b%F{cyan}%2~%f%F{red}$(ggit-branch)%f%B]%b %F{green}%#%f ' #RPROMPT='%F{red}%n%f%B@%b%F{magenta}%M%f' ncolor() { last_md5_digit=$(echo $1 | md5sum | awk '{print substr($1, length($1), 1)}') # 6 colors #colors='red green yellow blue magenta cyan' # 1> [{N, N*(6/16)} || N <- lists:seq(0, 15)]. # [{0,0.0}, # {1,0.375}, # {2,0.75}, # {3,1.125}, # {4,1.5}, # {5,1.875}, # {6,2.25}, # {7,2.625}, # {8,3.0}, # {9,3.375}, # {10,3.75}, # {11,4.125}, # {12,4.5}, # {13,4.875}, # {14,5.25}, # {15,5.625}] case $last_md5_digit in 0|1|2) echo 'red' ;; 3|4|5) echo 'green' ;; 6|7) echo 'yellow' ;; #8|9|a) echo 'blue' ;; #b|c|d) echo 'magenta' ;; 8|9) echo 'blue' ;; a|b|c) echo 'magenta' ;; *) echo 'cyan' ;; esac } ecolor() { for arg in $@; do this_color=$(ncolor ${arg}) echo "%F{${this_color}}${arg}%f" done } pcolor() { for arg in $@; do this_color=$(ncolor ${arg}) print -P "%F{${this_color}}${arg}%f" done } ucolor() { ecolor $(whoami) } hcolor() { ecolor $(hostname) } #jusername # [pharpend@picklet src/foo master] % #PROMPT='%B[%b%F{red}%n%f%B@%b%F{magenta}%M%f %F{cyan}%2~%f%F{red}$(ggit-branch)%f%B]%b %F{green}%#%f ' #RPROMPT='' # same but randomized colors for username/hostname # [pharpend@picklet src/foo master] % PROMPT='%B[%b$(ucolor)%B@%b$(hcolor) %F{cyan}%2~%f%F{red}$(ggit-branch)%f%B]%b %F{green}%#%f ' RPROMPT='' # pharpend@picklet #PROMPT='%B[%b%F{cyan}%2~%f%F{red}$(ggit-branch)%f%B]%b %F{green}%#%f ' # PROMPT='[%2~$(ggit-branch)] %# ' #RPROMPT='' # RPROMPT='%n@%M' REPORTTIME=3 ## Erlang ##if [[ -d $HOME/.erts ]]; then; . "$HOME"/.erts/28.3/activate; fi #. "$HOME"/.erts/28.3/activate ## opam configuration #if [[ -d $HOME/.opam ]]; then # test -r /home/pharpend/.opam/opam-init/init.zsh && . /home/pharpend/.opam/opam-init/init.zsh > /dev/null 2> /dev/null || true #fi # thank you lenovo at () { echo -n '@' } atln () { echo '@' } ii () { echo -n '2' } iiln () { echo '2' } two () { echo -n '2' } twoln () { echo '2' } # syntax highlighting source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh