Last active
June 29, 2018 09:37
-
-
Save Pephers/4603751 to your computer and use it in GitHub Desktop.
A basic ~/.zshrc configured with some colors, vi mode, and for use with Homebrew. Also shows the current git branch.
This file contains 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
export PATH="$(brew --prefix)/bin:$PATH" | |
export LC_ALL=en_US.UTF-8 | |
export LANG=en_US.UTF-8 | |
export HISTSIZE=2000 | |
export HISTFILE="$HOME/.history" | |
export SAVEHIST=$HISTSIZE | |
setopt hist_ignore_all_dups | |
setopt hist_ignore_space | |
autoload -U colors && colors | |
autoload -U compinit | |
compinit | |
parse_git_branch () { | |
GIT_BRANCH=$(git symbolic-ref --short HEAD 2> /dev/null) || return | |
echo " ["$GIT_BRANCH"]" | |
} | |
precmd () { | |
export PROMPT="%{$fg[cyan]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg[red]%}%~%{$fg[black]%}%B$(parse_git_branch)%b%{$reset_color%}"$'\n'"%# " | |
} | |
bindkey -v | |
bindkey '^P' up-history | |
bindkey '^N' down-history | |
bindkey '^?' backward-delete-char | |
bindkey '^h' backward-delete-char | |
bindkey '^w' backward-kill-word | |
bindkey '^r' history-incremental-search-backward | |
function zle-line-init zle-keymap-select { | |
VIM_PROMPT="-- INSERT --" | |
RPS1="${${KEYMAP/(main|viins)/$VIM_PROMPT}/vicmd/}$EPS1" | |
zle reset-prompt | |
} | |
zle -N zle-line-init | |
zle -N zle-keymap-select | |
export KEYTIMEOUT=1 | |
alias ls="ls -Gh" | |
alias l="ls -Glh" | |
alias la="ls -Glah" | |
. `brew --prefix`/etc/profile.d/z.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment