You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
1.9 KiB
75 lines
1.9 KiB
7 years ago
|
#!/usr/bin/env bash
|
||
|
|
||
|
# Shell prompt based on the Solarized Dark theme.
|
||
|
# Screenshot: http://i.imgur.com/EkEtphC.png
|
||
|
# Heavily inspired by @necolas’s prompt: https://github.com/necolas/dotfiles
|
||
|
# iTerm → Profiles → Text → use 13pt Monaco with 1.1 vertical spacing.
|
||
|
|
||
|
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then
|
||
|
export TERM='gnome-256color';
|
||
|
elif infocmp xterm-256color >/dev/null 2>&1; then
|
||
|
export TERM='xterm-256color';
|
||
|
fi;
|
||
|
|
||
|
if tput setaf 1 &> /dev/null; then
|
||
|
tput sgr0; # reset colors
|
||
|
bold=$(tput bold);
|
||
|
reset=$(tput sgr0);
|
||
|
# Solarized colors, taken from http://git.io/solarized-colors.
|
||
|
black=$(tput setaf 0);
|
||
|
blue=$(tput setaf 33);
|
||
|
cyan=$(tput setaf 37);
|
||
|
green=$(tput setaf 64);
|
||
|
orange=$(tput setaf 166);
|
||
|
purple=$(tput setaf 125);
|
||
|
red=$(tput setaf 124);
|
||
|
violet=$(tput setaf 61);
|
||
|
white=$(tput setaf 15);
|
||
|
yellow=$(tput setaf 136);
|
||
|
else
|
||
|
bold='';
|
||
|
reset="\e[0m";
|
||
|
black="\e[1;30m";
|
||
|
red="\e[1;31m";
|
||
|
green="\e[1;32m";
|
||
|
orange="\e[1;33m";
|
||
|
yellow="\e[1;33m";
|
||
|
blue="\e[1;34m";
|
||
|
purple="\e[1;35m";
|
||
|
violet="\e[1;35m";
|
||
|
cyan="\e[1;36m";
|
||
|
white="\e[1;37m";
|
||
|
fi;
|
||
|
|
||
7 years ago
|
# Ravenna is cyan
|
||
|
userStyle="${cyan}"
|
||
7 years ago
|
|
||
|
# Highlight the hostname when connected via SSH.
|
||
|
if [[ "${SSH_TTY}" ]]; then
|
||
|
hostStyle="${bold}${userStyle}";
|
||
|
else
|
||
|
hostStyle="${userStyle}";
|
||
|
fi;
|
||
|
|
||
|
# Root username is red
|
||
|
if [[ "${USER}" == "root" ]]; then
|
||
|
userStyle="${red}";
|
||
|
fi;
|
||
|
|
||
|
# Set the terminal title and prompt.
|
||
|
PS1="\[\033]0;\W\007\]"; # working directory base name
|
||
|
PS1+="\[${bold}\]\n"; # newline
|
||
|
PS1+="\[${userStyle}\]\u"; # username
|
||
|
PS1+="\[${white}\] on ";
|
||
|
PS1+="\[${hostStyle}\]\h"; # host
|
||
|
PS1+="\[${white}\] at ";
|
||
|
PS1+="[ \D{%Y-%m-%d} - \t ] in "; # date and time stamp
|
||
|
#PS1+="\[${green}\]\w"; # working directory full path
|
||
|
PS1+="\w"; # working directory full path
|
||
|
PS1+="\n";
|
||
|
PS1+="\[${white}\]\$ \[${reset}\]"; # `$` (and reset color)
|
||
|
export PS1;
|
||
|
|
||
|
PS2="\[${yellow}\]→ \[${reset}\]";
|
||
|
export PS2;
|