From 6c4d0e8aa2412eb682fd65e074740124f592167d Mon Sep 17 00:00:00 2001 From: Artem Sapegin Date: Fri, 12 Oct 2012 12:53:13 +0400 Subject: [PATCH] A lot of new awesome stuff. --- Readme.md | 6 +- bash_aliases | 79 +++++- bash_profile | 184 ++++--------- bash_prompt | 121 ++++++++ color/Solarized Dark.terminal | 168 ++++++++++++ {tools => includes}/root.sh | 0 inputrc | 75 +++++ setup/Readme.md | 7 + setup/log | 0 setup/osx.sh | 500 ++++++++++++++++++++++++++++++++++ sync.py | 2 +- 11 files changed, 998 insertions(+), 144 deletions(-) create mode 100644 bash_prompt create mode 100644 color/Solarized Dark.terminal rename {tools => includes}/root.sh (100%) create mode 100644 inputrc create mode 100644 setup/Readme.md create mode 100644 setup/log create mode 100755 setup/osx.sh diff --git a/Readme.md b/Readme.md index cefe224..40864c8 100644 --- a/Readme.md +++ b/Readme.md @@ -17,7 +17,11 @@ cd ~/dotfiles && git pull && ./sync.py ## Resources [Mathias’s dotfiles](https://github.com/mathiasbynens/dotfiles) +[Jan Moesen’s dotfiles](https://github.com/janmoesen/tilde) +[Yet another cool story about bash prompt](http://habrahabr.ru/company/mailru/blog/145008/) (in Russian) --- -Feel free to fork :-) \ No newline at end of file +Feel free to fork :-) + +:shipit: \ No newline at end of file diff --git a/bash_aliases b/bash_aliases index 8e519f2..72c9b4c 100644 --- a/bash_aliases +++ b/bash_aliases @@ -1,13 +1,78 @@ +# Easier navigation: .., ..., ...., ....., ~ and - +alias ..="cd .." +alias ...="cd ../.." +alias ....="cd ../../.." +alias .....="cd ../../../.." +alias ~="cd ~" +alias -- -="cd -" + +# Shortcuts +alias dr="cd ~/Dropbox" +#alias dl="cd ~/Downloads" +#alias dt="cd ~/Desktop" +alias pj="cd ~/Dropbox/Projects" +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 + +# 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' + +# 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" + +# 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" + +# 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" + +# URL-encode strings +#alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1]);"' + +# Ring the terminal bell, and put a badge on Terminal.app’s Dock icon +# (useful when executing time-consuming commands) +#alias badge="tput bel" + +# HTTP requests +for method in GET HEAD POST PUT DELETE TRACE OPTIONS; do + alias "$method"="lwp-request -m '$method'" +done + +# Convert line endings to UNIX +alias dos2unix="perl -pi -e 's/\r\n?/\n/g' " + # NPM -alias npm-patch='npm version patch -m "Version %s"' -alias npm-release='npm version minor -m "Version %s"' +alias npm-patch='npm version patch -m "%s"' +alias npm-release='npm version minor -m "%s"' # Grunt alias gw="grunt watch --debug" ginit() { grunt init:$@ ;} -# Convert line endings to UNIX -alias dos2unix="perl -pi -e 's/\r\n?/\n/g' " - -# Tools -source ~/dotfiles/tools/root.sh \ No newline at end of file +# Load external aliases +source ~/dotfiles/includes/root.sh \ No newline at end of file diff --git a/bash_profile b/bash_profile index 0136114..b7653d2 100644 --- a/bash_profile +++ b/bash_profile @@ -1,22 +1,23 @@ -# Inspired by: https://github.com/dreadatour/dotfiles/blob/master/.bash_profile - - # Don't put duplicate lines in the history -export HISTCONTROL=ignoreboth,erasedups +export HISTCONTROL=ignoreboth:erasedups # Set history length HISTFILESIZE=1000000000 HISTSIZE=1000000 - # Append to the history file, don't overwrite it shopt -s histappend -# Check the window size after each command and, if necessary, update the values of LINES and COLUMNS. +# Check the window size after each command and, if necessary, update the values of LINES and COLUMNS shopt -s checkwinsize # Autocorrect typos in path names when using `cd` shopt -s cdspell # Save all lines of a multiple-line command in the same history entry (allows easy re-editing of multi-line commands) shopt -s cmdhist +# Do not autocomplete when accidentally pressing Tab on an empty line. (It takes forever and yields "Display all 15 gazillion possibilites?") +shopt -s no_empty_cmd_completion; + +# Do not overwrite files when redirecting using ">". Note that you can still override this with ">|" +set -o noclobber; # Enable some Bash 4 features when possible: # * `autocd`, e.g. `**/qux` will enter `./foo/bar/baz/qux` @@ -25,143 +26,56 @@ for option in autocd globstar; do shopt -s "$option" 2> /dev/null done -# Setup color variables -color_is_on= -color_red= -color_green= -color_yellow= -color_blue= -color_white= -color_gray= -color_bg_red= -color_off= -if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then - color_is_on=true - color_red="\[$(/usr/bin/tput setaf 1)\]" - color_green="\[$(/usr/bin/tput setaf 2)\]" - color_yellow="\[$(/usr/bin/tput setaf 3)\]" - color_blue="\[$(/usr/bin/tput setaf 6)\]" - color_white="\[$(/usr/bin/tput setaf 7)\]" - color_gray="\[$(/usr/bin/tput setaf 8)\]" - color_off="\[$(/usr/bin/tput sgr0)\]" - color_error="$(/usr/bin/tput setab 1)$(/usr/bin/tput setaf 7)" - color_error_off="$(/usr/bin/tput sgr0)" - - # set user color - case `id -u` in - 0) color_user=$color_red ;; - *) color_user=$color_green ;; - esac -fi - - -# Some kind of optimization - check if git installed only on config load -PS1_GIT_BIN=$(which git 2>/dev/null) - -function prompt_command { - local PS1_GIT= - local GIT_BRANCH= - local GIT_DIRTY= - local PWDNAME=$PWD - - # Beautify working directory name - if [ $HOME == $PWD ]; then - PWDNAME="~" - elif [ $HOME == ${PWD:0:${#HOME}} ]; then - PWDNAME="~${PWD:${#HOME}}" - fi - - # Parse git status and get git variables - if [[ ! -z $PS1_GIT_BIN ]]; then - # check we are in git repo - local CUR_DIR=$PWD - while [[ ! -d "${CUR_DIR}/.git" ]] && [[ ! "${CUR_DIR}" == "/" ]] && [[ ! "${CUR_DIR}" == "~" ]] && [[ ! "${CUR_DIR}" == "" ]]; do CUR_DIR=${CUR_DIR%/*}; done - if [[ -d "${CUR_DIR}/.git" ]]; then - # 'git repo for dotfiles' fix: show git status only in home dir and other git repos - if [[ "${CUR_DIR}" != "${HOME}" ]] || [[ "${PWD}" == "${HOME}" ]]; then - # get git branch - GIT_BRANCH=$($PS1_GIT_BIN symbolic-ref HEAD 2>/dev/null) - if [[ ! -z $GIT_BRANCH ]]; then - GIT_BRANCH=${GIT_BRANCH#refs/heads/} - - # get git status - local GIT_STATUS=$($PS1_GIT_BIN status --porcelain 2>/dev/null) - [[ -n $GIT_STATUS ]] && GIT_DIRTY=1 - fi - fi - fi - fi - - # Build B&W prompt for git - [[ ! -z $GIT_BRANCH ]] && PS1_GIT=" #${GIT_BRANCH}" - - # Calculate prompt length - local PS1_length=$((${#USER}+${#HOSTNAME}+${#PWDNAME}+${#PS1_GIT}+3)) - local FILL= - - # Of length is greater, than terminal width - if [[ $PS1_length -gt $COLUMNS ]]; then - # strip working directory name - PWDNAME="...${PWDNAME:$(($PS1_length-$COLUMNS+3))}" - else - # else calculate fillsize - local fillsize=$(($COLUMNS-$PS1_length)) - FILL=$color_gray - while [[ $fillsize -gt 0 ]]; do FILL="${FILL}─"; fillsize=$(($fillsize-1)); done - FILL="${FILL}${color_off}" - fi - - if $color_is_on; then - # Git status for prompt - if [ ! -z $GIT_BRANCH ]; then - if [ -z $GIT_DIRTY ]; then - PS1_GIT=" #${color_green}${GIT_BRANCH}${color_off}" - else - PS1_GIT=" #${color_red}${GIT_BRANCH}${color_off}" - fi - fi - fi - - # set new color prompt - PS1="${color_user}${USER}${color_off}@${color_yellow}${HOSTNAME}${color_off}:${color_white}${PWDNAME}${color_off}${PS1_GIT} ${FILL}\n→ " - - # get cursor position and add new line if we're not in first column - # cool'n'dirty trick (http://stackoverflow.com/a/2575525/1164595) - # XXX FIXME: this hack broke ssh =( - # exec < /dev/tty - # local OLDSTTY=$(stty -g) - # stty raw -echo min 0 - # echo -en "\033[6n" > /dev/tty && read -sdR CURPOS - # stty $OLDSTTY - echo -en "\033[6n" && read -sdR CURPOS - [[ ${CURPOS##*;} -gt 1 ]] && echo "${color_error}●${color_error_off}" - - # Set title - echo -ne "\033]0;${USER}@${HOSTNAME}:${PWDNAME}"; echo -ne "\007" -} - -# Set prompt command (title update and color prompt) -PROMPT_COMMAND=prompt_command -# Set new B&W prompt (will be overwritten in `prompt_command` later with color prompt) -PS1='\u@\h:\w\$ ' - -# If possible, add tab completion for many more commands -[ -f /etc/bash_completion ] && source /etc/bash_completion - -# Bash aliases -[ -f ~/.bash_aliases ] && source ~/.bash_aliases - -# 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 - +# Locale export LC_ALL=en_US.UTF-8 export LANG="en_US" # Add `~/bin` to the `$PATH` export PATH="$HOME/bin:/usr/local/bin:$PATH" +# If possible, add tab completion for many commands +[ -f /etc/bash_completion ] && source /etc/bash_completion + +# Aliases and prompt +[ -f ~/.bash_aliases ] && source ~/.bash_aliases +[ -f ~/.bash_prompt ] && source ~/.bash_prompt + +# 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 + +# Nano is default editor +export EDITOR='nano'; + # Tell ls to be colourful export CLICOLOR=1 # Tell grep to highlight matches export GREP_OPTIONS='--color=auto' + +# Make less the default pager, and specify some useful defaults. +less_options=( + # If the entire text fits on one screen, just show it and quit. (Be more + # like "cat" and less like "more".) + --quit-if-one-screen + + # Do not clear the screen first. + --no-init + + # Like "smartcase" in Vim: ignore case unless the search pattern is mixed. + --ignore-case + + # Do not automatically wrap long lines. + --chop-long-lines + + # Allow ANSI colour escapes, but no other escapes. + --RAW-CONTROL-CHARS + + # Do not ring the bell when trying to scroll past the end of the buffer. + --quiet + + # Do not complain when we are on a dumb terminal. + --dumb +); +export LESS="${less_options[*]}"; +unset less_options; +export PAGER='less'; diff --git a/bash_prompt b/bash_prompt new file mode 100644 index 0000000..5a35f64 --- /dev/null +++ b/bash_prompt @@ -0,0 +1,121 @@ +# Inspired by: https://github.com/dreadatour/dotfiles/blob/master/.bash_profile + +# Setup color variables +color_is_on= +color_red= +color_green= +color_yellow= +color_blue= +color_white= +color_gray= +color_bg_red= +color_off= +if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then + color_is_on=true + color_red="\[$(/usr/bin/tput setaf 1)\]" + color_green="\[$(/usr/bin/tput setaf 2)\]" + color_yellow="\[$(/usr/bin/tput setaf 3)\]" + color_blue="\[$(/usr/bin/tput setaf 6)\]" + color_white="\[$(/usr/bin/tput setaf 7)\]" + color_gray="\[$(/usr/bin/tput setaf 8)\]" + color_off="\[$(/usr/bin/tput sgr0)\]" + color_error="$(/usr/bin/tput setab 1)$(/usr/bin/tput setaf 7)" + color_error_off="$(/usr/bin/tput sgr0)" + + # set user color + case `id -u` in + 0) color_user=$color_red ;; + *) color_user=$color_green ;; + esac +fi + + +# Some kind of optimization - check if git installed only on config load +PS1_GIT_BIN=$(which git 2>/dev/null) + +function prompt_command { + local PS1_GIT= + local GIT_BRANCH= + local GIT_DIRTY= + local PWDNAME=$PWD + + # Beautify working directory name + if [ $HOME == $PWD ]; then + PWDNAME="~" + elif [ $HOME == ${PWD:0:${#HOME}} ]; then + PWDNAME="~${PWD:${#HOME}}" + fi + + # Parse git status and get git variables + if [[ ! -z $PS1_GIT_BIN ]]; then + # check we are in git repo + local CUR_DIR=$PWD + while [[ ! -d "${CUR_DIR}/.git" ]] && [[ ! "${CUR_DIR}" == "/" ]] && [[ ! "${CUR_DIR}" == "~" ]] && [[ ! "${CUR_DIR}" == "" ]]; do CUR_DIR=${CUR_DIR%/*}; done + if [[ -d "${CUR_DIR}/.git" ]]; then + # 'git repo for dotfiles' fix: show git status only in home dir and other git repos + if [[ "${CUR_DIR}" != "${HOME}" ]] || [[ "${PWD}" == "${HOME}" ]]; then + # get git branch + GIT_BRANCH=$($PS1_GIT_BIN symbolic-ref HEAD 2>/dev/null) + if [[ ! -z $GIT_BRANCH ]]; then + GIT_BRANCH=${GIT_BRANCH#refs/heads/} + + # get git status + local GIT_STATUS=$($PS1_GIT_BIN status --porcelain 2>/dev/null) + [[ -n $GIT_STATUS ]] && GIT_DIRTY=1 + fi + fi + fi + fi + + # Build B&W prompt for git + [[ ! -z $GIT_BRANCH ]] && PS1_GIT=" #${GIT_BRANCH}" + + # Calculate prompt length + local PS1_length=$((${#USER}+${#HOSTNAME}+${#PWDNAME}+${#PS1_GIT}+3)) + local FILL= + + # Of length is greater, than terminal width + if [[ $PS1_length -gt $COLUMNS ]]; then + # strip working directory name + PWDNAME="...${PWDNAME:$(($PS1_length-$COLUMNS+3))}" + else + # else calculate fillsize + local fillsize=$(($COLUMNS-$PS1_length)) + FILL=$color_gray + while [[ $fillsize -gt 0 ]]; do FILL="${FILL}─"; fillsize=$(($fillsize-1)); done + FILL="${FILL}${color_off}" + fi + + if $color_is_on; then + # Git status for prompt + if [ ! -z $GIT_BRANCH ]; then + if [ -z $GIT_DIRTY ]; then + PS1_GIT=" #${color_green}${GIT_BRANCH}${color_off}" + else + PS1_GIT=" #${color_red}${GIT_BRANCH}${color_off}" + fi + fi + fi + + # set new color prompt + PS1="${color_user}${USER}${color_off}@${color_yellow}${HOSTNAME}${color_off}:${color_white}${PWDNAME}${color_off}${PS1_GIT} ${FILL}\n→ " + + # get cursor position and add new line if we're not in first column + # cool'n'dirty trick (http://stackoverflow.com/a/2575525/1164595) + # XXX FIXME: this hack broke ssh =( + # exec < /dev/tty + # local OLDSTTY=$(stty -g) + # stty raw -echo min 0 + # echo -en "\033[6n" > /dev/tty && read -sdR CURPOS + # stty $OLDSTTY + echo -en "\033[6n" && read -sdR CURPOS + [[ ${CURPOS##*;} -gt 1 ]] && echo "${color_error}●${color_error_off}" + + # Set title + echo -ne "\033]0;${USER}@${HOSTNAME}:${PWDNAME}"; echo -ne "\007" +} + +# Set prompt command (title update and color prompt) +PROMPT_COMMAND=prompt_command +# Set new B&W prompt (will be overwritten in `prompt_command` later with color prompt) +PS1='\u@\h:\w\$ ' diff --git a/color/Solarized Dark.terminal b/color/Solarized Dark.terminal new file mode 100644 index 0000000..9e7c6e4 --- /dev/null +++ b/color/Solarized Dark.terminal @@ -0,0 +1,168 @@ + + + + + BackgroundBlur + 0.0 + BackgroundColor + + YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS + AAGGoKMHCA9VJG51bGzTCQoLDA0OViRjbGFzc1xOU0NvbG9yU3BhY2VVTlNSR0KAAhAB + TxAoMC4wMTU5MjQ0MDUzMSAwLjEyNjUyMDkxNjggMC4xNTk2OTYwMTI3ANIQERITWiRj + bGFzc25hbWVYJGNsYXNzZXNXTlNDb2xvcqISFFhOU09iamVjdF8QD05TS2V5ZWRBcmNo + aXZlctEXGFRyb290gAEIERojLTI3O0FIT1xiZGaRlqGqsrW+0NPYAAAAAAAAAQEAAAAA + AAAAGQAAAAAAAAAAAAAAAAAAANo= + + Bell + + BlinkText + + CursorColor + + YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS + AAGGoKMHCA9VJG51bGzTCQoLDA0OViRjbGFzc1xOU0NvbG9yU3BhY2VVTlNSR0KAAhAB + TxAnMC40NDA1ODAyNDg4IDAuNTA5NjI5MzA5MiAwLjUxNjg1Nzk4MTcA0hAREhNaJGNs + YXNzbmFtZVgkY2xhc3Nlc1dOU0NvbG9yohIUWE5TT2JqZWN0XxAPTlNLZXllZEFyY2hp + dmVy0RcYVHJvb3SAAQgRGiMtMjc7QUhPXGJkZpCVoKmxtL3P0tcAAAAAAAABAQAAAAAA + AAAZAAAAAAAAAAAAAAAAAAAA2Q== + + Font + + YnBsaXN0MDDUAQIDBAUGGBlYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS + AAGGoKQHCBESVSRudWxs1AkKCwwNDg8QViRjbGFzc1ZOU05hbWVWTlNTaXplWE5TZkZs + YWdzgAOAAiNALAAAAAAAABAQWENvbnNvbGFz0hMUFRZaJGNsYXNzbmFtZVgkY2xhc3Nl + c1ZOU0ZvbnSiFRdYTlNPYmplY3RfEA9OU0tleWVkQXJjaGl2ZXLRGhtUcm9vdIABCBEa + Iy0yNzxCS1JZYGlrbXZ4gYaRmqGkrb/CxwAAAAAAAAEBAAAAAAAAABwAAAAAAAAAAAAA + AAAAAADJ + + FontAntialias + + FontWidthSpacing + 1.004032258064516 + ProfileCurrentVersion + 2.02 + SelectionColor + + YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS + AAGGoKMHCA9VJG51bGzTCQoLDA0OViRjbGFzc1xOU0NvbG9yU3BhY2VVTlNSR0KAAhAB + TxAoMC4wMzkzODA3MzY2NSAwLjE2MDExNjQ2MzkgMC4xOTgzMzI3NTY4ANIQERITWiRj + bGFzc25hbWVYJGNsYXNzZXNXTlNDb2xvcqISFFhOU09iamVjdF8QD05TS2V5ZWRBcmNo + aXZlctEXGFRyb290gAEIERojLTI3O0FIT1xiZGaRlqGqsrW+0NPYAAAAAAAAAQEAAAAA + AAAAGQAAAAAAAAAAAAAAAAAAANo= + + ShowDimensionsInTitle + + ShowWindowSettingsNameInTitle + + TerminalType + ansi + TextBoldColor + + YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS + AAGGoKMHCA9VJG51bGzTCQoLDA0OViRjbGFzc1xOU0NvbG9yU3BhY2VVTlNSR0KAAhAB + TxAmMC41MDU5OTE5MzU3IDAuNTY0ODU4Mzc3IDAuNTYzNjM2NTQxNADSEBESE1okY2xh + c3NuYW1lWCRjbGFzc2VzV05TQ29sb3KiEhRYTlNPYmplY3RfEA9OU0tleWVkQXJjaGl2 + ZXLRFxhUcm9vdIABCBEaIy0yNztBSE9cYmRmj5SfqLCzvM7R1gAAAAAAAAEBAAAAAAAA + ABkAAAAAAAAAAAAAAAAAAADY + + TextColor + + YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS + AAGGoKMHCA9VJG51bGzTCQoLDA0OViRjbGFzc1xOU0NvbG9yU3BhY2VVTlNSR0KAAhAB + TxAnMC40NDA1ODAyNDg4IDAuNTA5NjI5MzA5MiAwLjUxNjg1Nzk4MTcA0hAREhNaJGNs + YXNzbmFtZVgkY2xhc3Nlc1dOU0NvbG9yohIUWE5TT2JqZWN0XxAPTlNLZXllZEFyY2hp + dmVy0RcYVHJvb3SAAQgRGiMtMjc7QUhPXGJkZpCVoKmxtL3P0tcAAAAAAAABAQAAAAAA + AAAZAAAAAAAAAAAAAAAAAAAA2Q== + + UseBoldFonts + + UseBrightBold + + VisualBell + + blackColour + + BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm + ZmZmg7JNIT2DkvUjPoO+F0s+AYY= + + blueColour + + BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm + ZmZmgyqcAj6DtOHsPoO+RUg/AYY= + + brightBlackColour + + BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm + ZmZmg+ZzgjyDs44BPoNahyM+AYY= + + brightBlueColour + + BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm + ZmZmg7yT4T6DEXcCP4POUAQ/AYY= + + brightCyanColour + + BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm + ZmZmg7CIAT+Dj5oQP4N8ShA/AYY= + + brightGreenColour + + BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm + ZmZmgzyujT6DFZy2PoOYFsQ+AYY= + + brightMagentaColour + + BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm + ZmZmgxMjsj6D+uazPoNkyTc/AYY= + + brightRedColour + + BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm + ZmZmgyfkPT+D/15aPoMgl5Y9AYY= + + brightWhiteColour + + BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm + ZmZmg49LfT+D0Dt1P4MGM10/AYY= + + brightYellowColour + + BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm + ZmZmg1MTpj6DeHnQPoPQg+A+AYY= + + cyanColour + + BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm + ZmZmg4VRFj6DfyESP4PkZwY/AYY= + + greenColour + + BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm + ZmZmg9lI5j6DIYkKP4PVjKU8AYY= + + magentaColour + + BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm + ZmZmg/4CRz+DBTzdPYMgzt4+AYY= + + name + Solarized Dark + redColour + + BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm + ZmZmg6i7UT+DUATePYMl2hA+AYY= + + type + Window Settings + whiteColour + + BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm + ZmZmgzqGaj+D2tdjP4NYPUw/AYY= + + yellowColour + + BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm + ZmZmg0DAJT+DB17vPoM4Y8A8AYY= + + + diff --git a/tools/root.sh b/includes/root.sh similarity index 100% rename from tools/root.sh rename to includes/root.sh diff --git a/inputrc b/inputrc new file mode 100644 index 0000000..4b1cde8 --- /dev/null +++ b/inputrc @@ -0,0 +1,75 @@ +# Inspired by: https://github.com/janmoesen/tilde/blob/master/.inputrc + +# +# Autocompletion +# + +# Make Tab autocompletion case-insensitive (cd ~/dow => cd ~/Downloads/) +set completion-ignore-case On + +# When autocompleting symlinks to directories, immediately add a trailing "/" +set mark-symlinked-directories on + +# Do not expand "~" to the home directory when completing. (The actual value passed on to the command still is expanded, +# though. Which is good.) "Off" is the default value, but some servers override this +set expand-tilde off + +# Flip through autocompletion matches with Shift-Tab +"\e[Z": menu-complete + +# Do not autocomplete hidden files ("dot 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 + +# Immediately show all possible completions +set show-all-if-ambiguous on + +# 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 + +# 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 + + +# +# Line editing +# + +# Allow UTF-8 input and output, instead of showing them 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 + +# Delete for wonky terminals +"\e[3~": delete-char + +# Use Ctrl+← and Ctrl+→ (or Alt/Meta, or Esc) to move between words +"\e[1;5D": backward-word +"\e[1;3D": backward-word +"\e[5D": backward-word +"\e\e[D": backward-word +"\e[1;5C": forward-word +"\e[1;3C": forward-word +"\e[5C": forward-word +"\e\e[C": forward-word + + +# +# Misc +# + +set bell-style none \ No newline at end of file diff --git a/setup/Readme.md b/setup/Readme.md new file mode 100644 index 0000000..82ce730 --- /dev/null +++ b/setup/Readme.md @@ -0,0 +1,7 @@ +### How to remove US English keyboard layout on Mac OS X + +Useful when you use some kind of [typo layout](http://ilyabirman.ru/projects/typography-layout/). + +```bash +bash <(curl -fsSkL raw.github.com/bolknote/shellgames/master/us_layout_remover.sh) +``` diff --git a/setup/log b/setup/log new file mode 100644 index 0000000..e69de29 diff --git a/setup/osx.sh b/setup/osx.sh new file mode 100755 index 0000000..ff7c25c --- /dev/null +++ b/setup/osx.sh @@ -0,0 +1,500 @@ +#!/bin/bash + +# ~/.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: hide 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 "NO" + +# 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 NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true + +# Expand print panel by default +#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 + +# Don't illuminate built-in MacBook keyboard in low light +defaults write com.apple.BezelServices kDim -bool false +# 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" "ru" +defaults write NSGlobalDomain AppleLocale -string "ru_RU@currency=RUR" +defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters" +defaults write NSGlobalDomain AppleMetricUnits -bool true + +# Set the timezone; see `systemsetup -listtimezones` for other values +systemsetup -settimezone "Europe/Moscow" > /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 subpixel font rendering on non-Apple LCDs +defaults write NSGlobalDomain AppleFontSmoothing -int 2 + +# Enable HiDPI display modes (requires restart) +sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true + +############################################################################### +# Finder # +############################################################################### + +# Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons +defaults write com.apple.finder QuitMenuItem -bool true + +# Finder: disable window animations and Get Info animations +defaults write com.apple.finder DisableAllAnimations -bool true + +# 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: hide status bar +defaults write com.apple.finder ShowStatusBar -bool false + +# Finder: show path bar +defaults write com.apple.finder ShowPathBar -boolean 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 below 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 + +# 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 + +# Finder: disable sounds +defaults write com.apple.finder FinderSounds -boolean false + +# 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-hilte-stack -bool true + +# Set the icon size of Dock items to 60 pixels +defaults write com.apple.dock tilesize -int 60 + +# Enable spring loading for all Dock items +defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true + +# Don't show indicator lights for open applications in the Dock +defaults write com.apple.dock show-process-indicators -bool false + +# 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 + +# Disable icon bouncing (looks like it don't work) +defaults write com.apple.dock no-bouncing -bool true + +# Disable Space switching on Command-Tab +defaults write com.apple.dock workspaces-auto-swoosh -bool false + +# 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 +# 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 + +############################################################################### +# Misc # +############################################################################### + +# Check spelling as you type +defaults write -g CheckSpellingWhileTyping -boolean true + +# Enable continuous spell checking everywhere (don't know what it means) +defaults write -g WebContinuousSpellCheckingEnabled -boolean true + +############################################################################### +# 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 + +# Enable the WebKit Developer Tools in the Mac App Store +defaults write com.apple.appstore WebKitDeveloperExtras -bool true + +############################################################################### +# iTunes # +############################################################################### + +# 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 the Ping sidebar in iTunes +defaults write com.apple.iTunes disablePingSidebar -bool true + +# Disable all the other Ping stuff in iTunes +defaults write com.apple.iTunes disablePing -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" + +############################################################################### +# 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/dotfiles/color/Solarized Dark.terminal" +sleep 1 # Wait a bit to make sure the theme is loaded +defaults write com.apple.terminal "Default Window Settings" -string "Solarized Dark" +defaults write com.apple.terminal "Startup Window Settings" -string "Solarized Dark" + +# 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 +hash tmutil &> /dev/null && sudo tmutil disablelocal + +############################################################################### +# Address Book, Dashboard, iCal, TextEdit, and Disk Utility # +############################################################################### + +# 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 + +############################################################################### +# 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/*" + +############################################################################### +# Sublime Text 2 # +############################################################################### + +# Link Sublime Text 2 command line +ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl + +############################################################################### +# 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/sync.py b/sync.py index 70134c0..eef4e56 100755 --- a/sync.py +++ b/sync.py @@ -9,7 +9,7 @@ Source: https://gist.github.com/490016 import os import glob -EXCLUDE = ['tools', 'sync.py', 'Readme.md'] +EXCLUDE = ['tools', 'color', 'sync.py', 'Readme.md'] NO_DOT_PREFIX = ['bin'] def force_remove(path):