Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- cleaned up erroneous directories - partitioned out logic based on what was in zprezto already - just made it a lot cleaner
- Loading branch information
1 parent
5bee4a7
commit 117b891
Showing
55 changed files
with
545 additions
and
626 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,22 @@ | ||
# Profile reload | ||
alias reload!='. ~/.bashrc' | ||
|
||
alias ls="ls -FG" # ls with those helpful little trailing characters | ||
alias ll='ls -lh' # Lists human readable sizes. | ||
alias la='ll -A' # Lists human readable sizes, hidden files. | ||
alias lm='la | "$PAGER"' # Lists human readable sizes, hidden files through pager. | ||
alias lx='ll -XB' # Lists sorted by extension (GNU only). | ||
alias lk='ll -Sr' # Lists sorted by size, largest last. | ||
alias lt='ll -tr' # Lists sorted by date, most recent last. | ||
alias lc='lt -c' # Lists sorted by date, most recent last, shows change time. | ||
alias lu='lt -u' # Lists sorted by date, most recent last, shows access time. | ||
|
||
# Make e work for editor | ||
alias e='${VISUAL:-$EDITOR}' | ||
|
||
# Colorize grep | ||
alias grep='GREP_COLOR="1;37;45" LANG=C grep --color=auto' | ||
|
||
# Resource Usage | ||
alias df='df -kh' | ||
alias du='du -kh' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
|
||
if [ -f ~/.bashrc ]; then | ||
. ~/.bashrc | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,114 @@ | ||
RED="\e[0;31m" | ||
GREEN="\e[0;32m" | ||
YELLOW="\e[0;33m" | ||
BLUE="\e[0;34m" | ||
PURPLE="\e[0;35m" | ||
CYAN="\e[0;36m" | ||
WHITE="\e[0;37m" | ||
RESET="\e[0m" | ||
|
||
directory_name () { | ||
echo "\[$CYAN\]\w\[$RESET\]" | ||
} | ||
export PROMPT_COMMAND=__prompt_command | ||
|
||
username () { | ||
echo "\[$BLUE\]\u\[$RESET\]" | ||
# Returns prompt encoded color. | ||
# Takes 1 optional argument. | ||
# If argument is provided, return color prompt. If argument is omitted, return reset. | ||
get_prompt_color () { | ||
if [[ -n $1 ]]; then | ||
echo "\e[38;5;$1m" | ||
else | ||
echo '\e[0m' | ||
fi | ||
} | ||
|
||
hostname () { | ||
echo "\[$PURPLE\]\h\[$RESET\]" | ||
} | ||
# Memo-ized var | ||
SEPARATOR="" | ||
|
||
git_branch_name () { | ||
ref=$(git symbolic-ref HEAD 2>/dev/null) | ||
if [[ $ref == "" ]]; then | ||
echo "#$(git describe)" | ||
# Begin a segment | ||
# Takes two arguments, foreground and message. Foreground can be omitted, | ||
# rendering default foreground. | ||
prompt_segment () { | ||
local fg | ||
local message | ||
|
||
# If 2 params, 1st one is foreground | ||
if [[ -n $2 ]]; then | ||
# insert color supporting 256 colors | ||
fg="$(get_prompt_color $1)" | ||
message="$2" | ||
else | ||
echo "${ref#refs/heads/}" | ||
fg="$(get_prompt_color)" | ||
message="$1" | ||
fi | ||
} | ||
|
||
git_commit_hash () { | ||
echo "[$YELLOW$(git rev-parse --short HEAD)$RESET]" | ||
# color the prompt, spit out the message and reset the colors | ||
echo -n "$SEPARATOR$fg$message$(get_prompt_color)" | ||
|
||
# Let this run after the first run | ||
SEPARATOR=" " | ||
} | ||
|
||
git_branch () { | ||
st=$(git status 2>/dev/null | tail -n 1) | ||
if [[ $st == "" ]]; then | ||
echo "" | ||
else | ||
if [[ $st == "nothing to commit (working directory clean)" ]]; then | ||
echo -e " on $GREEN$(git_branch_name)$RESET$(git_commit_hash)" | ||
else | ||
echo -e " on $RED$(git_branch_name)$RESET$(git_commit_hash)" | ||
build_prompt () { | ||
local EXIT="$?" | ||
|
||
# If exit status is non-zero show an x in red | ||
if [ $EXIT != 0 ]; then | ||
prompt_segment 1 '✘' | ||
fi | ||
|
||
if [[ -n "$SSH_CONNECTION" ]]; then | ||
# username in blue | ||
prompt_segment 4 '\u' | ||
prompt_segment 'at' | ||
# hostname in magenta | ||
prompt_segment 5 '\h' | ||
prompt_segment 'in' | ||
fi | ||
|
||
# Working directory in cyan | ||
prompt_segment 6 '\w' | ||
|
||
# If in a git repo | ||
git_ref="$(git symbolic-ref HEAD 2>&1)" | ||
if [[ $git_ref != fatal* ]]; then | ||
# git branch in yellow and commit hash in default | ||
prompt_segment 3 "⭠ $(git_branch_name $git_ref) [$(get_prompt_color)$(git_commit_hash)$(get_prompt_color 3)]" | ||
|
||
# If git symbols has anything, show it in red | ||
local git_symbols="$(git_status)" | ||
if [[ $git_symbols != "" ]]; then | ||
prompt_segment 1 "$git_symbols" | ||
fi | ||
fi | ||
|
||
# cursor prompt in light blue | ||
prompt_segment 12 "\n❯ " | ||
} | ||
|
||
git_branch_name () { | ||
echo "${git_ref#refs/heads/}" | ||
} | ||
|
||
git_commit_hash () { | ||
echo "$(git rev-parse --short HEAD)" | ||
} | ||
|
||
if [[ -n "$SSH_CONNECTION" ]]; then | ||
export PS1="$(username) at $(hostname) in $(directory_name)\$(git_branch)\n› " | ||
else | ||
export PS1="in $(directory_name)\n› " | ||
fi | ||
git_status () { | ||
local symbols | ||
local git_st="$(git diff --name-status 2>&1)" | ||
|
||
# If untracked files | ||
[[ "$(git ls-files --others --exclude-standard $(git rev-parse --show-cdup))" != "" ]] && symbols+="?" | ||
|
||
export PS2="› " | ||
# If modified files | ||
[[ $(echo "$git_st" | egrep -c "^M") != 0 ]] && symbols+="✱" | ||
|
||
# If modified files | ||
[[ $(echo "$git_st" | egrep -c "^D") != 0 ]] && symbols+="✖" | ||
|
||
# If added files | ||
[[ "$(git diff --staged --name-status)" != "" ]] && symbols+="✚" | ||
|
||
# If stashed | ||
[[ "$(git stash list)" != "" ]] && symbols+="s" | ||
|
||
echo "$symbols" | ||
} | ||
|
||
# helper function | ||
count_lines() { echo "$1" | egrep -c "^$2" ; } | ||
|
||
__prompt_command () { | ||
export PS1="$(build_prompt)" | ||
export PS2="❯ " | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#Boot2Docker init | ||
$(boot2docker shellinit 2>/dev/null) |
Oops, something went wrong.