Skip to content

Commit

Permalink
Merge pull request #102 from benknoble/dev-1.3
Browse files Browse the repository at this point in the history
Dev 1.3 finished
  • Loading branch information
benknoble committed Sep 9, 2017
2 parents 5685f8d + f750190 commit 12849e4
Show file tree
Hide file tree
Showing 29 changed files with 393 additions and 527 deletions.
56 changes: 56 additions & 0 deletions Brewfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
tap "caskroom/cask"
tap "homebrew/bundle"
tap "homebrew/core"
tap "homebrew/science"
cask "xquartz"
brew "archey"
brew "autoconf"
brew "automake"
brew "bash"
brew "bash-completion@2"
brew "brew-cask-completion"
brew "coreutils"
brew "cowsay"
brew "ctags"
brew "figlet"
brew "findutils"
brew "fortune"
brew "gdbm"
brew "perl"
brew "git"
brew "gnu-sed"
brew "hub"
brew "libgpg-error"
brew "libksba"
brew "libtool"
brew "libyaml"
brew "lolcat"
brew "make"
brew "moreutils"
brew "nethack"
brew "openssl"
brew "pkg-config"
brew "sqlite"
brew "python3"
brew "ponysay"
brew "proselint"
brew "pstree"
brew "pv"
brew "python"
brew "ruby"
brew "scala", args: ["with-docs"]
brew "shellcheck"
brew "smlnj"
brew "tree"
brew "unrar"
brew "vim"
cask "cmake"
cask "daisydisk"
cask "gitter"
cask "inform"
cask "mactex"
cask "mono-mdk"
cask "runescape"
cask "skype"
cask "visual-studio"
cask "zoom"
200 changes: 100 additions & 100 deletions bash/PS1.bash
Original file line number Diff line number Diff line change
Expand Up @@ -12,83 +12,83 @@ _exit=0
# toggle functions

function _toggle_date {
if [[ "$_show_date" = "$_value_on" ]]; then
_show_date="$_value_off"
else
_show_date="$_value_on"
fi
if [[ "$_show_date" = "$_value_on" ]]; then
_show_date="$_value_off"
else
_show_date="$_value_on"
fi
}

function _toggle_user {
if [[ "$_show_user" = "$_value_on" ]]; then
_show_user="$_value_off"
else
_show_user="$_value_on"
fi
if [[ "$_show_user" = "$_value_on" ]]; then
_show_user="$_value_off"
else
_show_user="$_value_on"
fi
}

function _toggle_host {
if [[ "$_show_host" = "$_value_on" ]]; then
_show_host="$_value_off"
else
_show_host="$_value_on"
fi
if [[ "$_show_host" = "$_value_on" ]]; then
_show_host="$_value_off"
else
_show_host="$_value_on"
fi
}

function _toggle_jobs {
if [[ "$_show_jobs" = "$_value_on" ]]; then
_show_jobs="$_value_off"
else
_show_jobs="$_value_on"
fi
if [[ "$_show_jobs" = "$_value_on" ]]; then
_show_jobs="$_value_off"
else
_show_jobs="$_value_on"
fi
}

function _toggle_tty {
if [[ "$_show_tty" = "$_value_on" ]]; then
_show_tty="$_value_off"
else
_show_tty="$_value_on"
fi
if [[ "$_show_tty" = "$_value_on" ]]; then
_show_tty="$_value_off"
else
_show_tty="$_value_on"
fi
}

function _toggle_shell_name {
if [[ "$_show_shell_name" = "$_value_on" ]]; then
_show_shell_name="$_value_off"
else
_show_shell_name="$_value_on"
fi
if [[ "$_show_shell_name" = "$_value_on" ]]; then
_show_shell_name="$_value_off"
else
_show_shell_name="$_value_on"
fi
}

function _toggle_time {
if [[ "$_show_time" = "$_value_on" ]]; then
_show_time="$_value_off"
else
_show_time="$_value_on"
fi
if [[ "$_show_time" = "$_value_on" ]]; then
_show_time="$_value_off"
else
_show_time="$_value_on"
fi
}

function _toggle_dir {
if [[ "$_show_dir" = "$_value_on" ]]; then
_show_dir="$_value_off"
else
_show_dir="$_value_on"
fi
if [[ "$_show_dir" = "$_value_on" ]]; then
_show_dir="$_value_off"
else
_show_dir="$_value_on"
fi
}

function _toggle_history {
if [[ "$_show_history" = "$_value_on" ]]; then
_show_history="$_value_off"
else
_show_history="$_value_on"
fi
if [[ "$_show_history" = "$_value_on" ]]; then
_show_history="$_value_off"
else
_show_history="$_value_on"
fi
}

function _dirtrim {
if [[ -z "$1" ]]; then
PROMPT_DIRTRIM=2
else
PROMPT_DIRTRIM="$1"
fi
if [[ -z "$1" ]]; then
PROMPT_DIRTRIM=2
else
PROMPT_DIRTRIM="$1"
fi
}
# toggle vars

Expand All @@ -105,81 +105,81 @@ _show_history="$_value_on"
# display functions

function _date_prompt {
if [[ "$_show_date" = "$_value_on" ]]; then
echo '\D{%e %B %Y} '
fi
if [[ "$_show_date" = "$_value_on" ]]; then
echo '\D{%e %B %Y} '
fi
}

