码迷,mamicode.com
首页 > 其他好文 > 详细

.zsh配置

时间:2018-05-16 18:43:38      阅读:177      评论:0      收藏:0      [点我收藏+]

标签:time   like   %s   nbsp   idm   active   lib   enable   hang   

# Path to your oh-my-zsh installation.
export ZSH=/home/zcy/.oh-my-zsh

# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it‘ll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="re5et"

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"

# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"

#color{{{
autoload -U colors
colors
 
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
eval _$color=‘%{$terminfo[bold]$fg[${(L)color}]%}‘
eval $color=‘%{$fg[${(L)color}]%}‘
(( count = $count + 1 ))
done
FINISH="%{$terminfo[sgr0]%}"
#}}}
 
#命令提示符
RPROMPT=$(echo "$RED%D %T$FINISH")
PROMPT=$(echo "$CYAN%n@$YELLOW%M:$GREEN%/$_YELLOW>$FINISH ")


export EDITOR=vim

#为历史纪录中的命令添加时间戳
setopt EXTENDED_HISTORY      
 
#启用 cd 命令的历史纪录,cd -[TAB]进入历史路径
setopt AUTO_PUSHD
#相同的历史路径只保留一个
setopt PUSHD_IGNORE_DUPS


#自动补全功能 {{{
setopt AUTO_LIST
setopt AUTO_MENU
#开启此选项,补全时会直接选中菜单项
#setopt MENU_COMPLETE
 
autoload -U compinit
compinit
 
#自动补全缓存
#zstyle ‘:completion::complete:*‘ use-cache on
#zstyle ‘:completion::complete:*‘ cache-path .zcache
#zstyle ‘:completion:*:cd:*‘ ignore-parents parent pwd
 
#自动补全选项
zstyle ‘:completion:*‘ verbose yes
zstyle ‘:completion:*‘ menu select
zstyle ‘:completion:*:*:default‘ force-list always
zstyle ‘:completion:*‘ select-prompt ‘%SSelect:  lines: %L  matches: %M  [%p]‘
 
zstyle ‘:completion:*:match:*‘ original only
zstyle ‘:completion::prefix-1:*‘ completer _complete
zstyle ‘:completion:predict:*‘ completer _complete
zstyle ‘:completion:incremental:*‘ completer _complete _correct
zstyle ‘:completion:*‘ completer _complete _prefix _correct _prefix _match _approximate
 
#路径补全
zstyle ‘:completion:*‘ expand ‘yes‘
zstyle ‘:completion:*‘ squeeze-shlashes ‘yes‘
zstyle ‘:completion::complete:*‘ ‘\\‘
 
#彩色补全菜单
eval $(dircolors -b)
export ZLSCOLORS="${LS_COLORS}"
zmodload zsh/complist
zstyle ‘:completion:*‘ list-colors ${(s.:.)LS_COLORS}
zstyle ‘:completion:*:*:kill:*:processes‘ list-colors ‘=(#b) #([0-9]#)*=0=01;31‘
 
#修正大小写
zstyle ‘:completion:*‘ matcher-list ‘‘ ‘m:{a-zA-Z}={A-Za-z}‘
#错误校正
zstyle ‘:completion:*‘ completer _complete _match _approximate
zstyle ‘:completion:*:match:*‘ original only
zstyle ‘:completion:*:approximate:*‘ max-errors 1 numeric

# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
setopt extended_glob
 TOKENS_FOLLOWED_BY_COMMANDS=(‘|‘ ‘||‘ ‘;‘ ‘&‘ ‘&&‘ ‘sudo‘ ‘do‘ ‘time‘ ‘strace‘)
 
 recolor-cmd() {
     region_highlight=()
     colorize=true
     start_pos=0
     for arg in ${(z)BUFFER}; do
         ((start_pos+=${#BUFFER[$start_pos+1,-1]}-${#${BUFFER[$start_pos+1,-1]## #}}))
         ((end_pos=$start_pos+${#arg}))
         if $colorize; then
             colorize=false
             res=$(LC_ALL=C builtin type $arg 2>/dev/null)
             case $res in
                 *‘reserved word‘*)   style="fg=magenta,bold";;
                 *‘alias for‘*)       style="fg=cyan,bold";;
                 *‘shell builtin‘*)   style="fg=yellow,bold";;
                 *‘shell function‘*)  style=‘fg=green,bold‘;;
                 *"$arg is"*)
                     [[ $arg = ‘sudo‘ ]] && style="fg=red,bold" || style="fg=blue,bold";;
                 *)                   style=‘none,bold‘;;
             esac
             region_highlight+=("$start_pos $end_pos $style")
         fi
         [[ ${${TOKENS_FOLLOWED_BY_COMMANDS[(r)${arg//|/\|}]}:+yes} = ‘yes‘ ]] && colorize=true
         start_pos=$end_pos
     done
 }
check-cmd-self-insert() { zle .self-insert && recolor-cmd }
 check-cmd-backward-delete-char() { zle .backward-delete-char && recolor-cmd }
 
 zle -N self-insert check-cmd-self-insert
 zle -N backward-delete-char check-cmd-backward-delete-char
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13

# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.

#其中incr,放在.oh-my-zsh/plugins/,或.oh-my-zsh/custom/plugins/中
plugins=(git zsh-syntax-highlighting incr)

# User configuration

export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:usr/local/java/jdk1.8.0_65/bin:/usr/local/apache-maven-3.3.9/bin"
# export MANPATH="/usr/local/man:$MANPATH"
export LD_LIBRARY_PATH="/usr/local/lib"
export MAVEN_HOME="/usr/local/apache-maven-3.3.9/bin"
export PROTOBUF_HOME="/usr/bin/protoc"
export FLATBUFFER_HOME="/usr/local/bin/flatc"

source $ZSH/oh-my-zsh.sh

zstyle ‘:completion::approximate:‘ max-errors 1 numeric

# You may need to manually set your language environment
# export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
#   export EDITOR=‘vim‘
# else
#   export EDITOR=‘mvim‘
# fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# ssh
# export SSH_KEY_PATH="~/.ssh/dsa_id"

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"


alias ..=‘cd ..‘
alias vi=‘vim‘
alias his=‘history‘
alias gs=‘git status‘
alias ga=‘git add‘
alias gd=‘git diff‘
alias gc=‘git checkout‘
alias gm=‘git commit -m‘
alias gpush=‘git push origin‘
alias gpull=‘git pull origin‘
alias cdthrift=‘/home/zcy/work/01_src/thrift-0.9.1/lib/cpp/src/thrift‘
alias cdw=‘cd /home/zcy/work‘
alias py=‘cd /home/zcy/work/01_src/pengyun-main‘
alias pyb=‘cd /home/zcy/work/03_srcbac/pengyun-main‘
alias Mvn=‘mvn clean install -DskipTests -Dproguard=off‘
alias Mvnp=‘mvn clean install -DskipTests -Dproguard=on‘
alias mci=‘mvn clean install -Dproguard=off‘
alias al=‘vim /home/zcy/.zshrc‘
alias ue=‘rm -rf ~/.idm/uex/*.*|rm -rf ~/.idm/uex/.dat |/usr/local/bin/uex &‘


alias vm0=‘ssh root@192.168.2.10‘
alias vm1=‘ssh root@192.168.2.11‘
alias vm2=‘ssh root@192.168.2.12‘
alias vm3=‘ssh root@192.168.2.13‘
alias vm4=‘ssh root@192.168.2.14‘

.zsh配置

标签:time   like   %s   nbsp   idm   active   lib   enable   hang   

原文地址:https://www.cnblogs.com/zhchy89/p/9046979.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!