站点更新:2018-11-13 18:58:18
This commit is contained in:
parent
20557604de
commit
0302c99abd
53
config/gnzh.zsh-theme
Normal file
53
config/gnzh.zsh-theme
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
# Based on bira theme
|
||||||
|
|
||||||
|
setopt prompt_subst
|
||||||
|
|
||||||
|
() {
|
||||||
|
|
||||||
|
local PR_USER PR_USER_OP PR_PROMPT PR_HOST
|
||||||
|
|
||||||
|
# Check the UID
|
||||||
|
if [[ $UID -ne 0 ]]; then # normal user
|
||||||
|
PR_USER='%F{green}%n%f'
|
||||||
|
PR_USER_OP='%F{green}%#%f'
|
||||||
|
PR_PROMPT='%f> %f'
|
||||||
|
else # root
|
||||||
|
PR_USER='%F{yellow}%n%f'
|
||||||
|
PR_USER_OP='%F{yellow}%#%f'
|
||||||
|
PR_PROMPT='%f> %f'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if we are on SSH or not
|
||||||
|
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
|
||||||
|
PR_HOST='%F{red}%M%f' # SSH
|
||||||
|
else
|
||||||
|
PR_HOST='%F{green}%M%f' # no SSH
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
local return_code="%(?..%F{red}%? ↵%f)"
|
||||||
|
|
||||||
|
local user_host="${PR_USER}%F{cyan}@${PR_HOST}"
|
||||||
|
local current_dir="%B%F{blue}%~%f%b"
|
||||||
|
local rvm_ruby=''
|
||||||
|
if ${HOME}/.rvm/bin/rvm-prompt &> /dev/null; then # detect user-local rvm installation
|
||||||
|
rvm_ruby='%F{red}‹$(${HOME}/.rvm/bin/rvm-prompt i v g s)›%f'
|
||||||
|
elif which rvm-prompt &> /dev/null; then # detect system-wide rvm installation
|
||||||
|
rvm_ruby='%F{red}‹$(rvm-prompt i v g s)›%f'
|
||||||
|
elif which rbenv &> /dev/null; then # detect Simple Ruby Version Management
|
||||||
|
rvm_ruby='%F{red}‹$(rbenv version | sed -e "s/ (set.*$//")›%f'
|
||||||
|
fi
|
||||||
|
|
||||||
|
local git_branch='$(git_prompt_info)'
|
||||||
|
|
||||||
|
PROMPT="╭─${user_host} ${current_dir} [%*] ${git_branch} ${rvm_ruby}
|
||||||
|
╰─$PR_PROMPT"
|
||||||
|
RPROMPT="${return_code}"
|
||||||
|
|
||||||
|
ZSH_THEME_GIT_PROMPT_PREFIX="%F{green}("
|
||||||
|
#ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}‹"
|
||||||
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%F{green})"
|
||||||
|
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}x"
|
||||||
|
ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}o"
|
||||||
|
|
||||||
|
}
|
@ -28,6 +28,7 @@ git clone https://github.com/zsh-users/zsh-history-substring-search.git /root/.o
|
|||||||
echo -e "\033[1;33mConfig oh-my-zsh...\033[0m"
|
echo -e "\033[1;33mConfig oh-my-zsh...\033[0m"
|
||||||
cp -f /vagrant/config/zshrc ~/.zshrc
|
cp -f /vagrant/config/zshrc ~/.zshrc
|
||||||
cp -f /vagrant/config/my.zsh ~/.oh-my-zsh/custom/
|
cp -f /vagrant/config/my.zsh ~/.oh-my-zsh/custom/
|
||||||
|
cp -f /vagrant/config/gnzh.zsh-theme ~/.oh-my-zsh/themes/
|
||||||
|
|
||||||
echo -e "\033[1;33mConfig ssh...\033[0m"
|
echo -e "\033[1;33mConfig ssh...\033[0m"
|
||||||
mkdir -p ~/.ssh && cat /vagrant/config/authorized.key >> ~/.ssh/authorized_keys
|
mkdir -p ~/.ssh && cat /vagrant/config/authorized.key >> ~/.ssh/authorized_keys
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
export ZSH=~/.oh-my-zsh
|
export ZSH=~/.oh-my-zsh
|
||||||
|
|
||||||
ZSH_THEME="robbyrussell"
|
ZSH_THEME="gnzh"
|
||||||
|
|
||||||
plugins=(git wd sudo zsh-syntax-highlighting zsh-autosuggestions extract history-substring-search)
|
plugins=(git wd sudo zsh-syntax-highlighting zsh-autosuggestions extract history-substring-search)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user