diff --git a/.aliases b/.aliases index abc6d918..9a5d6e7d 100644 --- a/.aliases +++ b/.aliases @@ -1,52 +1,132 @@ -# Easier navigation: .., ..., ~ and - +# Easier navigation: .., ..., ...., ....., ~ and - alias ..="cd .." alias ...="cd ../.." +alias ....="cd ../../.." +alias .....="cd ../../../.." alias ~="cd ~" # `cd` is probably faster to type though alias -- -="cd -" +# Shortcuts +alias d="cd ~/Documents/Dropbox" +alias dl="cd ~/Downloads" +alias dt="cd ~/Desktop" +alias p="cd ~/Projects" +alias g="git" +alias h="history" +alias j="jobs" +alias v="vim" +alias m="mate ." +alias s="subl ." +alias o="open" +alias oo="open ." + +# Detect which `ls` flavor is in use +if ls --color > /dev/null 2>&1; then # GNU `ls` + colorflag="--color" +else # OS X `ls` + colorflag="-G" +fi + +# List all files colorized in long format +alias l="ls -l ${colorflag}" + # List all files colorized in long format, including dot files -alias la="ls -Gla" +alias la="ls -la ${colorflag}" + +# List only directories +alias lsd='ls -l ${colorflag} | grep "^d"' + +# Always use color output for `ls` +alias ls="command ls ${colorflag}" +export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:' + +# Enable aliases to be sudo’ed +alias sudo='sudo ' + +# Gzip-enabled `curl` +alias gurl="curl --compressed" + +# Get OS X Software Updates, and update installed Ruby gems, Homebrew, npm, and their installed packages +alias update='sudo softwareupdate -i -a; brew update; brew upgrade; brew cleanup; npm update npm -g; npm update -g; sudo gem update' # IP addresses alias ip="dig +short myip.opendns.com @resolver1.opendns.com" alias localip="ipconfig getifaddr en1" -alias ips="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'" +alias ips="ifconfig -a | grep -o 'inet6\? \(\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\)\|[a-fA-F0-9:]\+\)' | sed -e 's/inet6* //'" + +# Enhanced WHOIS lookups +alias whois="whois -h whois-servers.net" # Flush Directory Service cache -alias flush="dscacheutil -flushcache" +alias flush="dscacheutil -flushcache && killall -HUP mDNSResponder" + +# Clean up LaunchServices to remove duplicates in the “Open With” menu +alias lscleanup="/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user && killall Finder" # View HTTP traffic alias sniff="sudo ngrep -d 'en1' -t '^(GET|POST) ' 'tcp and port 80'" alias httpdump="sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E \"Host\: .*|GET \/.*\"" -# Start an HTTP server from a directory -alias server="open http://localhost:8080/ && python -m SimpleHTTPServer 8080" +# Canonical hex dump; some systems have this symlinked +command -v hd > /dev/null || alias hd="hexdump -C" + +# OS X has no `md5sum`, so use `md5` as a fallback +command -v md5sum > /dev/null || alias md5sum="md5" + +# OS X has no `sha1sum`, so use `shasum` as a fallback +command -v sha1sum > /dev/null || alias sha1sum="shasum" # Trim new lines and copy to clipboard alias c="tr -d '\n' | pbcopy" -# Shortcuts -alias d="cd ~/Documents/Dropbox" -alias p="cd ~/Projects" -alias g="git" -alias v="vim" -alias m="mate ." - -# File size -alias fs="stat -f \"%z bytes\"" +# 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" + +# Show/hide hidden files in Finder +alias show="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder" +alias hide="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder" + +# Hide/show all desktop icons (useful when presenting) +alias hidedesktop="defaults write com.apple.finder CreateDesktop -bool false && killall Finder" +alias showdesktop="defaults write com.apple.finder CreateDesktop -bool true && killall Finder" + +# URL-encode strings +alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1]);"' + +# Merge PDF files +# Usage: `mergepdf -o output.pdf input{1,2,3}.pdf` +alias mergepdf='/System/Library/Automator/Combine\ PDF\ Pages.action/Contents/Resources/join.py' + # Disable Spotlight alias spotoff="sudo mdutil -a -i off" # Enable Spotlight alias spoton="sudo mdutil -a -i on" +# PlistBuddy alias, because sometimes `defaults` just doesn’t cut it +alias plistbuddy="/usr/libexec/PlistBuddy" + +# Ring the terminal bell, and put a badge on Terminal.app’s Dock icon +# (useful when executing time-consuming commands) +alias badge="tput bel" + +# Intuitive map function +# For example, to list all directories that contain a certain file: +# find . -name .gitattributes | map dirname +alias map="xargs -n1" + # One of @janmoesen’s ProTip™s -for method in GET POST HEAD PUT DELETE; do alias "$method"="lwp-request -m '$method'"; done +for method in GET HEAD POST PUT DELETE TRACE OPTIONS; do + alias "$method"="lwp-request -m '$method'" +done # 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 10'" +alias pumpitup="osascript -e 'set volume 7'" alias hax="growlnotify -a 'Activity Monitor' 'System error' -m 'WTF R U DOIN'" \ No newline at end of file diff --git a/.bash_profile b/.bash_profile old mode 100755 new mode 100644 index d9840c43..7eacfc8e --- a/.bash_profile +++ b/.bash_profile @@ -1,9 +1,39 @@ -# Load ~/.bash_prompt, ~/.exports, ~/.aliases, ~/.functions and ~/.extra -# ~/.extra can be used for settings you don’t want to commit -for file in bash_prompt exports aliases functions extra; do - file="$HOME/.$file" - [ -e "$file" ] && source "$file" +# Add `~/bin` to the `$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" ] && source "$file" done +unset file # Case-insensitive globbing (used in pathname expansion) shopt -s nocaseglob + +# Append to the Bash history file, rather than overwriting it +shopt -s histappend + +# Autocorrect typos in path names when using `cd` +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 + +# 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)" 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 + +# Add `killall` tab completion for common apps +complete -o "nospace" -W "Contacts Calendar Dock Finder Mail Safari iTunes SystemUIServer Terminal Twitter" killall + +# If possible, add tab completion for many more commands +[ -f /etc/bash_completion ] && source /etc/bash_completion \ No newline at end of file diff --git a/.bash_prompt b/.bash_prompt index 764fdfcf..110c9262 100644 --- a/.bash_prompt +++ b/.bash_prompt @@ -1,42 +1,55 @@ -# @gf3’s Sexy Bash Prompt, inspired by "Extravagant Zsh Prompt" +# @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 -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 +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 - 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) + 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 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) 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" + 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 -parse_git_dirty () { - [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" -} -parse_git_branch () { - git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/" +export MAGENTA +export ORANGE +export GREEN +export PURPLE +export WHITE +export BOLD +export RESET + +function parse_git_dirty() { + [[ $(git status 2> /dev/null | tail -n1) != *"working directory clean"* ]] && echo "*" } -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\]" \ No newline at end of file +function parse_git_branch() { + git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/" +} + +export 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\]" +export PS2="\[$ORANGE\]→ \[$RESET\]" \ No newline at end of file diff --git a/.bashrc b/.bashrc index 6296f513..c77cd042 100644 --- a/.bashrc +++ b/.bashrc @@ -1 +1 @@ -source "$HOME/.bash_profile" +[ -n "$PS1" ] && source ~/.bash_profile \ No newline at end of file diff --git a/.brew b/.brew new file mode 100755 index 00000000..2623cccb --- /dev/null +++ b/.brew @@ -0,0 +1,48 @@ +#!/bin/bash + +# Make sure we’re using the latest Homebrew +brew update + +# Upgrade any already-installed formulae +brew upgrade + +# Install GNU core utilities (those that come with OS X are outdated) +brew install coreutils +echo "Don’t forget to add $(brew --prefix coreutils)/libexec/gnubin to \$PATH." +# Install GNU `find`, `locate`, `updatedb`, and `xargs`, g-prefixed +brew install findutils +# Install Bash 4 +brew install bash + +# Install wget with IRI support +brew install wget --enable-iri + +# Install RingoJS and Narwhal +# Note that the order in which these are installed is important; see http://git.io/brew-narwhal-ringo. +brew install ringojs +brew install narwhal + +# Install more recent versions of some OS X tools +brew tap homebrew/dupes +brew install homebrew/dupes/grep +brew tap josegonzalez/homebrew-php +brew install php54 + +# These two formulae didn’t work well last time I tried them: +#brew install homebrew/dupes/vim +#brew install homebrew/dupes/screen + +# Install everything else +brew install ack +#brew install exiv2 +brew install git +#brew install imagemagick +brew install lynx +brew install node +brew install rename +brew install rhino +brew install tree +brew install webkit2png + +# Remove outdated versions from the cellar +brew cleanup \ No newline at end of file diff --git a/.exports b/.exports index 969cd346..b9f86066 100644 --- a/.exports +++ b/.exports @@ -1,8 +1,19 @@ # Make vim the default editor export EDITOR="vim" -# Don’t clear the screen after quitting a manual page -export MANPAGER="less -X" # Larger bash history (allow 32³ entries; default is 500) 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" + +# Prefer US English and use UTF-8 +export LANG="en_US" +export LC_ALL="en_US.UTF-8" + +# Highlight section titles in manual pages +export LESS_TERMCAP_md="$ORANGE" + +# Don’t clear the screen after quitting a manual page +export MANPAGER="less -X" \ No newline at end of file diff --git a/.functions b/.functions index 91ec6c15..db887fa5 100644 --- a/.functions +++ b/.functions @@ -1,15 +1,165 @@ +# Simple calculator +function calc() { + local result="" + result="$(printf "scale=10;$*\n" | bc --mathlib | tr -d '\\\n')" + # └─ default (when `--mathlib` is used) is 20 + # + if [[ "$result" == *.* ]]; then + # improve the output for decimal numbers + printf "$result" | + sed -e 's/^\./0./' `# add "0" for cases like ".5"` \ + -e 's/^-\./-0./' `# add "0" for cases like "-.5"`\ + -e 's/0*$//;s/\.$//' # remove trailing zeros + else + printf "$result" + fi + printf "\n" +} + # Create a new directory and enter it -md() { - mkdir -p "$@" && cd "$@" +function mkd() { + mkdir -p "$@" && cd "$@" +} + +# Determine size of a file or total size of a directory +function fs() { + if du -b /dev/null > /dev/null 2>&1; then + local arg=-sbh + else + local arg=-sh + fi + if [[ -n "$@" ]]; then + du $arg -- "$@" + else + du $arg .[^.]* * + fi +} + +# Use Git’s colored diff when available +hash git &>/dev/null +if [ $? -eq 0 ]; then + function diff() { + git diff --no-index --color-words "$@" + } +fi + +# Create a data URL from a file +function dataurl() { + local mimeType=$(file -b --mime-type "$1") + if [[ $mimeType == text/* ]]; then + mimeType="${mimeType};charset=utf-8" + fi + echo "data:${mimeType};base64,$(openssl base64 -in "$1" | tr -d '\n')" +} + +# Start an HTTP server from a directory, optionally specifying the port +function server() { + local port="${1:-8000}" + sleep 1 && open "http://localhost:${port}/" & + # Set the default Content-Type to `text/plain` instead of `application/octet-stream` + # And serve everything as UTF-8 (although not technically correct, this doesn’t break anything for binary files) + python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port" +} + +# Start a PHP server from a directory, optionally specifying the port +# (Requires PHP 5.4.0+.) +function phpserver() { + local port="${1:-4000}" + local ip=$(ipconfig getifaddr en1) + sleep 1 && open "http://${ip}:${port}/" & + php -S "${ip}:${port}" +} + +# Compare original and gzipped file size +function gz() { + local origsize=$(wc -c < "$1") + local gzipsize=$(gzip -c "$1" | wc -c) + local ratio=$(echo "$gzipsize * 100/ $origsize" | bc -l) + printf "orig: %d bytes\n" "$origsize" + printf "gzip: %d bytes (%2.2f%%)\n" "$gzipsize" "$ratio" } # Test if HTTP compression (RFC 2616 + SDCH) is enabled for a given URL. # Send a fake UA string for sites that sniff it instead of using the Accept-Encoding header. (Looking at you, ajax.googleapis.com!) -httpcompression() { - encoding="$(curl -LIs -H 'User-Agent: Mozilla/5 Gecko' -H 'Accept-Encoding: gzip,deflate,compress,sdch' "$1" | grep '^Content-Encoding:')" && echo "$1 is encoded using ${encoding#* }" || echo "$1 is not using any encoding" +function httpcompression() { + encoding="$(curl -LIs -H 'User-Agent: Mozilla/5 Gecko' -H 'Accept-Encoding: gzip,deflate,compress,sdch' "$1" | grep '^Content-Encoding:')" && echo "$1 is encoded using ${encoding#* }" || echo "$1 is not using any encoding" +} + +# Syntax-highlight JSON strings or files +# Usage: `json '{"foo":42}'` or `echo '{"foo":42}' | json` +function json() { + if [ -t 0 ]; then # argument + python -mjson.tool <<< "$*" | pygmentize -l javascript + else # pipe + python -mjson.tool | pygmentize -l javascript + fi } # All the dig info -digga() { - dig +nocmd "$1" any +multiline +noall +answer +function digga() { + dig +nocmd "$1" any +multiline +noall +answer } + +# Escape UTF-8 characters into their 3-byte format +function escape() { + printf "\\\x%s" $(printf "$@" | xxd -p -c1 -u) + echo # newline +} + +# Decode \x{ABCD}-style Unicode escape sequences +function unidecode() { + perl -e "binmode(STDOUT, ':utf8'); print \"$@\"" + echo # newline +} + +# Get a character’s Unicode code point +function codepoint() { + perl -e "use utf8; print sprintf('U+%04X', ord(\"$@\"))" + echo # newline +} + +# Add note to Notes.app (OS X 10.8) +# Usage: `note 'foo'` or `echo 'foo' | note` +function note() { + local text + if [ -t 0 ]; then # argument + text="$1" + else # pipe + text=$(cat) + fi + body=$(echo "$text" | sed -E 's|$|
|g') + osascript >/dev/null </dev/null <\" -C HEAD; }; f" + # Interactive rebase with the given number of latest commits + reb = "!r() { git rebase -i HEAD~$1; }; r" + # Undo a `git push` + undopush = push -f origin HEAD^:master + [apply] - whitespace = fix + # Detect whitespace errors when applying a patch + whitespace = fix + [core] - excludesfile = ~/.gitignore - attributesfile = ~/.gitattributes - whitespace = fix,space-before-tab,tab-in-indent,trailing-space + # Use custom `.gitignore` and `.gitattributes` + excludesfile = ~/.gitignore + attributesfile = ~/.gitattributes + # Treat spaces before tabs, lines that are indented with 8 or more spaces, and all kinds of trailing whitespace as an error + whitespace = space-before-tab,indent-with-non-tab,trailing-space + [color] - ui = auto + # Use colors in Git commands that are capable of colored output when outputting to the terminal + ui = auto [color "branch"] - current = yellow reverse - local = yellow - remote = green + current = yellow reverse + local = yellow + remote = green [color "diff"] - meta = yellow bold - frag = magenta bold - old = red bold - new = green bold + meta = yellow bold + frag = magenta bold + old = red bold + new = green bold [color "status"] - added = yellow - changed = green - untracked = cyan + added = yellow + changed = green + untracked = cyan [merge] - log = true + # Include summaries of merged commits in newly created merge commit messages + log = true + +# Use `origin` as the default remote on the `master` branch in all cases +[branch "master"] + remote = origin + merge = refs/heads/master + +# URL shorthands [url "git@github.com:"] - insteadOf = "gh:" - pushInsteadOf = "github:" - pushInsteadOf = "git://github.com/" + insteadOf = "gh:" + pushInsteadOf = "github:" + pushInsteadOf = "git://github.com/" [url "git://github.com/"] - insteadOf = "github:" + insteadOf = "github:" [url "git@gist.github.com:"] - insteadOf = "gst:" - pushInsteadOf = "gist:" - pushInsteadOf = "git://gist.github.com/" + insteadOf = "gst:" + pushInsteadOf = "gist:" + pushInsteadOf = "git://gist.github.com/" [url "git://gist.github.com/"] - insteadOf = "gist:" + insteadOf = "gist:" + +[push] + default = simple \ No newline at end of file diff --git a/.gitignore b/.gitignore index 496ee2ca..f250f687 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,14 @@ -.DS_Store \ No newline at end of file +# Compiled Python files +*.pyc + +# Folder view configuration files +.DS_Store +Desktop.ini + +# Thumbnail cache files +._* +Thumbs.db + +# Files that might appear on external disks +.Spotlight-V100 +.Trashes \ No newline at end of file diff --git a/.gvimrc b/.gvimrc new file mode 100644 index 00000000..3360ece6 --- /dev/null +++ b/.gvimrc @@ -0,0 +1,6 @@ +" Use the excellent Railscat theme by Jeff Kreeftmeijer (gVim-only) +colorscheme railscat +" Use 14pt Menlo +set guifont=Menlo:h14 +" Better line-height +set linespace=8 \ No newline at end of file diff --git a/.hgignore b/.hgignore new file mode 100644 index 00000000..4b24d82c --- /dev/null +++ b/.hgignore @@ -0,0 +1,17 @@ +# Use shell-style glob syntax +syntax: glob + +# Compiled Python files +*.pyc + +# Folder view configuration files +.DS_Store +Desktop.ini + +# Thumbnail cache files +._* +Thumbs.db + +# Files that might appear on external disks +.Spotlight-V100 +.Trashes \ No newline at end of file diff --git a/.hushlogin b/.hushlogin new file mode 100644 index 00000000..e6143df4 --- /dev/null +++ b/.hushlogin @@ -0,0 +1,4 @@ +# The mere presence of this file in the home directory disables the system +# copyright notice, the date and time of the last login, the message of the +# day as well as other information that may otherwise appear on login. +# See `man login`. \ No newline at end of file diff --git a/.inputrc b/.inputrc index af7702b8..adbd92f0 100644 --- a/.inputrc +++ b/.inputrc @@ -1,6 +1,40 @@ # Make Tab autocomplete regardless of filename case set completion-ignore-case on -# Append a slash when autocompleting symbolic links to directories -set mark-symlinked-directories on + # List all matches in case multiple possible completions are possible set show-all-if-ambiguous on + +# Immediately add a trailing slash when autocompleting symlinks to directories +set mark-symlinked-directories on + +# Use the text that has already been typed as the prefix for searching through +# commands (i.e. more intelligent Up/Down behavior) +"\e[B": history-search-forward +"\e[A": history-search-backward + +# Do not autocomplete hidden files unless the pattern explicitly begins with a dot +set match-hidden-files off + +# Show all autocomplete results at once +set page-completions off + +# If there are more than 200 possible completions for a word, ask to show them all +set completion-query-items 200 + +# Show extra file information when completing, like `ls -F` does +set visible-stats on + +# Be more intelligent when autocompleting by also looking at the text after +# the cursor. For example, when the current line is "cd ~/src/mozil", and +# the cursor is on the "z", pressing Tab will not autocomplete it to "cd +# ~/src/mozillail", but to "cd ~/src/mozilla". (This is supported by the +# Readline used by Bash 4.) +set skip-completed-text on + +# Allow UTF-8 input and output, instead of showing stuff like $'\0123\0456' +set input-meta on +set output-meta on +set convert-meta off + +# Use Alt/Meta + Delete to delete the preceding word +"\e[3;3~": kill-word \ No newline at end of file diff --git a/.osx b/.osx old mode 100644 new mode 100755 index 53ba7d09..82cc4a21 --- a/.osx +++ b/.osx @@ -1,44 +1,558 @@ -# 2D Dock -defaults write com.apple.dock no-glass -bool true +#!/bin/bash -# Disable menu bar transparency -defaults write -g AppleEnableMenuBarTransparency -bool false +# ~/.osx — http://mths.be/osx + +# Ask for the administrator password upfront +sudo -v + +# Keep-alive: update existing `sudo` time stamp until `.osx` has finished +while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & + +############################################################################### +# General UI/UX # +############################################################################### + +# Set computer name (as done via System Preferences → Sharing) +sudo scutil --set ComputerName "MathBook Pro" +sudo scutil --set HostName "MathBook Pro" +sudo scutil --set LocalHostName "MathBook-Pro" +sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "MathBook-Pro" + +# Menu bar: disable transparency +defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false + +# Menu bar: show remaining battery time (on pre-10.8); hide percentage +defaults write com.apple.menuextra.battery ShowPercent -string "NO" +defaults write com.apple.menuextra.battery ShowTime -string "YES" + +# Menu bar: hide the useless Time Machine and Volume icons +defaults write com.apple.systemuiserver menuExtras -array "/System/Library/CoreServices/Menu Extras/Bluetooth.menu" "/System/Library/CoreServices/Menu Extras/AirPort.menu" "/System/Library/CoreServices/Menu Extras/Battery.menu" "/System/Library/CoreServices/Menu Extras/Clock.menu" + +# Always show scrollbars +defaults write NSGlobalDomain AppleShowScrollBars -string "Always" + +# Disable smooth scrolling +# (Uncomment if you’re on an older Mac that messes up the animation) +#defaults write NSGlobalDomain NSScrollAnimationEnabled -bool false + +# Disable opening and closing window animations +defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false + +# Increase window resize speed for Cocoa applications +defaults write NSGlobalDomain NSWindowResizeTime -float 0.001 # Expand save panel by default -defaults write -g NSNavPanelExpandedStateForSaveMode -bool true +defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true # Expand print panel by default -defaults write -g PMPrintingExpandedStateForPrint -bool true +defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true + +# Save to disk (not to iCloud) by default +defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false + +# Automatically quit printer app once the print jobs complete +defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true + +# Disable the “Are you sure you want to open this application?” dialog +defaults write com.apple.LaunchServices LSQuarantine -bool false + +# Display ASCII control characters using caret notation in standard text views +# Try e.g. `cd /tmp; unidecode "\x{0000}" > cc.txt; open -e cc.txt` +defaults write NSGlobalDomain NSTextShowsControlCharacters -bool true + +# Disable Resume system-wide +defaults write NSGlobalDomain NSQuitAlwaysKeepsWindows -bool false + +# Disable automatic termination of inactive apps +defaults write NSGlobalDomain NSDisableAutomaticTermination -bool true + +# Disable the crash reporter +#defaults write com.apple.CrashReporter DialogType -string "none" + +# Set Help Viewer windows to non-floating mode +defaults write com.apple.helpviewer DevMode -bool true + +# Fix for the ancient UTF-8 bug in QuickLook (http://mths.be/bbo) +# Commented out, as this is known to cause problems when saving files in +# Adobe Illustrator CS5 :( +#echo "0x08000100:0" > ~/.CFUserTextEncoding + +# Reveal IP address, hostname, OS version, etc. when clicking the clock +# in the login window +sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName + +# Restart automatically if the computer freezes +systemsetup -setrestartfreeze on + +# Never go into computer sleep mode +systemsetup -setcomputersleep Off > /dev/null + +# Check for software updates daily, not just once per week +defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 + +############################################################################### +# Trackpad, mouse, keyboard, Bluetooth accessories, and input # +############################################################################### + +# Trackpad: enable tap to click for this user and for the login screen +defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true +defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 +defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 + +# Trackpad: map bottom right corner to right-click +defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2 +defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true +defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1 +defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true + +# Trackpad: swipe between pages with three fingers +defaults write NSGlobalDomain AppleEnableSwipeNavigateWithScrolls -bool true +defaults -currentHost write NSGlobalDomain com.apple.trackpad.threeFingerHorizSwipeGesture -int 1 +defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadThreeFingerHorizSwipeGesture -int 1 + +# Disable “natural” (Lion-style) scrolling +defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false + +# Increase sound quality for Bluetooth headphones/headsets +defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40 + +# Enable full keyboard access for all controls +# (e.g. enable Tab in modal dialogs) +defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 + +# Enable access for assistive devices +echo -n 'a' | sudo tee /private/var/db/.AccessibilityAPIEnabled > /dev/null 2>&1 +sudo chmod 444 /private/var/db/.AccessibilityAPIEnabled +# TODO: avoid GUI password prompt somehow (http://apple.stackexchange.com/q/60476/4408) +#sudo osascript -e 'tell application "System Events" to set UI elements enabled to true' + +# Use scroll gesture with the Ctrl (^) modifier key to zoom +defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true +defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144 +# Follow the keyboard focus while zoomed in +defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true + +# Disable press-and-hold for keys in favor of key repeat +defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false + +# Set a blazingly fast keyboard repeat rate +defaults write NSGlobalDomain KeyRepeat -int 0 + +# Automatically illuminate built-in MacBook keyboard in low light +defaults write com.apple.BezelServices kDim -bool true +# Turn off keyboard illumination when computer is not used for 5 minutes +defaults write com.apple.BezelServices kDimTime -int 300 + +# Set language and text formats +# Note: if you’re in the US, replace `EUR` with `USD`, `Centimeters` with +# `Inches`, and `true` with `false`. +defaults write NSGlobalDomain AppleLanguages -array "en" "nl" +defaults write NSGlobalDomain AppleLocale -string "en_GB@currency=EUR" +defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters" +defaults write NSGlobalDomain AppleMetricUnits -bool true + +# Set the timezone; see `systemsetup -listtimezones` for other values +systemsetup -settimezone "Europe/Brussels" > /dev/null + +# Disable auto-correct +defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false + +############################################################################### +# Screen # +############################################################################### + +# Require password immediately after sleep or screen saver begins +defaults write com.apple.screensaver askForPassword -int 1 +defaults write com.apple.screensaver askForPasswordDelay -int 0 + +# Save screenshots to the desktop +defaults write com.apple.screencapture location -string "$HOME/Desktop" + +# Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF) +defaults write com.apple.screencapture type -string "png" # Disable shadow in screenshots defaults write com.apple.screencapture disable-shadow -bool true -# Enable highlight hover effect for the grid view of a stack (Dock) -defaults write com.apple.dock mouse-over-hilte-stack -bool true +# Enable subpixel font rendering on non-Apple LCDs +defaults write NSGlobalDomain AppleFontSmoothing -int 2 -# Disable Safari’s thumbnail cache for History and Top Sites -defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2 +# Enable HiDPI display modes (requires restart) +sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true -# Remove useless icons from Safari’s bookmarks bar -defaults write com.apple.Safari ProxiesInBookmarksBar "()" +############################################################################### +# Finder # +############################################################################### -# Disable Lion’s press-and-hold for keys in favor of key repeat -defaults write -g ApplePressAndHoldEnabled -bool false +# Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons +defaults write com.apple.finder QuitMenuItem -bool true -# Disable OS X Lion auto-correct -defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false +# Finder: disable window animations and Get Info animations +defaults write com.apple.finder DisableAllAnimations -bool true -# Reset Launchpad -rm ~/Library/Application\ Support/Dock/*.db +# Show icons for hard drives, servers, and removable media on the desktop +defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true +defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true +defaults write com.apple.finder ShowMountedServersOnDesktop -bool true +defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true + +# Finder: show hidden files by default +defaults write com.apple.finder AppleShowAllFiles -bool true + +# Finder: show all filename extensions +defaults write NSGlobalDomain AppleShowAllExtensions -bool true + +# Finder: show status bar +defaults write com.apple.finder ShowStatusBar -bool true + +# Finder: allow text selection in Quick Look +defaults write com.apple.finder QLEnableTextSelection -bool true + +# Display full POSIX path as Finder window title +defaults write com.apple.finder _FXShowPosixPathInTitle -bool true + +# When performing a search, search the current folder by default +defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" + +# Disable the warning when changing a file extension +defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false + +# Avoid creating .DS_Store files on network volumes +defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true + +# Disable disk image verification +defaults write com.apple.frameworks.diskimages skip-verify -bool true +defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true +defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true + +# Automatically open a new Finder window when a volume is mounted +defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true +defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true +defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true + +# Show item info near icons on the desktop and in other icon views +/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist +/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist +/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist + +# Show item info to the right of the icons on the desktop +/usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:labelOnBottom false" ~/Library/Preferences/com.apple.finder.plist + +# Enable snap-to-grid for icons on the desktop and in other icon views +/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist +/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist +/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist + +# Increase grid spacing for icons on the desktop and in other icon views +/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist +/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist +/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist + +# Increase the size of icons on the desktop and in other icon views +/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist +/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist +/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist + +# Use list view in all Finder windows by default +# Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv` +defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv" + +# Disable the warning before emptying the Trash +defaults write com.apple.finder WarnOnEmptyTrash -bool false + +# Empty Trash securely by default +defaults write com.apple.finder EmptyTrashSecurely -bool true + +# Enable AirDrop over Ethernet and on unsupported Macs running Lion +defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true # Show the ~/Library folder chflags nohidden ~/Library +# Remove Dropbox’s green checkmark icons in Finder +file=/Applications/Dropbox.app/Contents/Resources/check.icns +[ -e "$file" ] && mv -f "$file" "$file.bak" +unset file + +############################################################################### +# Dock & hot corners # +############################################################################### + +# Enable highlight hover effect for the grid view of a stack (Dock) +defaults write com.apple.dock mouse-over-hilite-stack -bool true + +# Set the icon size of Dock items to 36 pixels +defaults write com.apple.dock tilesize -int 36 + +# Enable spring loading for all Dock items +defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true + +# Show indicator lights for open applications in the Dock +defaults write com.apple.dock show-process-indicators -bool true + +# Wipe all (default) app icons from the Dock +# This is only really useful when setting up a new Mac, or if you don’t use +# the Dock to launch apps. +#defaults write com.apple.dock persistent-apps -array + +# Don’t animate opening applications from the Dock +defaults write com.apple.dock launchanim -bool false + +# Speed up Mission Control animations +defaults write com.apple.dock expose-animation-duration -float 0.1 + +# Don’t group windows by application in Mission Control +# (i.e. use the old Exposé behavior instead) +defaults write com.apple.dock expose-group-by-app -bool false + +# Don’t show Dashboard as a Space +defaults write com.apple.dock dashboard-in-overlay -bool true + +# Remove the auto-hiding Dock delay +defaults write com.apple.Dock autohide-delay -float 0 +# Remove the animation when hiding/showing the Dock +defaults write com.apple.dock autohide-time-modifier -float 0 + +# Enable the 2D Dock +#defaults write com.apple.dock no-glass -bool true + +# Automatically hide and show the Dock +defaults write com.apple.dock autohide -bool true + +# Make Dock icons of hidden applications translucent +defaults write com.apple.dock showhidden -bool true + +# Reset Launchpad +find ~/Library/Application\ Support/Dock -name "*.db" -maxdepth 1 -delete + +# Add iOS Simulator to Launchpad +ln -s /Applications/Xcode.app/Contents/Applications/iPhone\ Simulator.app /Applications/iOS\ Simulator.app + +# Add a spacer to the left side of the Dock (where the applications are) +#defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}' +# Add a spacer to the right side of the Dock (where the Trash is) +#defaults write com.apple.dock persistent-others -array-add '{tile-data={}; tile-type="spacer-tile";}' + +# Hot corners +# Possible values: +# 0: no-op +# 2: Mission Control +# 3: Show application windows +# 4: Desktop +# 5: Start screen saver +# 6: Disable screen saver +# 7: Dashboard +# 10: Put display to sleep +# 11: Launchpad +# Top left screen corner → Mission Control +defaults write com.apple.dock wvous-tl-corner -int 2 +defaults write com.apple.dock wvous-tl-modifier -int 0 +# Top right screen corner → Desktop +defaults write com.apple.dock wvous-tr-corner -int 4 +defaults write com.apple.dock wvous-tr-modifier -int 0 +# Bottom left screen corner → Start screen saver +defaults write com.apple.dock wvous-bl-corner -int 5 +defaults write com.apple.dock wvous-bl-modifier -int 0 + +############################################################################### +# Safari & WebKit # +############################################################################### + +# Set Safari’s home page to `about:blank` for faster loading +defaults write com.apple.Safari HomePage -string "about:blank" + +# Prevent Safari from opening ‘safe’ files automatically after downloading +defaults write com.apple.Safari AutoOpenSafeDownloads -bool false + +# Allow hitting the Backspace key to go to the previous page in history +defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool true + +# Hide Safari’s bookmarks bar by default +defaults write com.apple.Safari ShowFavoritesBar -bool false + +# Disable Safari’s thumbnail cache for History and Top Sites +defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2 + +# Enable Safari’s debug menu +defaults write com.apple.Safari IncludeInternalDebugMenu -bool true + +# Make Safari’s search banners default to Contains instead of Starts With +defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false + +# Remove useless icons from Safari’s bookmarks bar +defaults write com.apple.Safari ProxiesInBookmarksBar "()" + +# Enable the Develop menu and the Web Inspector in Safari +defaults write com.apple.Safari IncludeDevelopMenu -bool true +defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true +defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true + +# Add a context menu item for showing the Web Inspector in web views +defaults write NSGlobalDomain WebKitDeveloperExtras -bool true + +############################################################################### +# iTunes (pre-iTunes 11 only) # +############################################################################### + +# Disable the iTunes store link arrows +defaults write com.apple.iTunes show-store-link-arrows -bool false + +# Disable the Genius sidebar in iTunes +defaults write com.apple.iTunes disableGeniusSidebar -bool true + +# Disable radio stations in iTunes +defaults write com.apple.iTunes disableRadio -bool true + +# Make ⌘ + F focus the search input in iTunes +# To use these commands in another language, browse iTunes’s package contents, +# open `Contents/Resources/your-language.lproj/Localizable.strings`, and look +# for `kHiddenMenuItemTargetSearch`. +defaults write com.apple.iTunes NSUserKeyEquivalents -dict-add "Target Search Field" "@F" + +############################################################################### +# Mail # +############################################################################### + +# Disable send and reply animations in Mail.app +defaults write com.apple.mail DisableReplyAnimations -bool true +defaults write com.apple.mail DisableSendAnimations -bool true + +# Copy email addresses as `foo@example.com` instead of `Foo Bar ` in Mail.app +defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false + +# Add the keyboard shortcut ⌘ + Enter to send an email in Mail.app +defaults write com.apple.mail NSUserKeyEquivalents -dict-add "Send" "@\\U21a9" + +############################################################################### +# Terminal # +############################################################################### + +# Only use UTF-8 in Terminal.app +defaults write com.apple.terminal StringEncodings -array 4 + +# Use a modified version of the Pro theme by default in Terminal.app +open "$HOME/init/Mathias.terminal" +sleep 1 # Wait a bit to make sure the theme is loaded +defaults write com.apple.terminal "Default Window Settings" -string "Mathias" +defaults write com.apple.terminal "Startup Window Settings" -string "Mathias" + +# Enable “focus follows mouse” for Terminal.app and all X11 apps +# i.e. hover over a window and start typing in it without clicking first +#defaults write com.apple.terminal FocusFollowsMouse -bool true +#defaults write org.x.X11 wm_ffm -bool true + +############################################################################### +# Time Machine # +############################################################################### + +# Prevent Time Machine from prompting to use new hard drives as backup volume +defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true + # Disable local Time Machine backups -sudo tmutil disablelocal +hash tmutil &> /dev/null && sudo tmutil disablelocal -# Kill applications -killall Safari && killall Finder && killall Dock +############################################################################### +# Address Book, Dashboard, iCal, TextEdit, and Disk Utility # +############################################################################### -# Fix for the ancient UTF-8 bug in QuickLook (http://mths.be/bbo) -echo "0×08000100:0" > ~/.CFUserTextEncoding \ No newline at end of file +# Enable the debug menu in Address Book +defaults write com.apple.addressbook ABShowDebugMenu -bool true + +# Enable Dashboard dev mode (allows keeping widgets on the desktop) +defaults write com.apple.dashboard devmode -bool true + +# Enable the debug menu in iCal (pre-10.8) +defaults write com.apple.iCal IncludeDebugMenu -bool true + +# Use plain text mode for new TextEdit documents +defaults write com.apple.TextEdit RichText -int 0 +# Open and save files as UTF-8 in TextEdit +defaults write com.apple.TextEdit PlainTextEncoding -int 4 +defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4 + +# Enable the debug menu in Disk Utility +defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true +defaults write com.apple.DiskUtility advanced-image-options -bool true + +############################################################################### +# Mac App Store # +############################################################################### + +# Enable the WebKit Developer Tools in the Mac App Store +defaults write com.apple.appstore WebKitDeveloperExtras -bool true + +# Enable Debug Menu in the Mac App Store +defaults write com.apple.appstore ShowDebugMenu -bool true + +############################################################################### +# Google Chrome & Google Chrome Canary # +############################################################################### + +# Allow installing user scripts via GitHub or Userscripts.org +defaults write com.google.Chrome ExtensionInstallSources -array "https://*.github.com/*" "http://userscripts.org/*" +defaults write com.google.Chrome.canary ExtensionInstallSources -array "https://*.github.com/*" "http://userscripts.org/*" + +############################################################################### +# SizeUp.app # +############################################################################### + +# Start SizeUp at login +defaults write com.irradiatedsoftware.SizeUp StartAtLogin -bool true + +# Don’t show the preferences window on next start +defaults write com.irradiatedsoftware.SizeUp ShowPrefsOnNextStart -bool false + +############################################################################### +# Transmission.app # +############################################################################### + +# Use `~/Documents/Torrents` to store incomplete downloads +defaults write org.m0k.transmission UseIncompleteDownloadFolder -bool true +defaults write org.m0k.transmission IncompleteDownloadFolder -string "${HOME}/Documents/Torrents" + +# Don’t prompt for confirmation before downloading +defaults write org.m0k.transmission DownloadAsk -bool false + +# Trash original torrent files +defaults write org.m0k.transmission DeleteOriginalTorrent -bool true + +# Hide the donate message +defaults write org.m0k.transmission WarningDonate -bool false +# Hide the legal disclaimer +defaults write org.m0k.transmission WarningLegal -bool false + +############################################################################### +# Twitter.app # +############################################################################### + +# Disable smart quotes as it’s annoying for code tweets +defaults write com.twitter.twitter-mac AutomaticQuoteSubstitutionEnabled -bool false + +# Show the app window when clicking the menu icon +defaults write com.twitter.twitter-mac MenuItemBehavior -int 1 + +# Enable the hidden ‘Develop’ menu +defaults write com.twitter.twitter-mac ShowDevelopMenu -bool true + +# Open links in the background +defaults write com.twitter.twitter-mac openLinksInBackground -bool true + +# Allow closing the ‘new tweet’ window by pressing `Esc` +defaults write com.twitter.twitter-mac ESCClosesComposeWindow -bool true + +# Show full names rather than Twitter handles +defaults write com.twitter.twitter-mac ShowFullNames -bool true + +# Hide the app in the background if it’s not the front-most window +defaults write com.twitter.twitter-mac HideInBackground -bool true + +############################################################################### +# Kill affected applications # +############################################################################### + +for app in "Address Book" "Calendar" "Contacts" "Dashboard" "Dock" "Finder" \ + "Mail" "Safari" "SizeUp" "SystemUIServer" "Terminal" "Transmission" \ + "Twitter" "iCal" "iTunes"; do + killall "$app" > /dev/null 2>&1 +done +echo "Done. Note that some of these changes require a logout/restart to take effect." \ No newline at end of file diff --git a/.screenrc b/.screenrc new file mode 100644 index 00000000..8f3a37f6 --- /dev/null +++ b/.screenrc @@ -0,0 +1,2 @@ +# Disable the startup message +startup_message off \ No newline at end of file diff --git a/.vim/backups/.gitignore b/.vim/backups/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/.vim/colors/molokai.vim b/.vim/colors/molokai.vim new file mode 100644 index 00000000..5cb8762d --- /dev/null +++ b/.vim/colors/molokai.vim @@ -0,0 +1,210 @@ +" Vim color file +" +" Author: Tomas Restrepo +" +" Note: Based on the monokai theme for TextMate +" by Wimer Hazenberg and its darker variant +" by Hamish Stuart Macpherson +" + +hi clear + +set background=dark +if version > 580 + " no guarantees for version 5.8 and below, but this makes it stop + " complaining + hi clear + if exists("syntax_on") + syntax reset + endif +endif +let g:colors_name="molokai" + +if exists("g:molokai_original") + let s:molokai_original = g:molokai_original +else + let s:molokai_original = 0 +endif + +hi Boolean guifg=#AE81FF +hi Character guifg=#E6DB74 +hi Number guifg=#AE81FF +hi String guifg=#E6DB74 +hi Conditional guifg=#F92672 gui=bold +hi Constant guifg=#AE81FF gui=bold +hi Cursor guifg=#000000 guibg=#F8F8F0 +hi Debug guifg=#BCA3A3 gui=bold +hi Define guifg=#66D9EF +hi Delimiter guifg=#8F8F8F +hi DiffAdd guibg=#13354A +hi DiffChange guifg=#89807D guibg=#4C4745 +hi DiffDelete guifg=#960050 guibg=#1E0010 +hi DiffText guibg=#4C4745 gui=italic,bold + +hi Directory guifg=#A6E22E gui=bold +hi Error guifg=#960050 guibg=#1E0010 +hi ErrorMsg guifg=#F92672 guibg=#232526 gui=bold +hi Exception guifg=#A6E22E gui=bold +hi Float guifg=#AE81FF +hi FoldColumn guifg=#465457 guibg=#000000 +hi Folded guifg=#465457 guibg=#000000 +hi Function guifg=#A6E22E +hi Identifier guifg=#FD971F +hi Ignore guifg=#808080 guibg=bg +hi IncSearch guifg=#C4BE89 guibg=#000000 + +hi Keyword guifg=#F92672 gui=bold +hi Label guifg=#E6DB74 gui=none +hi Macro guifg=#C4BE89 gui=italic +hi SpecialKey guifg=#66D9EF gui=italic + +hi MatchParen guifg=#000000 guibg=#FD971F gui=bold +hi ModeMsg guifg=#E6DB74 +hi MoreMsg guifg=#E6DB74 +hi Operator guifg=#F92672 + +" complete menu +hi Pmenu guifg=#66D9EF guibg=#000000 +hi PmenuSel guibg=#808080 +hi PmenuSbar guibg=#080808 +hi PmenuThumb guifg=#66D9EF + +hi PreCondit guifg=#A6E22E gui=bold +hi PreProc guifg=#A6E22E +hi Question guifg=#66D9EF +hi Repeat guifg=#F92672 gui=bold +hi Search guifg=#FFFFFF guibg=#455354 +" marks column +hi SignColumn guifg=#A6E22E guibg=#232526 +hi SpecialChar guifg=#F92672 gui=bold +hi SpecialComment guifg=#465457 gui=bold +hi Special guifg=#66D9EF guibg=bg gui=italic +hi SpecialKey guifg=#888A85 gui=italic +if has("spell") + hi SpellBad guisp=#FF0000 gui=undercurl + hi SpellCap guisp=#7070F0 gui=undercurl + hi SpellLocal guisp=#70F0F0 gui=undercurl + hi SpellRare guisp=#FFFFFF gui=undercurl +endif +hi Statement guifg=#F92672 gui=bold +hi StatusLine guifg=#455354 guibg=fg +hi StatusLineNC guifg=#808080 guibg=#080808 +hi StorageClass guifg=#FD971F gui=italic +hi Structure guifg=#66D9EF +hi Tag guifg=#F92672 gui=italic +hi Title guifg=#ef5939 +hi Todo guifg=#FFFFFF guibg=bg gui=bold + +hi Typedef guifg=#66D9EF +hi Type guifg=#66D9EF gui=none +hi Underlined guifg=#808080 gui=underline + +hi VertSplit guifg=#808080 guibg=#080808 gui=bold +hi VisualNOS guibg=#403D3D +hi Visual guibg=#403D3D +hi WarningMsg guifg=#FFFFFF guibg=#333333 gui=bold +hi WildMenu guifg=#66D9EF guibg=#000000 + +if s:molokai_original == 1 + hi Normal guifg=#F8F8F2 guibg=#272822 + hi Comment guifg=#75715E + hi CursorLine guibg=#3E3D32 + hi CursorColumn guibg=#3E3D32 + hi LineNr guifg=#BCBCBC guibg=#3B3A32 + hi NonText guifg=#BCBCBC guibg=#3B3A32 +else + hi Normal guifg=#F8F8F2 guibg=#1B1D1E + hi Comment guifg=#465457 + hi CursorLine guibg=#293739 + hi CursorColumn guibg=#293739 + hi LineNr guifg=#BCBCBC guibg=#232526 + hi NonText guifg=#BCBCBC guibg=#232526 +end + +" +" Support for 256-color terminal +" +if &t_Co > 255 + hi Boolean ctermfg=135 + hi Character ctermfg=144 + hi Number ctermfg=135 + hi String ctermfg=144 + hi Conditional ctermfg=161 cterm=bold + hi Constant ctermfg=135 cterm=bold + hi Cursor ctermfg=16 ctermbg=253 + hi Debug ctermfg=225 cterm=bold + hi Define ctermfg=81 + hi Delimiter ctermfg=241 + + hi DiffAdd ctermbg=24 + hi DiffChange ctermfg=181 ctermbg=239 + hi DiffDelete ctermfg=162 ctermbg=53 + hi DiffText ctermbg=102 cterm=bold + + hi Directory ctermfg=118 cterm=bold + hi Error ctermfg=219 ctermbg=89 + hi ErrorMsg ctermfg=199 ctermbg=16 cterm=bold + hi Exception ctermfg=118 cterm=bold + hi Float ctermfg=135 + hi FoldColumn ctermfg=67 ctermbg=16 + hi Folded ctermfg=67 ctermbg=16 + hi Function ctermfg=118 + hi Identifier ctermfg=208 + hi Ignore ctermfg=244 ctermbg=232 + hi IncSearch ctermfg=193 ctermbg=16 + + hi Keyword ctermfg=161 cterm=bold + hi Label ctermfg=229 cterm=none + hi Macro ctermfg=193 + hi SpecialKey ctermfg=81 + + hi MatchParen ctermfg=16 ctermbg=208 cterm=bold + hi ModeMsg ctermfg=229 + hi MoreMsg ctermfg=229 + hi Operator ctermfg=161 + + " complete menu + hi Pmenu ctermfg=81 ctermbg=16 + hi PmenuSel ctermbg=244 + hi PmenuSbar ctermbg=232 + hi PmenuThumb ctermfg=81 + + hi PreCondit ctermfg=118 cterm=bold + hi PreProc ctermfg=118 + hi Question ctermfg=81 + hi Repeat ctermfg=161 cterm=bold + hi Search ctermfg=253 ctermbg=66 + + " marks column + hi SignColumn ctermfg=118 ctermbg=235 + hi SpecialChar ctermfg=161 cterm=bold + hi SpecialComment ctermfg=245 cterm=bold + hi Special ctermfg=81 ctermbg=232 + hi SpecialKey ctermfg=245 + + hi Statement ctermfg=161 cterm=bold + hi StatusLine ctermfg=238 ctermbg=253 + hi StatusLineNC ctermfg=244 ctermbg=232 + hi StorageClass ctermfg=208 + hi Structure ctermfg=81 + hi Tag ctermfg=161 + hi Title ctermfg=166 + hi Todo ctermfg=231 ctermbg=232 cterm=bold + + hi Typedef ctermfg=81 + hi Type ctermfg=81 cterm=none + hi Underlined ctermfg=244 cterm=underline + + hi VertSplit ctermfg=244 ctermbg=232 cterm=bold + hi VisualNOS ctermbg=238 + hi Visual ctermbg=235 + hi WarningMsg ctermfg=231 ctermbg=238 cterm=bold + hi WildMenu ctermfg=81 ctermbg=16 + + hi Normal ctermfg=252 ctermbg=233 + hi Comment ctermfg=59 + hi CursorLine ctermbg=234 cterm=none + hi CursorColumn ctermbg=234 + hi LineNr ctermfg=250 ctermbg=234 + hi NonText ctermfg=250 ctermbg=234 +end \ No newline at end of file diff --git a/.vim/colors/railscat.vim b/.vim/colors/railscat.vim new file mode 100644 index 00000000..c873179d --- /dev/null +++ b/.vim/colors/railscat.vim @@ -0,0 +1,133 @@ +" Vim color scheme +" +" Name: railscat.vim +" Maintainer: Jeff Kreeftmeijer +" License: public domain +" URL: https://gist.github.com/1523432 +" +" A GUI only extended version of the Railscasts+ theme, that comes with +" Janus [1] and is, in turn, an extension to the original Railscasts theme +" [2], which is a port of the RailsCasts TextMate theme [3] to Vim. +" +" [1] https://github.com/carlhuda/janus +" [2] http://www.vim.org/scripts/script.php?script_id=2175 +" [3] http://railscasts.com/about + +set background=dark +hi clear +if exists("syntax_on") + syntax reset +endif +let g:colors_name = "railscat" + +" Colors +" Brown #BC9458 +" Dark Blue #6D9CBE +" Dark Green #519F50 +" Dark Orange #CC7833 +" Light Blue #D0D0FF +" Light Green #A5C261 +" Tan #FFC66D + +hi Normal guifg=#E6E1DC guibg=#2B2B2B +hi Cursor guibg=#FFFFFF +hi Search guibg=#5A647E +hi Visual guibg=#5A647E + +" Folds +" ----- +" line used for closed folds +hi Folded guifg=#F6F3E8 guibg=#444444 gui=NONE + +" Misc +" ---- +" directory names and other special names in listings +hi Directory guifg=#A5C261 gui=NONE + +" Popup Menu +" ---------- +" normal item in popup +hi Pmenu guifg=#F6F3E8 guibg=#444444 gui=NONE +" selected item in popup +hi PmenuSel guifg=#000000 guibg=#A5C261 gui=NONE +" scrollbar in popup +hi PMenuSbar guibg=#5A647E gui=NONE +" thumb of the scrollbar in the popup +hi PMenuThumb guibg=#AAAAAA gui=NONE + +"rubyComment +hi Comment guifg=#BC9458 gui=italic +hi Todo guifg=#BC9458 guibg=NONE gui=italic + +"rubyPseudoVariable +"nil, self, symbols, etc +hi Constant guifg=#6D9CBE + +"rubyClass, rubyModule, rubyDefine +"def, end, include, etc +hi Define guifg=#CC7833 + +"rubyInterpolation +hi Delimiter guifg=#519F50 + +"rubyError, rubyInvalidVariable +hi Error guifg=#FFFFFF guibg=#990000 + +"rubyFunction +hi Function guifg=#FFC66D gui=NONE + +"rubyIdentifier +"@var, @@var, $var, etc +hi Identifier guifg=#D0D0FF gui=NONE + +"rubyInclude +"include, autoload, extend, load, require +hi Include guifg=#CC7833 gui=NONE + +"rubyKeyword, rubyKeywordAsMethod +"alias, undef, super, yield, callcc, caller, lambda, proc +hi Keyword guifg=#CC7833 + +" same as define +hi Macro guifg=#CC7833 gui=NONE + +"rubyInteger +hi Number guifg=#A5C261 + +" #if, #else, #endif +hi PreCondit guifg=#CC7833 gui=NONE + +" generic preprocessor +hi PreProc guifg=#CC7833 gui=NONE + +"rubyControl, rubyAccess, rubyEval +"case, begin, do, for, if unless, while, until else, etc. +hi Statement guifg=#CC7833 gui=NONE + +"rubyString +hi String guifg=#A5C261 + +hi Title guifg=#FFFFFF + +"rubyConstant +hi Type guifg=#DA4939 gui=NONE + +hi DiffAdd guifg=#E6E1DC guibg=#144212 +hi DiffDelete guifg=#E6E1DC guibg=#660000 + +hi link htmlTag xmlTag +hi link htmlTagName xmlTagName +hi link htmlEndTag xmlEndTag + +hi xmlTag guifg=#E8BF6A +hi xmlTagName guifg=#E8BF6A +hi xmlEndTag guifg=#E8BF6A + +hi StatusLine guibg=#cccccc guifg=#000000 +hi StatusLineNC guibg=#666666 guifg=#333333 +hi CursorLine guibg=#262626 +hi VertSplit guifg=#262626 +hi ColorColumn guibg=#262626 +hi LineNr guifg=#666666 guibg=#333333 +hi NonText guifg=#666666 +hi SignColumn guibg=#666666 \ No newline at end of file diff --git a/.vim/swaps/.gitignore b/.vim/swaps/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/.vim/syntax/json.vim b/.vim/syntax/json.vim new file mode 100644 index 00000000..0f5c900b --- /dev/null +++ b/.vim/syntax/json.vim @@ -0,0 +1,74 @@ +" Vim syntax file +" Language: JSON +" Maintainer: Jeroen Ruigrok van der Werven +" Last Change: 2009-06-16 +" Version: 0.4 +" {{{1 + +" Syntax setup {{{2 +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded + +if !exists("main_syntax") + if version < 600 + syntax clear + elseif exists("b:current_syntax") + finish + endif + let main_syntax = 'json' +endif + +" Syntax: Strings {{{2 +syn region jsonString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=jsonEscape +" Syntax: JSON does not allow strings with single quotes, unlike JavaScript. +syn region jsonStringSQ start=+'+ skip=+\\\\\|\\"+ end=+'+ + +" Syntax: Escape sequences {{{3 +syn match jsonEscape "\\["\\/bfnrt]" contained +syn match jsonEscape "\\u\x\{4}" contained + +" Syntax: Strings should always be enclosed with quotes. +syn match jsonNoQuotes "\<\a\+\>" + +" Syntax: Numbers {{{2 +syn match jsonNumber "-\=\<\%(0\|[1-9]\d*\)\%(\.\d\+\)\=\%([eE][-+]\=\d\+\)\=\>" + +" Syntax: An integer part of 0 followed by other digits is not allowed. +syn match jsonNumError "-\=\<0\d\.\d*\>" + +" Syntax: Boolean {{{2 +syn keyword jsonBoolean true false + +" Syntax: Null {{{2 +syn keyword jsonNull null + +" Syntax: Braces {{{2 +syn match jsonBraces "[{}\[\]]" + +" Define the default highlighting. {{{1 +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_json_syn_inits") + if version < 508 + let did_json_syn_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + HiLink jsonString String + HiLink jsonEscape Special + HiLink jsonNumber Number + HiLink jsonBraces Operator + HiLink jsonNull Function + HiLink jsonBoolean Boolean + + HiLink jsonNumError Error + HiLink jsonStringSQ Error + HiLink jsonNoQuotes Error + delcommand HiLink +endif + +let b:current_syntax = "json" +if main_syntax == 'json' + unlet main_syntax +endif \ No newline at end of file diff --git a/.vim/undo/.gitignore b/.vim/undo/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/.vimrc b/.vimrc new file mode 100644 index 00000000..d115c11c --- /dev/null +++ b/.vimrc @@ -0,0 +1,96 @@ +" Make Vim more useful +set nocompatible +" Use the OS clipboard by default (on versions compiled with `+clipboard`) +set clipboard=unnamed +" Enhance command-line completion +set wildmenu +" Allow cursor keys in insert mode +set esckeys +" Allow backspace in insert mode +set backspace=indent,eol,start +" Optimize for fast terminal connections +set ttyfast +" Add the g flag to search/replace by default +set gdefault +" Use UTF-8 without BOM +set encoding=utf-8 nobomb +" Change mapleader +let mapleader="," +" Don’t add empty newlines at the end of files +set binary +set noeol +" Centralize backups, swapfiles and undo history +set backupdir=~/.vim/backups +set directory=~/.vim/swaps +if exists("&undodir") + set undodir=~/.vim/undo +endif + +" Respect modeline in files +set modeline +set modelines=4 +" Enable per-directory .vimrc files and disable unsafe commands in them +set exrc +set secure +" Enable line numbers +set number +" Enable syntax highlighting +syntax on +" Highlight current line +set cursorline +" Make tabs as wide as two spaces +set tabstop=2 +" Show “invisible” characters +set lcs=tab:▸\ ,trail:·,eol:¬,nbsp:_ +set list +" Highlight searches +set hlsearch +" Ignore case of searches +set ignorecase +" Highlight dynamically as pattern is typed +set incsearch +" Always show status line +set laststatus=2 +" Enable mouse in all modes +set mouse=a +" Disable error bells +set noerrorbells +" Don’t reset cursor to start of line when moving around. +set nostartofline +" Show the cursor position +set ruler +" Don’t show the intro message when starting Vim +set shortmess=atI +" Show the current mode +set showmode +" Show the filename in the window titlebar +set title +" Show the (partial) command as it’s being typed +set showcmd +" Use relative line numbers +if exists("&relativenumber") + set relativenumber + au BufReadPost * set relativenumber +endif +" Start scrolling three lines before the horizontal window border +set scrolloff=3 + +" Strip trailing whitespace (,ss) +function! StripWhitespace() + let save_cursor = getpos(".") + let old_query = getreg('/') + :%s/\s\+$//e + call setpos('.', save_cursor) + call setreg('/', old_query) +endfunction +noremap ss :call StripWhitespace() +" Save a file as root (,W) +noremap W :w !sudo tee % > /dev/null + +" Automatic commands +if has("autocmd") + " Enable file type detection + filetype on + " Treat .json files as .js + autocmd BufNewFile,BufRead *.json setfiletype json syntax=javascript +endif \ No newline at end of file diff --git a/.wgetrc b/.wgetrc new file mode 100644 index 00000000..249f360f --- /dev/null +++ b/.wgetrc @@ -0,0 +1,38 @@ +# Use the server-provided last modification date, if available +timestamping = on + +# Do not go up in the directory structure when downloading recursively +no_parent = on + +# Wait 60 seconds before timing out. This applies to all timeouts: DNS, connect and read. (The default read timeout is 15 minutes!) +timeout = 60 + +# Retry a few times when a download fails, but don’t overdo it. (The default is 20!) +tries = 3 + +# Retry even when the connection was refused +retry_connrefused = on + +# Use the last component of a redirection URL for the local file name +trust_server_names = on + +# Follow FTP links from HTML documents by default +follow_ftp = on + +# Add a `.html` extension to `text/html` or `application/xhtml+xml` files that lack one, or a `.css` extension to `text/css` files that lack one +adjust_extension = on + +# Use UTF-8 as the default system encoding +# Disabled as it makes `wget` builds that don’t support this feature unusable. +# Does anyone know how to conditionally configure a wget setting? +# http://unix.stackexchange.com/q/34730/6040 +#local_encoding = UTF-8 + +# Ignore `robots.txt` and `` +robots = off + +# Print the HTTP and FTP server responses +server_response = on + +# Disguise as IE 9 on Windows 7 +user_agent = Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0) \ No newline at end of file diff --git a/README.md b/README.md index 36dc4409..62c9c5da 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,100 @@ # Mathias’s dotfiles +## Installation + +### Using Git and the bootstrap script + +You can clone the repository wherever you want. (I like to keep it in `~/Projects/dotfiles`, with `~/dotfiles` as a symlink.) The bootstrapper script will pull in the latest version and copy the files to your home folder. + +```bash +git clone https://github.com/mathiasbynens/dotfiles.git && cd dotfiles && source bootstrap.sh +``` + +To update, `cd` into your local `dotfiles` repository and then: + +```bash +source bootstrap.sh +``` + +Alternatively, to update while avoiding the confirmation prompt: + +```bash +set -- -f; source bootstrap.sh +``` + +### Git-free install + +To install these dotfiles without Git: + +```bash +cd; curl -#L https://github.com/mathiasbynens/dotfiles/tarball/master | tar -xzv --strip-components 1 --exclude={README.md,bootstrap.sh} +``` + +To update later on, just run that command again. + +### Specify the `$PATH` + +If `~/.path` exists, it will be sourced along with the other files, before any feature testing (such as [detecting which version of `ls` is being used](https://github.com/mathiasbynens/dotfiles/blob/aff769fd75225d8f2e481185a71d5e05b76002dc/.aliases#L21-26)) takes place. + +Here’s an example `~/.path` file that adds `~/utils` to the `$PATH`: + +```bash +export PATH="$HOME/utils:$PATH" +``` + +### Add custom commands without creating a new fork + +If `~/.extra` exists, it will be sourced along with the other files. You can use this to add a few custom commands without the need to fork this entire repository, or to add commands you don’t want to commit to a public repository. + +My `~/.extra` looks something like this: + +```bash +# PATH additions +export PATH="~/bin:$PATH" + +# Git credentials +# Not in the repository, to prevent people from accidentally committing under my name +GIT_AUTHOR_NAME="Mathias Bynens" +GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME" +git config --global user.name "$GIT_AUTHOR_NAME" +GIT_AUTHOR_EMAIL="mathias@mailinator.com" +GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL" +git config --global user.email "$GIT_AUTHOR_EMAIL" +``` + +You could also use `~/.extra` to override settings, functions and aliases from my dotfiles repository. It’s probably better to [fork this repository](https://github.com/mathiasbynens/dotfiles/fork_select) instead, though. + +### Sensible OS X defaults + +When setting up a new Mac, you may want to set some sensible OS X defaults: + +```bash +./.osx +``` + +### Install Homebrew formulae + +When setting up a new Mac, you may want to install some common Homebrew formulae (after installing Homebrew, of course): + +```bash +./.brew +``` + +## Feedback + Suggestions/improvements [welcome](https://github.com/mathiasbynens/dotfiles/issues)! ## Thanks to… + * [Gianni Chiappetta](http://gf3.ca/) for sharing his [amazing collection of dotfiles](https://github.com/gf3/dotfiles) -* [Matijs Brinkhuis](http://hotfusion.nl/) and his [homedir repository](https://github.com/matijs/homedir)) -* [Jan Moesen](http://jan.moesen.nu/) +* [Matijs Brinkhuis](http://hotfusion.nl/) and his [dotfiles repository](https://github.com/matijs/dotfiles) +* [Jan Moesen](http://jan.moesen.nu/) and his [ancient `.bash_profile`](https://gist.github.com/1156154) + [shiny _tilde_ repository](https://github.com/janmoesen/tilde) +* [Ben Alman](http://benalman.com/) and his [dotfiles repository](https://github.com/cowboy/dotfiles) +* [Nicolas Gallagher](http://nicolasgallagher.com/) and his [dotfiles repository](https://github.com/necolas/dotfiles) +* [Tom Ryder](http://blog.sanctum.geek.nz/) and his [dotfiles repository](https://github.com/tejr/dotfiles) +* [Chris Gerke](http://www.randomsquared.com/) and his [tutorial on creating an OS X SOE master image](http://chris-gerke.blogspot.com/2012/04/mac-osx-soe-master-image-day-7.html) + [_Insta_ repository](https://github.com/cgerke/Insta) +* @ptb and [his _OS X Lion Setup_ repository](https://github.com/ptb/Mac-OS-X-Lion-Setup) +* [Lauri ‘Lri’ Ranta](http://lri.me/) for sharing [loads of hidden preferences](http://lri.me/osx.html#hidden-preferences) * [Tim Esselens](http://devel.datif.be/) +* anyone who [contributed a patch](https://github.com/mathiasbynens/dotfiles/contributors) or [made a helpful suggestion](https://github.com/mathiasbynens/dotfiles/issues) \ No newline at end of file diff --git a/bin/bash b/bin/bash new file mode 120000 index 00000000..c46b67e6 --- /dev/null +++ b/bin/bash @@ -0,0 +1 @@ +/usr/local/Cellar/bash/4.2.42/bin/bash \ No newline at end of file diff --git a/bin/subl b/bin/subl new file mode 120000 index 00000000..452a9897 --- /dev/null +++ b/bin/subl @@ -0,0 +1 @@ +/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl \ No newline at end of file diff --git a/bootstrap.sh b/bootstrap.sh index c7fd02e4..8a053a72 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1 +1,17 @@ -git pull && rsync --exclude ".git/" --exclude ".DS_Store" --exclude "bootstrap.sh" --exclude "README.md" -av . ~ +#!/bin/bash +cd "$(dirname "${BASH_SOURCE}")" +git pull +function doIt() { + rsync --exclude ".git/" --exclude ".DS_Store" --exclude "bootstrap.sh" --exclude "README.md" -av . ~ +} +if [ "$1" == "--force" -o "$1" == "-f" ]; then + doIt +else + read -p "This may overwrite existing files in your home directory. Are you sure? (y/n) " -n 1 + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + doIt + fi +fi +unset doIt +source ~/.bash_profile \ No newline at end of file diff --git a/init/Mathias.terminal b/init/Mathias.terminal new file mode 100644 index 00000000..e8732a56 --- /dev/null +++ b/init/Mathias.terminal @@ -0,0 +1,232 @@ + + + + + ANSIBlackColor + + YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS + AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NGMCAw + IDAAEAGAAtIQERITWiRjbGFzc25hbWVYJGNsYXNzZXNXTlNDb2xvcqISFFhOU09iamVj + dF8QD05TS2V5ZWRBcmNoaXZlctEXGFRyb290gAEIERojLTI3O0FITltiaWttcn2GjpGa + rK+0AAAAAAAAAQEAAAAAAAAAGQAAAAAAAAAAAAAAAAAAALY= + + ANSIBlueColor + + YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS + AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPEBww + Ljc2ODYyNzQ2NDggMC41NTI5NDEyMDMxIDEAEAGAAtIQERITWiRjbGFzc25hbWVYJGNs + YXNzZXNXTlNDb2xvcqISFFhOU09iamVjdF8QD05TS2V5ZWRBcmNoaXZlctEXGFRyb290 + gAEIERojLTI3O0FITltigYOFipWepqmyxMfMAAAAAAAAAQEAAAAAAAAAGQAAAAAAAAAA + AAAAAAAAAM4= + + ANSIBrightBlackColor + + YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS + AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPECcw + LjMzMzMzMzMzMzMgMC4zMzMzMzMzMzMzIDAuMzMzMzMzMzMzMwAQAYAC0hAREhNaJGNs + YXNzbmFtZVgkY2xhc3Nlc1dOU0NvbG9yohIUWE5TT2JqZWN0XxAPTlNLZXllZEFyY2hp + dmVy0RcYVHJvb3SAAQgRGiMtMjc7QUhOW2KMjpCVoKmxtL3P0tcAAAAAAAABAQAAAAAA + AAAZAAAAAAAAAAAAAAAAAAAA2Q== + + ANSIBrightBlueColor + + YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS + AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPEBww + LjMzMzMzMzM0MzMgMC4zMzMzMzMzNDMzIDEAEAGAAtIQERITWiRjbGFzc25hbWVYJGNs + YXNzZXNXTlNDb2xvcqISFFhOU09iamVjdF8QD05TS2V5ZWRBcmNoaXZlctEXGFRyb290 + gAEIERojLTI3O0FITltigYOFipWepqmyxMfMAAAAAAAAAQEAAAAAAAAAGQAAAAAAAAAA + AAAAAAAAAM4= + + ANSIBrightCyanColor + + YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS + AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPEBEw + LjMzMzMzMzM0MzMgMSAxABABgALSEBESE1okY2xhc3NuYW1lWCRjbGFzc2VzV05TQ29s + b3KiEhRYTlNPYmplY3RfEA9OU0tleWVkQXJjaGl2ZXLRFxhUcm9vdIABCBEaIy0yNztB + SE5bYnZ4en+Kk5uep7m8wQAAAAAAAAEBAAAAAAAAABkAAAAAAAAAAAAAAAAAAADD + + ANSIBrightGreenColor + + YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS + AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPEBww + LjMzMzMzMzM0MzMgMSAwLjMzMzMzMzM0MzMAEAGAAtIQERITWiRjbGFzc25hbWVYJGNs + YXNzZXNXTlNDb2xvcqISFFhOU09iamVjdF8QD05TS2V5ZWRBcmNoaXZlctEXGFRyb290 + gAEIERojLTI3O0FITltigYOFipWepqmyxMfMAAAAAAAAAQEAAAAAAAAAGQAAAAAAAAAA + AAAAAAAAAM4= + + ANSIBrightMagentaColor + + YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS + AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPEBEx + IDAuMzMzMzMzMzQzMyAxABABgALSEBESE1okY2xhc3NuYW1lWCRjbGFzc2VzV05TQ29s + b3KiEhRYTlNPYmplY3RfEA9OU0tleWVkQXJjaGl2ZXLRFxhUcm9vdIABCBEaIy0yNztB + SE5bYnZ4en+Kk5uep7m8wQAAAAAAAAEBAAAAAAAAABkAAAAAAAAAAAAAAAAAAADD + + ANSIBrightRedColor + + YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS + AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPEBwx + IDAuMzMzMzMzMzQzMyAwLjMzMzMzMzM0MzMAEAGAAtIQERITWiRjbGFzc25hbWVYJGNs + YXNzZXNXTlNDb2xvcqISFFhOU09iamVjdF8QD05TS2V5ZWRBcmNoaXZlctEXGFRyb290 + gAEIERojLTI3O0FITltigYOFipWepqmyxMfMAAAAAAAAAQEAAAAAAAAAGQAAAAAAAAAA + AAAAAAAAAM4= + + ANSIBrightWhiteColor + + YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS + AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NGMSAx + IDEAEAGAAtIQERITWiRjbGFzc25hbWVYJGNsYXNzZXNXTlNDb2xvcqISFFhOU09iamVj + dF8QD05TS2V5ZWRBcmNoaXZlctEXGFRyb290gAEIERojLTI3O0FITltiaWttcn2GjpGa + rK+0AAAAAAAAAQEAAAAAAAAAGQAAAAAAAAAAAAAAAAAAALY= + + ANSIBrightYellowColor + + YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS + AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPEBEx + IDEgMC4zMzMzMzMzNDMzABABgALSEBESE1okY2xhc3NuYW1lWCRjbGFzc2VzV05TQ29s + b3KiEhRYTlNPYmplY3RfEA9OU0tleWVkQXJjaGl2ZXLRFxhUcm9vdIABCBEaIy0yNztB + SE5bYnZ4en+Kk5uep7m8wQAAAAAAAAEBAAAAAAAAABkAAAAAAAAAAAAAAAAAAADD + + ANSICyanColor + + YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS + AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPECYw + LjQwMzkyMTU3NDQgMC44NTA5ODA0MDEgMC45NDExNzY0NzQxABABgALSEBESE1okY2xh + c3NuYW1lWCRjbGFzc2VzV05TQ29sb3KiEhRYTlNPYmplY3RfEA9OU0tleWVkQXJjaGl2 + ZXLRFxhUcm9vdIABCBEaIy0yNztBSE5bYouNj5SfqLCzvM7R1gAAAAAAAAEBAAAAAAAA + ABkAAAAAAAAAAAAAAAAAAADY + + ANSIGreenColor + + YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS + AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPECUw + LjY1MDk4MDQxMyAwLjg5MDE5NjA4NSAwLjE3NjQ3MDU5MjYAEAGAAtIQERITWiRjbGFz + c25hbWVYJGNsYXNzZXNXTlNDb2xvcqISFFhOU09iamVjdF8QD05TS2V5ZWRBcmNoaXZl + ctEXGFRyb290gAEIERojLTI3O0FITltiioyOk56nr7K7zdDVAAAAAAAAAQEAAAAAAAAA + GQAAAAAAAAAAAAAAAAAAANc= + + ANSIMagentaColor + + YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS + AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPECYw + Ljk4MDM5MjE1OCAwLjE0NTA5ODA0NTUgMC40NTA5ODAzOTUxABABgALSEBESE1okY2xh + c3NuYW1lWCRjbGFzc2VzV05TQ29sb3KiEhRYTlNPYmplY3RfEA9OU0tleWVkQXJjaGl2 + ZXLRFxhUcm9vdIABCBEaIy0yNztBSE5bYouNj5SfqLCzvM7R1gAAAAAAAAEBAAAAAAAA + ABkAAAAAAAAAAAAAAAAAAADY + + ANSIRedColor + + YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS + AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPECcw + Ljg5ODAzOTIyMTggMC4xMzMzMzMzNDAzIDAuMTMzMzMzMzQwMwAQAYAC0hAREhNaJGNs + YXNzbmFtZVgkY2xhc3Nlc1dOU0NvbG9yohIUWE5TT2JqZWN0XxAPTlNLZXllZEFyY2hp + dmVy0RcYVHJvb3SAAQgRGiMtMjc7QUhOW2KMjpCVoKmxtL3P0tcAAAAAAAABAQAAAAAA + AAAZAAAAAAAAAAAAAAAAAAAA2Q== + + ANSIWhiteColor + + YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS + AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPECcw + Ljk0OTAxOTYxMDkgMC45NDkwMTk2MTA5IDAuOTQ5MDE5NjEwOQAQAYAC0hAREhNaJGNs + YXNzbmFtZVgkY2xhc3Nlc1dOU0NvbG9yohIUWE5TT2JqZWN0XxAPTlNLZXllZEFyY2hp + dmVy0RcYVHJvb3SAAQgRGiMtMjc7QUhOW2KMjpCVoKmxtL3P0tcAAAAAAAABAQAAAAAA + AAAZAAAAAAAAAAAAAAAAAAAA2Q== + + ANSIYellowColor + + YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS + AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPECcw + Ljk4ODIzNTI5NDggMC41ODQzMTM3NTAzIDAuMTE3NjQ3MDU5MwAQAYAC0hAREhNaJGNs + YXNzbmFtZVgkY2xhc3Nlc1dOU0NvbG9yohIUWE5TT2JqZWN0XxAPTlNLZXllZEFyY2hp + dmVy0RcYVHJvb3SAAQgRGiMtMjc7QUhOW2KMjpCVoKmxtL3P0tcAAAAAAAABAQAAAAAA + AAAZAAAAAAAAAAAAAAAAAAAA2Q== + + BackgroundBlur + 0.0 + BackgroundColor + + YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS + AAGGoKMHCA9VJG51bGzTCQoLDA0OV05TV2hpdGVcTlNDb2xvclNwYWNlViRjbGFzc0Iw + ABADgALSEBESE1okY2xhc3NuYW1lWCRjbGFzc2VzV05TQ29sb3KiEhRYTlNPYmplY3Rf + EA9OU0tleWVkQXJjaGl2ZXLRFxhUcm9vdIABCBEaIy0yNztBSFBdZGdpa3B7hIyPmKqt + sgAAAAAAAAEBAAAAAAAAABkAAAAAAAAAAAAAAAAAAAC0 + + BlinkText + + CursorBlink + + CursorColor + + YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS + AAGGoKMHCA9VJG51bGzTCQoLDA0OV05TV2hpdGVcTlNDb2xvclNwYWNlViRjbGFzc0sw + LjMwMjQxOTM2ABADgALSEBESE1okY2xhc3NuYW1lWCRjbGFzc2VzV05TQ29sb3KiEhRY + TlNPYmplY3RfEA9OU0tleWVkQXJjaGl2ZXLRFxhUcm9vdIABCBEaIy0yNztBSFBdZHBy + dHmEjZWYobO2uwAAAAAAAAEBAAAAAAAAABkAAAAAAAAAAAAAAAAAAAC9 + + Font + + YnBsaXN0MDDUAQIDBAUGGBlYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS + AAGGoKQHCBESVSRudWxs1AkKCwwNDg8QVk5TU2l6ZVhOU2ZGbGFnc1ZOU05hbWVWJGNs + YXNzI0AqAAAAAAAAEBCAAoADVk1vbmFjb9ITFBUWWiRjbGFzc25hbWVYJGNsYXNzZXNW + TlNGb250ohUXWE5TT2JqZWN0XxAPTlNLZXllZEFyY2hpdmVy0RobVHJvb3SAAQgRGiMt + Mjc8QktSW2JpcnR2eH+Ej5ifoqu9wMUAAAAAAAABAQAAAAAAAAAcAAAAAAAAAAAAAAAA + AAAAxw== + + FontAntialias + + FontHeightSpacing + 1.1 + FontWidthSpacing + 1 + ProfileCurrentVersion + 1.00 + SelectionColor + + YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS + AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPECcw + LjMzMzMzMzMzMzMgMC4zMzMzMzMzMzMzIDAuMzMzMzMzMzMzMwAQAYAC0hAREhNaJGNs + YXNzbmFtZVgkY2xhc3Nlc1dOU0NvbG9yohIUWE5TT2JqZWN0XxAPTlNLZXllZEFyY2hp + dmVy0RcYVHJvb3SAAQgRGiMtMjc7QUhOW2KMjpCVoKmxtL3P0tcAAAAAAAABAQAAAAAA + AAAZAAAAAAAAAAAAAAAAAAAA2Q== + + ShowActiveProcessInTitle + + ShowCommandKeyInTitle + + ShowDimensionsInTitle + + ShowShellCommandInTitle + + ShowTTYNameInTitle + + ShowWindowSettingsNameInTitle + + TextBoldColor + + YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS + AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPECcw + LjczMzMzMzM0OTIgMC43MzMzMzMzNDkyIDAuNzMzMzMzMzQ5MgAQAYAC0hAREhNaJGNs + YXNzbmFtZVgkY2xhc3Nlc1dOU0NvbG9yohIUWE5TT2JqZWN0XxAPTlNLZXllZEFyY2hp + dmVy0RcYVHJvb3SAAQgRGiMtMjc7QUhOW2KMjpCVoKmxtL3P0tcAAAAAAAABAQAAAAAA + AAAZAAAAAAAAAAAAAAAAAAAA2Q== + + TextColor + + YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS + AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NGMSAx + IDEAEAGAAtIQERITWiRjbGFzc25hbWVYJGNsYXNzZXNXTlNDb2xvcqISFFhOU09iamVj + dF8QD05TS2V5ZWRBcmNoaXZlctEXGFRyb290gAEIERojLTI3O0FITltiaWttcn2GjpGa + rK+0AAAAAAAAAQEAAAAAAAAAGQAAAAAAAAAAAAAAAAAAALY= + + UseBrightBold + + WindowTitle + + name + Mathias + shellExitAction + 2 + type + Window Settings + + \ No newline at end of file