2014-07-17 01:26:38 -07:00
|
|
|
#!/bin/zsh
|
|
|
|
|
2013-03-21 19:24:13 -07:00
|
|
|
# Disable autocorrect behavior, very annoying!
|
2013-03-08 21:18:10 -08:00
|
|
|
unsetopt correct_all
|
|
|
|
|
2013-03-03 05:49:37 -08:00
|
|
|
# HISTORY
|
2014-07-17 01:26:38 -07:00
|
|
|
HISTFILE=/tmp/histfile
|
2013-12-19 06:50:45 -08:00
|
|
|
HISTSIZE=5000
|
|
|
|
SAVEHIST=5000
|
2013-03-21 19:25:31 -07:00
|
|
|
|
2014-06-18 20:44:18 -07:00
|
|
|
# No longer prompt to update oh-my-zsh
|
|
|
|
DISABLE_AUTO_UPDATE="true"
|
|
|
|
|
2013-03-21 19:25:31 -07:00
|
|
|
# Don't overwrite, append!
|
|
|
|
setopt APPEND_HISTORY
|
|
|
|
# Sharing history between shell instances
|
|
|
|
setopt SHARE_HISTORY
|
|
|
|
# If I type cd and then cd again, only save the last one
|
|
|
|
setopt HIST_IGNORE_DUPS
|
|
|
|
# Don't save lines that are just whitespace
|
|
|
|
setopt HIST_IGNORE_SPACE
|
|
|
|
setopt HIST_NO_STORE
|
|
|
|
# Reduce extra whitespace
|
|
|
|
setopt HIST_REDUCE_BLANKS
|
|
|
|
# Save time and how long a command ran
|
|
|
|
setopt EXTENDED_HISTORY
|
|
|
|
# Beep boop
|
|
|
|
setopt NO_BEEP
|
|
|
|
|
|
|
|
setopt EXTENDED_GLOB
|
|
|
|
setopt PROMPT_SUBST
|
|
|
|
setopt AUTO_PUSHD
|
|
|
|
setopt PUSHD_IGNORE_DUPS
|
2013-03-03 05:49:37 -08:00
|
|
|
|
2014-07-17 01:26:38 -07:00
|
|
|
export KEYTIMEOUT=1
|
2013-03-16 14:57:09 -07:00
|
|
|
export EDITOR=vim
|
2013-03-03 05:49:37 -08:00
|
|
|
export RUBYOPT=rubygems
|
|
|
|
|
2014-07-17 01:26:38 -07:00
|
|
|
# COMPLETION_WAITING_DOTS="true"
|
2013-03-22 18:10:59 -07:00
|
|
|
|
2013-08-04 02:04:37 -07:00
|
|
|
|
|
|
|
##################################
|
2013-08-02 12:37:20 -07:00
|
|
|
# Make zsh prompt act like vi
|
2013-08-04 02:04:37 -07:00
|
|
|
|
2013-08-02 12:37:20 -07:00
|
|
|
zle -N edit-command-line
|
2013-08-04 02:04:37 -07:00
|
|
|
bindkey -v
|
2013-08-02 12:37:20 -07:00
|
|
|
bindkey '^f' edit-command-line
|
|
|
|
|
2013-12-02 10:24:36 -08:00
|
|
|
bindkey '^r' history-incremental-search-backward
|
2013-08-02 13:23:37 -07:00
|
|
|
bindkey '^w' backward-kill-word
|
|
|
|
bindkey '^a' beginning-of-line
|
|
|
|
bindkey '^e' end-of-line
|
2013-08-04 02:04:37 -07:00
|
|
|
|
2014-07-21 00:08:01 -07:00
|
|
|
if ! [ "$EMACS" ]; then
|
|
|
|
bindkey ${terminfo[kdch1]} delete-char
|
|
|
|
|
|
|
|
# Switch between block and line cursor (Only in iterm)
|
|
|
|
if is_mac; then
|
|
|
|
function zle-keymap-select zle-line-init {
|
|
|
|
# change cursor shape in iTerm2
|
|
|
|
case $KEYMAP in
|
|
|
|
vicmd) print -n -- "\E]50;CursorShape=0\C-G";; # block cursor
|
|
|
|
viins|main) print -n -- "\E]50;CursorShape=1\C-G";; # line cursor
|
|
|
|
esac
|
|
|
|
|
|
|
|
zle reset-prompt
|
|
|
|
zle -R
|
|
|
|
}
|
|
|
|
|
|
|
|
function zle-line-finish {
|
|
|
|
print -n -- "\E]50;CursorShape=0\C-G" # block cursor
|
|
|
|
}
|
|
|
|
|
|
|
|
zle -N zle-line-init
|
|
|
|
zle -N zle-line-finish
|
|
|
|
zle -N zle-keymap-select
|
|
|
|
fi
|
2013-08-04 02:04:37 -07:00
|
|
|
fi
|
2013-08-02 13:23:37 -07:00
|
|
|
|
2014-07-17 01:26:38 -07:00
|
|
|
# Switch between block and line cursor (Only in iterm)
|
2014-03-29 14:56:33 -07:00
|
|
|
autoload colors
|
|
|
|
if [[ "$terminfo[colors]" -gt 8 ]]; then
|
|
|
|
colors
|
|
|
|
fi
|
|
|
|
for COLOR in RED GREEN YELLOW BLUE MAGENTA CYAN BLACK WHITE; do
|
|
|
|
eval $COLOR='$fg_no_bold[${(L)COLOR}]'
|
|
|
|
eval BOLD_$COLOR='$fg_bold[${(L)COLOR}]'
|
|
|
|
done
|
|
|
|
eval RESET='$reset_color'
|
|
|
|
|
2014-07-17 01:26:38 -07:00
|
|
|
# print -n -- "\E]50;CursorShape=1\C-G"
|