Add custom prompt
This commit is contained in:
parent
3f577e7682
commit
ae55c23997
2 changed files with 62 additions and 42 deletions
55
.zsh/atomaka.zsh-theme
Normal file
55
.zsh/atomaka.zsh-theme
Normal file
|
@ -0,0 +1,55 @@
|
|||
# ZSH Theme - Preview: ADD PREVIEW
|
||||
# Based on bira theme. Based on gnzh.
|
||||
|
||||
# load some modules
|
||||
autoload -U colors zsh/terminfo # Used in the colour alias below
|
||||
colors
|
||||
setopt prompt_subst
|
||||
|
||||
# make some aliases for the colours: (coud use normal escap.seq's too)
|
||||
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GRAY; do
|
||||
eval PR_$color='%{$fg[${(L)color}]%}'
|
||||
done
|
||||
eval PR_NO_COLOR="%{$terminfo[sgr0]%}"
|
||||
eval PR_BOLD="%{$terminfo[bold]%}"
|
||||
|
||||
# Check the UID
|
||||
if [[ $UID -ge 1000 ]]; then # normal user
|
||||
eval PR_USER='${PR_GREEN}%n${PR_NO_COLOR}'
|
||||
eval PR_USER_OP='${PR_GREEN}%#${PR_NO_COLOR}'
|
||||
elif [[ $UID -eq 0 ]]; then # root
|
||||
eval PR_USER='${PR_RED}%n${PR_NO_COLOR}'
|
||||
eval PR_USER_OP='${PR_RED}%#${PR_NO_COLOR}'
|
||||
fi
|
||||
|
||||
# Check if we are on SSH or not
|
||||
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
|
||||
eval PR_HOST='${PR_YELLOW}%M${PR_NO_COLOR}' #SSH
|
||||
else
|
||||
eval PR_HOST='${PR_GREEN}%M${PR_NO_COLOR}' # no SSH
|
||||
fi
|
||||
|
||||
|
||||
local PR_PROMPT="%(?.$PR_GREEN->.$PR_RED->%{%})$PR_NO_COLOR"
|
||||
local return_code="%(?..%{$PR_RED%}%?%{$PR_NO_COLOR%})"
|
||||
|
||||
local current_time="[$PR_BOLD%D{%I:%M:%S}$PR_NO_COLOR]"
|
||||
local user_host='${PR_USER}${PR_CYAN}@${PR_HOST}'
|
||||
local current_dir='%{$PR_BOLD$PR_BLUE%}%~%{$PR_NO_COLOR%}'
|
||||
local rvm_ruby=''
|
||||
if which rvm-prompt &> /dev/null; then
|
||||
rvm_ruby='%{$PR_RED%}‹$(rvm-prompt i v g s)›%{$PR_NO_COLOR%}'
|
||||
else
|
||||
if which rbenv &> /dev/null; then
|
||||
rvm_ruby='%{$PR_RED%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$PR_NO_COLOR%}'
|
||||
fi
|
||||
fi
|
||||
local git_branch='$(git_prompt_info)%{$PR_NO_COLOR%}'
|
||||
|
||||
#PROMPT="${user_host} ${current_dir} ${rvm_ruby} ${git_branch}$PR_PROMPT "
|
||||
PROMPT="${current_time} ${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
|
||||
|$PR_PROMPT "
|
||||
RPS1="${return_code}"
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$PR_YELLOW%}‹"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$PR_NO_COLOR%}"
|
49
.zshrc
49
.zshrc
|
@ -1,11 +1,8 @@
|
|||
# Path to your oh-my-zsh configuration.
|
||||
# home bin directory
|
||||
ZSH=$HOME/.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="gnzh"
|
||||
# custom directory to load .oh-my-zsh files from
|
||||
ZSH_CUSTOM="$HOME/.zsh"
|
||||
ZSH_THEME="atomaka" # gnzh, candy, crunch, geoffgarside, macovsky
|
||||
|
||||
PATH="$HOME/bin:$PATH"
|
||||
|
||||
|
@ -18,6 +15,7 @@ else
|
|||
fi
|
||||
fi
|
||||
|
||||
# add path to newer bins on cse servers (github/rmblair)
|
||||
if test -d /soft/linux/pkg/bin ; then
|
||||
export PATH=/soft/linux/pkg/bin:${PATH};
|
||||
export PATH=/soft/lus/linux/vim/7.4-$(uname -m)/bin:$PATH;
|
||||
|
@ -37,36 +35,6 @@ SAVEHIST=20000
|
|||
stty start undef
|
||||
stty stop undef
|
||||
|
||||
# Example aliases
|
||||
# alias zshconfig="mate ~/.zshrc"
|
||||
# alias ohmyzsh="mate ~/.oh-my-zsh"
|
||||
|
||||
# Set to this to use case-sensitive completion
|
||||
# CASE_SENSITIVE="true"
|
||||
|
||||
# Comment this out to disable bi-weekly auto-update checks
|
||||
# DISABLE_AUTO_UPDATE="true"
|
||||
|
||||
# Uncomment to change how often before auto-updates occur? (in days)
|
||||
# export UPDATE_ZSH_DAYS=13
|
||||
|
||||
# Uncomment following line if you want to disable colors in ls
|
||||
# DISABLE_LS_COLORS="true"
|
||||
|
||||
# Uncomment following line if you want to disable autosetting terminal title.
|
||||
# DISABLE_AUTO_TITLE="true"
|
||||
|
||||
# Uncomment following line if you want to disable command autocorrection
|
||||
# DISABLE_CORRECTION="true"
|
||||
|
||||
# Uncomment following line if you want red dots to be displayed while waiting for completion
|
||||
# COMPLETION_WAITING_DOTS="true"
|
||||
|
||||
# Uncomment 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"
|
||||
|
||||
# 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)
|
||||
|
@ -78,11 +46,6 @@ source $ZSH/oh-my-zsh.sh
|
|||
source $HOME/.aliases
|
||||
source $HOME/.functions
|
||||
|
||||
# Add personal bin folder
|
||||
PATH=$PATH:$HOME/bin
|
||||
|
||||
# Customize to your needs...
|
||||
|
||||
# Bind insert_sudo function
|
||||
zle -N insert-sudo
|
||||
bindkey "^z" insert-sudo
|
||||
|
@ -92,8 +55,10 @@ if [ $TERM="xterm" ]; then
|
|||
export TERM=xterm-256color
|
||||
fi
|
||||
|
||||
# default editor is vim
|
||||
export EDITOR='vim'
|
||||
|
||||
# init rbenv
|
||||
if [[ "$OSTYPE" == darwin* ]]; then
|
||||
source /opt/boxen/env.sh
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue