93 lines
2.1 KiB
Bash
Executable file
93 lines
2.1 KiB
Bash
Executable file
setopt EXTENDED_HISTORY
|
|
setopt HIST_EXPIRE_DUPS_FIRST
|
|
setopt HIST_IGNORE_DUPS
|
|
setopt HIST_IGNORE_ALL_DUPS
|
|
setopt HIST_IGNORE_SPACE
|
|
setopt HIST_FIND_NO_DUPS
|
|
setopt HIST_SAVE_NO_DUPS
|
|
setopt HIST_BEEP
|
|
|
|
autoload -Uz compinit
|
|
compinit
|
|
|
|
export LANG=zh_CN.UTF-8
|
|
|
|
export _JAVA_OPTIONS="-Dfile.encoding=UTF-8"
|
|
export JAVA_OPTS="-Dfile.encoding=UTF-8"
|
|
export JAVA_TOOLS_OPTIONS="-Dfile.encoding=UTF-8"
|
|
export MAVEN_OPTS="-Dfile.encoding=UTF-8"
|
|
|
|
export VAGRANT_PREFER_SYSTEM_BIN=1
|
|
|
|
# +---------+
|
|
# | ALIASES |
|
|
# +---------+
|
|
|
|
source $DOTFILES/aliases/aliases
|
|
|
|
|
|
# +-----------+
|
|
# | SSH_AGENT |
|
|
# +-----------+
|
|
|
|
env=/tmp/agent.env
|
|
|
|
agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; }
|
|
|
|
agent_start () {
|
|
(umask 077; ssh-agent >| "$env")
|
|
. "$env" >| /dev/null ; }
|
|
|
|
agent_load_env
|
|
|
|
# agent_run_state: 0=agent running w/ key; 1=agent w/o key; 2= agent not running
|
|
agent_run_state=$(ssh-add -l >| /dev/null 2>&1; echo $?)
|
|
|
|
if [ ! "$SSH_AUTH_SOCK" ] || [ $agent_run_state = 2 ]; then
|
|
agent_start
|
|
ssh-add
|
|
elif [ "$SSH_AUTH_SOCK" ] && [ $agent_run_state = 1 ]; then
|
|
ssh-add
|
|
fi
|
|
|
|
unset env
|
|
|
|
# +-----+
|
|
# | VIM |
|
|
# +-----+
|
|
|
|
# Vi mode
|
|
bindkey -v
|
|
export KEYTIMEOUT=1
|
|
|
|
# +--------+
|
|
# | PROMPT |
|
|
# +--------+
|
|
|
|
export PROMPT='%F{blue}(%n@%m)%f %~ %(!.#.$) '
|
|
|
|
# +-----------------+
|
|
# | auto-suggestion |
|
|
# +-----------------+
|
|
source $DOTFILES/zsh/plugins/autosuggestions/zsh-autosuggestions.zsh
|
|
|
|
# Better searching in command mode
|
|
bindkey -M vicmd '?' history-incremental-search-backward
|
|
bindkey -M vicmd '/' history-incremental-search-forward
|
|
|
|
# Beginning search with arrow keys
|
|
bindkey "^[OA" history-beginning-search-backward
|
|
bindkey "^[OB" history-beginning-search-forward
|
|
bindkey "^[[A" history-beginning-search-backward
|
|
bindkey "^[[B" history-beginning-search-forward
|
|
bindkey -M vicmd "k" history-beginning-search-backward
|
|
bindkey -M vicmd "j" history-beginning-search-forward
|
|
|
|
# Make Vi mode transitions faster (KEYTIMEOUT is in hundredths of a second)
|
|
export KEYTIMEOUT=1
|
|
|
|
bindkey "^R" history-incremental-search-backward
|
|
bindkey "^S" history-incremental-search-forward
|
|
|
|
test -f $ZDOTDIR/zshrc.local && . $ZDOTDIR/zshrc.local
|