mirror of
https://github.com/kremalicious/dotfiles.git
synced 2024-11-22 01:37:14 +01:00
reorg, switch to different bash_prompt
This commit is contained in:
parent
382fb6ade9
commit
2509c1327d
14
bash_profile
14
bash_profile
@ -28,8 +28,18 @@ unset MAILCHECK
|
||||
# PATH
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
PATH="$PATH:/usr/local/sbin:/usr/sbin:/sbin"
|
||||
PATH="/usr/local/bin:/usr/local/mysql/bin:$PATH"
|
||||
PATH="$PATH:/usr/local/sbin:/usr/sbin:/sbin";
|
||||
|
||||
# if these bins exist, then add them to the PATH
|
||||
# Android SDK
|
||||
ANDROID_HOME="/usr/local/Cellar/android-sdk/r18"
|
||||
[ -d "$ANDROID_HOME" ] && PATH="$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools";
|
||||
|
||||
# add to beginning of PATH so that it always take precedence over /usr/bin
|
||||
[ -d "/usr/local/bin" ] && PATH="/usr/local/bin:$PATH";
|
||||
[ -d "/usr/local/mysql/bin" ] && PATH="/usr/local/mysql/bin:$PATH";
|
||||
|
||||
export PATH
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# ALIASES
|
||||
|
117
bash_prompt
117
bash_prompt
@ -1,86 +1,59 @@
|
||||
########################################################################
|
||||
# bash_prompt, from @necolas
|
||||
# https://github.com/necolas/dotfiles/blob/master/bash/bash_prompt
|
||||
# bash_prompt, from @mathiasbynens
|
||||
# https://github.com/mathiasbynens/dotfiles/blob/master/.bash_prompt
|
||||
########################################################################
|
||||
|
||||
# Based on @gf3’s Sexy Bash Prompt: https://github.com/gf3/dotfiles
|
||||
# iTerm2 prefs: import Solarized theme (disable bright colors for bold text)
|
||||
# Color ref: http://vim.wikia.com/wiki/Xterm256_color_names_for_console_Vim
|
||||
# More tips: http://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html
|
||||
# Screenshot: http://i.imgur.com/DSJ1G.png
|
||||
# @gf3’s Sexy Bash Prompt, inspired by “Extravagant Zsh Prompt”
|
||||
# Shamelessly copied from https://github.com/gf3/dotfiles
|
||||
# Screenshot: http://i.imgur.com/s0Blh.png
|
||||
|
||||
# Example:
|
||||
# nicolas@host: ~/.dotfiles on master[!?]
|
||||
# $
|
||||
|
||||
# Check that terminfo exists before changing TERM var to xterm-256color
|
||||
# Prevents prompt flashing in Mac OS X 10.6 Terminal.app
|
||||
if [ -e /usr/share/terminfo/x/xterm-256color ]; then
|
||||
export TERM='xterm-256color'
|
||||
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
|
||||
|
||||
tput sgr 0 0
|
||||
|
||||
# Base styles and color palette
|
||||
# Solarized colors
|
||||
# https://github.com/altercation/solarized/tree/master/iterm2-colors-solarized
|
||||
if tput setaf 1 &> /dev/null; then
|
||||
tput sgr0
|
||||
if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then
|
||||
MAGENTA=$(tput setaf 9)
|
||||
ORANGE=$(tput setaf 172)
|
||||
GREEN=$(tput setaf 190)
|
||||
PURPLE=$(tput setaf 141)
|
||||
WHITE=$(tput setaf 256)
|
||||
else
|
||||
MAGENTA=$(tput setaf 5)
|
||||
ORANGE=$(tput setaf 4)
|
||||
GREEN=$(tput setaf 2)
|
||||
PURPLE=$(tput setaf 1)
|
||||
WHITE=$(tput setaf 7)
|
||||
fi
|
||||
BOLD=$(tput bold)
|
||||
RESET=$(tput sgr0)
|
||||
SOLAR_YELLOW=$(tput setaf 136)
|
||||
SOLAR_ORANGE=$(tput setaf 166)
|
||||
SOLAR_RED=$(tput setaf 124)
|
||||
SOLAR_MAGENTA=$(tput setaf 125)
|
||||
SOLAR_VIOLET=$(tput setaf 61)
|
||||
SOLAR_BLUE=$(tput setaf 33)
|
||||
SOLAR_CYAN=$(tput setaf 37)
|
||||
SOLAR_GREEN=$(tput setaf 64)
|
||||
SOLAR_WHITE=$(tput setaf 254)
|
||||
|
||||
style_user="\[${RESET}${SOLAR_ORANGE}\]"
|
||||
style_host="\[${RESET}${SOLAR_YELLOW}\]"
|
||||
style_path="\[${RESET}${SOLAR_GREEN}\]"
|
||||
style_chars="\[${RESET}${SOLAR_WHITE}\]"
|
||||
style_branch="${SOLAR_CYAN}"
|
||||
|
||||
if [[ "$SSH_TTY" ]]; then
|
||||
# connected via ssh
|
||||
style_host="\[${BOLD}${SOLAR_RED}\]"
|
||||
elif [[ "$USER" == "root" ]]; then
|
||||
# logged in as root
|
||||
style_user="\[${BOLD}${SOLAR_RED}\]"
|
||||
else
|
||||
MAGENTA="\033[1;31m"
|
||||
ORANGE="\033[1;33m"
|
||||
GREEN="\033[1;32m"
|
||||
PURPLE="\033[1;35m"
|
||||
WHITE="\033[1;37m"
|
||||
BOLD=""
|
||||
RESET="\033[m"
|
||||
fi
|
||||
|
||||
export MAGENTA
|
||||
export ORANGE
|
||||
export GREEN
|
||||
export PURPLE
|
||||
export WHITE
|
||||
export BOLD
|
||||
export RESET
|
||||
|
||||
# Git status.
|
||||
# Adapted from: https://github.com/cowboy/dotfiles/
|
||||
function prompt_git() {
|
||||
local status output flags
|
||||
status="$(git status 2>/dev/null)"
|
||||
[[ $? != 0 ]] && return;
|
||||
output="$(echo "$status" | awk '/# Initial commit/ {print "(init)"}')"
|
||||
[[ "$output" ]] || output="$(echo "$status" | awk '/# On branch/ {print $4}')"
|
||||
[[ "$output" ]] || output="$(git branch | perl -ne '/^\* (.*)/ && print $1')"
|
||||
flags="$(
|
||||
echo "$status" | awk 'BEGIN {r=""} \
|
||||
/^# Changes to be committed:$/ {r=r "+"}\
|
||||
/^# Changes not staged for commit:$/ {r=r "!"}\
|
||||
/^# Untracked files:$/ {r=r "?"}\
|
||||
END {print r}'
|
||||
)"
|
||||
if [[ "$flags" ]]; then
|
||||
output="$output[$flags]"
|
||||
fi
|
||||
echo -ne "${SOLAR_WHITE} on ${style_branch}${output}"
|
||||
function parse_git_dirty() {
|
||||
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
|
||||
}
|
||||
|
||||
function parse_git_branch() {
|
||||
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/"
|
||||
}
|
||||
|
||||
# Build the prompt
|
||||
PS1="\n" # Newline
|
||||
PS1+="${style_user}\u" # Username
|
||||
PS1+="${style_chars}@" # @
|
||||
PS1+="${style_host}\h" # Host
|
||||
PS1+="${style_chars}: " # :
|
||||
PS1+="${style_path}\w" # Working directory
|
||||
PS1+="\$(prompt_git)" # Git details
|
||||
PS1+="\n" # Newline
|
||||
PS1+="${style_chars}\$ \[${RESET}\]" # $ (and reset color)
|
||||
PS1="\[${BOLD}${MAGENTA}\]\u \[$WHITE\]at \[$ORANGE\]\h \[$WHITE\]in \[$GREEN\]\w\[$WHITE\]\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on \")\[$PURPLE\]\$(parse_git_branch)\[$WHITE\]\n\$ \[$RESET\]"
|
10
brew
Normal file
10
brew
Normal file
@ -0,0 +1,10 @@
|
||||
# Make sure we’re using the latest Homebrew
|
||||
brew update
|
||||
|
||||
# Upgrade any already-installed formulae
|
||||
brew upgrade
|
||||
|
||||
# Install what we need
|
||||
brew install git
|
||||
brew install node
|
||||
brew install android
|
2
make.sh
2
make.sh
@ -14,7 +14,7 @@
|
||||
# dotfiles directory
|
||||
dir=~/.dotfiles
|
||||
# list of files/folders to symlink in homedir
|
||||
files="bash_profile bash_prompt gitconfig gitignore_global hushlogin private"
|
||||
files="bashrc bash_profile bash_prompt gitconfig gitignore_global hushlogin private"
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# change to the dotfiles directory
|
||||
|
@ -1,5 +1,3 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# OS X defaults
|
||||
#
|
||||
# most of it taken from @mathiasbynens
|
@ -14,7 +14,7 @@
|
||||
# dotfiles directory
|
||||
dir=~/.dotfiles
|
||||
# list of files/folders to symlink in homedir
|
||||
files="bash_profile bash_prompt gitconfig gitignore_global hushlogin private"
|
||||
files="bashrc bash_profile bash_prompt gitconfig gitignore_global hushlogin private"
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# change to the dotfiles directory
|
||||
|
Loading…
Reference in New Issue
Block a user