function _user_prompt {
if [[ "$_show_user" = "$_value_on" ]]; then
if [[ "$_show_host" = "$_value_on" ]]; then
echo '\u @ \h '
else
echo '\u '
fi
if [[ "$_show_user" = "$_value_on" ]]; then
if [[ "$_show_host" = "$_value_on" ]]; then
echo '\u @ \h '
else
echo '\u '
fi
fi
}

function _jobs_prompt {
if [[ "$_show_jobs" = "$_value_on" ]]; then
echo '{\jj} '
fi
if [[ "$_show_jobs" = "$_value_on" ]]; then
echo '{\jj} '
fi
}

function _tty_prompt {
if [[ "$_show_tty" = "$_value_on" ]]; then
echo '\l '
fi
if [[ "$_show_tty" = "$_value_on" ]]; then
echo '\l '
fi
}

function _shell_name_prompt {
if [[ "$_show_shell_name" = "$_value_on" ]]; then
echo '\s-\V '
fi
if [[ "$_show_shell_name" = "$_value_on" ]]; then
echo '\s-\V '
fi
}

function _time_prompt {
if [[ "$_show_time" = "$_value_on" ]]; then
echo '\t⧖ '
fi
if [[ "$_show_time" = "$_value_on" ]]; then
echo '\t⧖ '
fi
}

function _dir_prompt {
if [[ "$_show_dir" = "$_value_on" ]]; then
echo '∈\w '
fi
if [[ "$_show_dir" = "$_value_on" ]]; then
echo '∈\w '
fi
}

function _history_prompt {
if [[ "$_show_history" = "$_value_on" ]]; then
echo '#\! '
fi
if [[ "$_show_history" = "$_value_on" ]]; then
echo '#\! '
fi
}

# build PS1

function _build_PS1 {
_exit="$?"
local highlight
local exit_sym
local cols=$(tput cols)
local p=""
local len=0
local newline=""

if [[ "$_exit" = "0" ]]; then
highlight="$BGreen"
exit_sym=''
else
highlight="$BRed"
exit_sym="$_exit"
fi

p="$(_time_prompt)$(_date_prompt)$(_jobs_prompt)$(_history_prompt)$exit_sym $(_tty_prompt)$(_shell_name_prompt)$(_user_prompt)$(_dir_prompt)\$("$__gps1")"'\$ '
len=$(echo "${p@P}" | wc -m)
if [[ "$len" -gt $(($cols / 2)) ]]; then
newline=$'\n'
fi

PS1="$CS$Yellow$CE$(_time_prompt)$(_date_prompt)$CS$NC$CE$CS$BGreen$CE$(_jobs_prompt)$CS$NC$CE$CS$BMagenta$CE$(_history_prompt)$CS$NC$CE$CS$highlight$CE$exit_sym$CS$NC$CE $CS$Green$CE$(_tty_prompt)$(_shell_name_prompt)$CS$NC$CE$(_user_prompt)$CS$BCyan$CE$(_dir_prompt)$CS$NC$CE$CS$BYellow$CE\$("$__gps1")$CS$NC$CE$newline"'\$ '
_exit="$?"
local highlight
local exit_sym
local cols=$(tput cols)
local p=""
local len=0
local newline=""

if [[ "$_exit" = "0" ]]; then
highlight="$BGreen"
exit_sym=''
else
highlight="$BRed"
exit_sym="$_exit"
fi

p="$(_time_prompt)$(_date_prompt)$(_jobs_prompt)$(_history_prompt)$exit_sym $(_tty_prompt)$(_shell_name_prompt)$(_user_prompt)$(_dir_prompt)\$("$__gps1")"'\$ '
len=$(echo "${p@P}" | wc -m)
if [[ "$len" -gt $(($cols / 2)) ]]; then
newline=$'\n'
fi

PS1="$CS$Yellow$CE$(_time_prompt)$(_date_prompt)$CS$NC$CE$CS$BGreen$CE$(_jobs_prompt)$CS$NC$CE$CS$BMagenta$CE$(_history_prompt)$CS$NC$CE$CS$highlight$CE$exit_sym$CS$NC$CE $CS$Green$CE$(_tty_prompt)$(_shell_name_prompt)$CS$NC$CE$(_user_prompt)$CS$BCyan$CE$(_dir_prompt)$CS$NC$CE$CS$BYellow$CE\$("$__gps1")$CS$NC$CE$newline"'\$ '
}
2 changes: 0 additions & 2 deletions bash/aliases.bash
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ alias app='open -a' # Open an application
alias updateDotfiles='~/Dotfiles/update.sh' # Update dotfiles
alias starwars='telnet towel.blinkenlights.nl' # Watch Star Wars
alias beep="echo -n $'\a'" # Do a beep
alias brewclean="$brewscripts/cleanup.sh" # Clean up brew
alias brewupdate="$brewscripts/update.sh" # Update brew
alias today='date -j +"%e %B %Y"' # A format of the date
alias battery='pmset -g batt' # Display battery info
alias lvim='vim -c ''"normal '"'0"'"' # Start vim with it's last cursor position
6 changes: 3 additions & 3 deletions bash/colors.bash
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ white=37

# pass in a color from text above
function brighten {
echo $(( $1 + 60 ))
echo $(( $1 + 60 ))
}

# pass in a color from text above
function background {
echo $(( $1 + 10 ))
echo $(( $1 + 10 ))
}

# build color string
# colorbuild color attribute
# e.g., colorbuild "$red" "$BOLD"
function colorbuild {
echo '\e['"$2"';'"$1"'m'
echo '\e['"$2"';'"$1"'m'
}

Black="$(colorbuild "$black" "$none")"
Expand Down

0 comments on commit 12849e4

Please sign in to comment.