ohmyzsh linux 推荐使用
http://ohmyz.sh/
安装 :
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
注:
[root@x ~]# sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" Zsh is not installed! Please install zsh first! [root@x ~]# yum install zsh [root@x ~]# sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
优化美化配置:
安装命令建议: 安装后会自动命令提示:如图:
git clone git://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
vim ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
修改:
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'
为:
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=cyan'
修改命令行提示, 添加当前路径:
vim ~/.oh-my-zsh/themes/robbyrussell.zsh-theme
写入:
function git_prompt_info() { local ref if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" != "1" ]]; then ref=$(command git symbolic-ref HEAD 2> /dev/null) || \ ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0 echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$ZSH_THEME_GIT_PROMPT_DIRTY " fi } local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )" local pwd="%{$fg[yellow]%}%~%{$reset_color%}" local host="%{$fg[cyan]%}@${host_repr[$HOST]:-$HOST}%{$fg[cyan]%}%{$reset_color%}" local user="%(!.%{$fg[cyan]%}.%{$fg[cyan]%})%n%{$reset_color%}" #ZSH_THEME_CURRENT_DATE=`date +%Y-%m-%d` ZSH_THEME_IP=`ifconfig eth0|grep 'inet addr'|cut -d ":" -f2|cut -d " " -f1` PROMPT='%{$fg[yellow]%}[$ZSH_THEME_IP]${user}${host} ${ret_status} ${pwd} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)%{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗" ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
ZSH 启动配置:
vim ~/.zshrc
修改zsh模板:
ZSH_THEME="robbyrussell"
添加以下相关启动命令:
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh HISTSIZE=9000000 SAVEHIST=9000000 alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' alias grep='grep --color=auto'
yum install zsh -y sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" git clone git://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh cat <<EOF >> ~/.zshrc export EDITOR=/usr/bin/vim source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh HISTSIZE=9000000 SAVEHIST=9000000 alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' alias grep='grep --color=auto' alias tmuxls='tmux ls' alias tmuxa='tmux attach-session -t ' EOF