Created
March 6, 2017 23:18
-
-
Save rnystrom/4cc91c58890314b9c7298387c7c06561 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Lines configured by zsh-newuser-install | |
| HISTFILE=~/.histfile | |
| HISTSIZE=1000 | |
| SAVEHIST=10000 | |
| bindkey -v | |
| # End of lines configured by zsh-newuser-install | |
| fpath=(/usr/local/share/zsh-completions $fpath) | |
| # The following lines were added by compinstall | |
| zstyle :compinstall filename '/Users/rnystrom/.zshrc' | |
| zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' | |
| autoload -Uz compinit | |
| compinit | |
| # End of lines added by compinstall | |
| # Enable syntax highlighting (must be done before history substring search) | |
| source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh | |
| # Enable history substring search | |
| # https://github.com/zsh-users/zsh-history-substring-search | |
| source /usr/local/share/zsh-history-substring-search.zsh | |
| bindkey '^[[A' history-substring-search-up | |
| bindkey '^[[B' history-substring-search-down | |
| # Enable colors to style prompt | |
| autoload -U colors && colors | |
| # Config setup | |
| # http://stackoverflow.com/a/171564 | |
| setopt VI | |
| export EDITOR='vi' | |
| setopt NO_BEEP | |
| setopt AUTO_CD | |
| setopt GLOB_COMPLETE | |
| setopt AUTO_NAME_DIRS | |
| setopt AUTO_PUSHD | |
| setopt PUSHD_SILENT | |
| setopt PUSHD_TO_HOME | |
| setopt PUSHD_IGNORE_DUPS | |
| setopt NO_HUP | |
| setopt IGNORE_EOF | |
| setopt NO_CASE_GLOB | |
| setopt EXTENDED_GLOB | |
| # Aliases | |
| alias l='ls -oAFG' | |
| alias h='hg' | |
| alias g='git' | |
| # Prompt | |
| ## Use the single letter (2 for dirs with ".") of dirs in pwd, except full last element | |
| function prompt_sorin_pwd { | |
| local pwd="${PWD/#$HOME/~}" | |
| if [[ "$pwd" == (#m)[/~] ]]; then | |
| _prompt_sorin_pwd="$MATCH" | |
| else | |
| _prompt_sorin_pwd="${${(@j:/:M)${(@s:/:)pwd}##.#?}:h}/${pwd:t}" | |
| fi | |
| } | |
| ## Store a count of pushd dirs | |
| function dir_count { | |
| _dir_count=$(dirs | wc -w | sed 's/ //g') | |
| } | |
| ## Triggered before every prompt | |
| function precmd { | |
| prompt_sorin_pwd | |
| dir_count | |
| } | |
| setopt PROMPT_SUBST | |
| PROMPT='(${_dir_count}%) %{$fg[blue]%}${_prompt_sorin_pwd}% %{$reset_color%} %{$fg[green]%}$%{$reset_color%} ' | |
| RPROMPT='%D %*' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment