Skip to content

Commit

Permalink
Remove some things that I don’t use
Browse files Browse the repository at this point in the history
This commit drops some aliases, functions, and settings from the project that I wasn’t using at all. It also cleans up some of the remaining code.
  • Loading branch information
mathiasbynens committed Jun 7, 2014
1 parent e030845 commit 3b4eb3e
Show file tree
Hide file tree
Showing 9 changed files with 218 additions and 257 deletions.
17 changes: 5 additions & 12 deletions .aliases
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40
# Enable aliases to be sudo’ed
alias sudo='sudo '

# Gzip-enabled `curl`
alias gurl='curl --compressed'

# Get week number
alias week='date +%V'

Expand Down Expand Up @@ -78,19 +75,16 @@ command -v md5sum > /dev/null || alias md5sum="md5"
command -v sha1sum > /dev/null || alias sha1sum="shasum"

# JavaScriptCore REPL
jscbin="/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc"
[ -e "${jscbin}" ] && alias jsc="${jscbin}"
unset jscbin
jscbin="/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc";
[ -e "${jscbin}" ] && alias jsc="${jscbin}";
unset jscbin;

# Trim new lines and copy to clipboard
alias c="tr -d '\n' | pbcopy"

# Recursively delete `.DS_Store` files
alias cleanup="find . -type f -name '*.DS_Store' -ls -delete"

# ROT13-encode text. Works for decoding, too! ;)
alias rot13='tr a-zA-Z n-za-mN-ZA-M'

# Empty the Trash on all mounted volumes and the main HDD
# Also, clear Apple’s System Logs to improve shell startup speed
alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl"
Expand Down Expand Up @@ -138,7 +132,6 @@ command -v grunt > /dev/null && alias grunt="grunt --stack"
# Stuff I never really use but cannot delete either because of http://xkcd.com/530/
alias stfu="osascript -e 'set volume output muted true'"
alias pumpitup="osascript -e 'set volume 7'"
alias hax="growlnotify -a 'Activity Monitor' 'System error' -m 'WTF R U DOIN'"

# Kill all the tabs in Chrome to free up memory
# [C] explained: http://www.commandlinefu.com/commands/view/402/exclude-grep-from-your-grepped-output-of-ps-alias-included-in-description
Expand All @@ -150,5 +143,5 @@ alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resource
# Reload the shell (i.e. invoke as a login shell)
alias reload="exec $SHELL -l"

# Faster npm for europeans
command -v npm > /dev/null && alias npme="npm --registry http://registry.npmjs.eu"
# Faster npm for Europeans
command -v npm > /dev/null && alias npme="npm --registry http://registry.npmjs.eu/"
32 changes: 16 additions & 16 deletions .bash_profile
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
# Add `~/bin` to the `$PATH`
export PATH="$HOME/bin:$PATH"
export PATH="$HOME/bin:$PATH";

# Load the shell dotfiles, and then some:
# * ~/.path can be used to extend `$PATH`.
# * ~/.extra can be used for other settings you don’t want to commit.
for file in ~/.{path,bash_prompt,exports,aliases,functions,extra}; do
[ -r "$file" ] && [ -f "$file" ] && source "$file"
done
unset file
[ -r "$file" ] && [ -f "$file" ] && source "$file";
done;
unset file;

# Case-insensitive globbing (used in pathname expansion)
shopt -s nocaseglob
shopt -s nocaseglob;

# Append to the Bash history file, rather than overwriting it
shopt -s histappend
shopt -s histappend;

# Autocorrect typos in path names when using `cd`
shopt -s cdspell
shopt -s cdspell;

# Enable some Bash 4 features when possible:
# * `autocd`, e.g. `**/qux` will enter `./foo/bar/baz/qux`
# * Recursive globbing, e.g. `echo **/*.txt`
for option in autocd globstar; do
shopt -s "$option" 2> /dev/null
done
shopt -s "$option" 2> /dev/null;
done;

# Add tab completion for many Bash commands
if which brew > /dev/null && [ -f "$(brew --prefix)/etc/bash_completion" ]; then
source "$(brew --prefix)/etc/bash_completion"
fi
source "$(brew --prefix)/etc/bash_completion";
fi;

# Enable tab completion for `g` by marking it as an alias for `git`
if type _git &> /dev/null && [ -f /usr/local/etc/bash_completion.d/git-completion.bash ]; then
complete -o default -o nospace -F _git g
fi
complete -o default -o nospace -F _git g;
fi;

# Add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards
[ -e "$HOME/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2 | tr ' ' '\n')" scp sftp ssh
[ -e "$HOME/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2 | tr ' ' '\n')" scp sftp ssh;

# Add tab completion for `defaults read|write NSGlobalDomain`
# You could just use `-g` instead, but I like being explicit
complete -W "NSGlobalDomain" defaults
complete -W "NSGlobalDomain" defaults;

# Add `killall` tab completion for common apps
complete -o "nospace" -W "Contacts Calendar Dock Finder Mail Safari iTunes SystemUIServer Terminal Twitter" killall
complete -o "nospace" -W "Contacts Calendar Dock Finder Mail Safari iTunes SystemUIServer Terminal Twitter" killall;
78 changes: 39 additions & 39 deletions .bash_prompt
Original file line number Diff line number Diff line change
Expand Up @@ -3,55 +3,55 @@
# Screenshot: http://i.imgur.com/s0Blh.png

if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then
export TERM=gnome-256color
export TERM=gnome-256color;
elif infocmp xterm-256color >/dev/null 2>&1; then
export TERM=xterm-256color
export TERM=xterm-256color;
fi

if tput setaf 1 &> /dev/null; then
tput sgr0
tput sgr0; # reset colors
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 0)
MAGENTA=$(tput setaf 9);
ORANGE=$(tput setaf 172);
GREEN=$(tput setaf 190);
PURPLE=$(tput setaf 141);
WHITE=$(tput setaf 0);
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)
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);
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
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
export MAGENTA;
export ORANGE;
export GREEN;
export PURPLE;
export WHITE;
export BOLD;
export RESET;

function parse_git_branch() {
local branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
local branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null);
if [ -n "${branch}" ]; then
[ "${branch}" == "HEAD" ] && local branch=$(git rev-parse --short HEAD 2>/dev/null)
local status=$(git status --porcelain 2>/dev/null)
echo -n " on ${PURPLE}${branch}"
[ -n "${status}" ] && echo -n "*"
fi
[ "${branch}" == "HEAD" ] && local branch=$(git rev-parse --short HEAD 2>/dev/null);
local status=$(git status --porcelain 2>/dev/null);
echo -n " on ${PURPLE}${branch}";
[ -n "${status}" ] && echo -n "*";
fi;
}

export PS1="\[${BOLD}${MAGENTA}\]\u \[$WHITE\]at \[$ORANGE\]\h \[$WHITE\]in \[$GREEN\]\w\[$WHITE\]\$(parse_git_branch)\[$WHITE\]\n\$ \[$RESET\]"
export PS2="\[$ORANGE\]→ \[$RESET\]"
export PS1="\[${BOLD}${MAGENTA}\]\u \[$WHITE\]at \[$ORANGE\]\h \[$WHITE\]in \[$GREEN\]\w\[$WHITE\]\$(parse_git_branch)\[$WHITE\]\n\$ \[$RESET\]";
export PS2="\[$ORANGE\]→ \[$RESET\]";
2 changes: 1 addition & 1 deletion .bashrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[ -n "$PS1" ] && source ~/.bash_profile
[ -n "$PS1" ] && source ~/.bash_profile;
22 changes: 11 additions & 11 deletions .exports
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# Make vim the default editor
export EDITOR="vim"
export EDITOR="vim";

# Larger bash history (allow 32³ entries; default is 500)
export HISTSIZE=32768
export HISTFILESIZE=$HISTSIZE
export HISTCONTROL=ignoredups
export HISTSIZE=32768;
export HISTFILESIZE=$HISTSIZE;
export HISTCONTROL=ignoredups;
# Make some commands not show up in history
export HISTIGNORE="ls:cd:cd -:pwd:exit:date:* --help"
export HISTIGNORE="ls:cd:cd -:pwd:exit:date:* --help";

# Prefer US English and use UTF-8
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
export LANG="en_US.UTF-8";
export LC_ALL="en_US.UTF-8";

# Highlight section titles in manual pages
export LESS_TERMCAP_md="$ORANGE"
export LESS_TERMCAP_md="${ORANGE}";

# Don’t clear the screen after quitting a manual page
export MANPAGER="less -X"
export MANPAGER="less -X";

# Always enable colored `grep` output
export GREP_OPTIONS="--color=auto"
export GREP_OPTIONS="--color=auto";

# Link Homebrew casks in `/Applications` rather than `~/Applications`
export HOMEBREW_CASK_OPTS="--appdir=/Applications"
export HOMEBREW_CASK_OPTS="--appdir=/Applications";
Loading

0 comments on commit 3b4eb3e

Please sign in to comment.