├── .gitignore ├── README.md ├── aliases ├── cacl.sh ├── g.sh ├── git-root.sh ├── k.sh ├── rrm.sh └── vihosts.sh ├── configure.sh ├── configure ├── homebrew.sh └── ssh.sh ├── dotfiles ├── .bashrc │ ├── _generate.sh │ └── common.sh ├── .editorconfig ├── .gitattributes ├── .gitconfig.dist │ ├── README.md │ ├── _generate.sh │ ├── alias │ │ ├── alias │ │ ├── aliases │ │ ├── amend │ │ ├── br │ │ ├── br-gone │ │ ├── br-prune │ │ ├── brp │ │ ├── checkout-pr │ │ ├── ci │ │ ├── co │ │ ├── d │ │ ├── dc │ │ ├── dn │ │ ├── find-merge │ │ ├── forest │ │ ├── graphviz.sh │ │ ├── ign │ │ ├── lg │ │ ├── lg-local │ │ ├── loglines │ │ ├── pf │ │ ├── pp │ │ ├── pu │ │ ├── pull-rebase │ │ ├── pull-rebase-push │ │ ├── rank │ │ ├── remote-default-branch │ │ ├── root │ │ ├── s │ │ ├── searchcommits │ │ ├── show-merge │ │ ├── sn │ │ ├── st │ │ ├── tree │ │ ├── w │ │ └── who │ ├── apply │ │ └── whitespace │ ├── branch │ │ ├── README │ │ ├── autosetuprebase │ │ └── sort │ ├── color │ │ ├── branch │ │ ├── branch.d │ │ │ ├── current │ │ │ ├── local │ │ │ └── remote │ │ ├── diff │ │ ├── diff.d │ │ │ ├── frag │ │ │ ├── meta │ │ │ ├── new │ │ │ └── old │ │ ├── interactive │ │ ├── pager │ │ ├── status │ │ ├── status.d │ │ │ ├── added │ │ │ ├── changed │ │ │ └── untracked │ │ └── ui │ ├── commit │ │ └── gpgsign.sh │ ├── core │ │ ├── attributesfile.sh │ │ ├── editor.sh │ │ ├── excludesfile.sh │ │ ├── pager │ │ ├── trustctime │ │ └── whitespace │ ├── credential │ │ └── helper.sh │ ├── diff-so-fancy │ │ ├── README │ │ ├── changeHunkIndicators │ │ ├── markEmptyLines │ │ └── stripLeadingSymbols │ ├── diff │ │ ├── algorithm │ │ ├── compactionHeuristic │ │ ├── noprefix │ │ ├── renames │ │ └── tool.sh │ ├── difftool │ │ ├── Kaleidoscope │ │ │ └── cmd.sh │ │ ├── diffmerge │ │ │ └── cmd.sh │ │ └── prompt │ ├── fetch │ │ └── prune │ ├── filter │ │ └── lfs │ │ │ ├── clean │ │ │ ├── process │ │ │ ├── required │ │ │ └── smudge │ ├── init │ │ └── defaultBranch │ ├── interactive │ │ └── diffFilter.sh │ ├── merge │ │ ├── README │ │ ├── log │ │ └── tool.sh │ ├── mergetool │ │ ├── Kaleidoscope │ │ │ ├── cmd.sh │ │ │ └── trustExitCode.sh │ │ ├── README │ │ ├── diffmerge │ │ │ ├── cmd.sh │ │ │ └── trustExitCode.sh │ │ └── keepBackup │ ├── pager │ │ ├── diff.sh │ │ └── show.sh │ ├── push │ │ ├── README │ │ └── default │ └── user │ │ ├── email.sh │ │ ├── name.sh │ │ └── signingkey.sh ├── .gitconfig │ └── _generate.sh ├── .gitignore ├── .inputrc ├── .my.cnf │ └── _generate.sh ├── .osx ├── .screenrc ├── .ssh │ ├── authorized_keys │ │ └── _generate.sh │ └── config │ │ └── _generate.sh ├── .tmux.conf │ ├── README.md │ ├── _generate.sh │ ├── parts │ │ ├── 10_bindings │ │ ├── 10_shell.sh │ │ ├── 10_terminal.sh │ │ ├── 15_window_order │ │ ├── 20_pbcopy.sh │ │ ├── 50_envvars │ │ ├── 50_theme │ │ └── 90_other │ ├── status-left │ │ └── 10_whoami │ └── status-right │ │ ├── 10_temperature.sh │ │ ├── 20_battery.sh │ │ ├── 30_load.sh │ │ └── 90_time ├── .vimrc ├── .wgetrc ├── .zer0prompt.conf ├── .zer0prompt.sh └── .zshrc │ └── _generate.sh ├── examples ├── .bashrc ├── .dotfiles-config │ ├── ssh │ │ ├── authorized_keys │ │ │ └── EXAMPLE │ │ └── config │ │ │ ├── ForwardAgent │ │ │ ├── PermitLocalCommand │ │ │ ├── ServerAliveInterval │ │ │ └── hosts │ │ │ └── example │ └── vars │ │ └── HOMEBREW_GITHUB_API_TOKEN ├── .editorconfig ├── .gitattributes ├── .gitconfig ├── .gitconfig.dist ├── .gitignore ├── .inputrc ├── .osx ├── .screenrc ├── .ssh │ ├── authorized_keys │ └── config ├── .tmux.conf ├── .vimrc ├── .wgetrc ├── .zer0prompt.conf ├── .zer0prompt.sh └── .zshrc ├── install.sh ├── lib.sh ├── paths ├── 20_home_bin.sh ├── 25_brew.sh ├── 30_amazon_ec2.sh ├── 30_npm ├── 30_rubymine ├── 30_rvm ├── 40_games └── 40_x11 ├── rc ├── 00_PS1_guard.sh ├── 05_tmux.sh ├── 10_locale.sh ├── 20_boot2docker.sh ├── 20_variables.sh ├── 30_dircolors.sh ├── 30_grep_aliases.sh ├── 30_php_version.sh ├── 30_rvm.sh ├── 30_scm_breeze.sh ├── 30_ssh_settitle.sh ├── 50_aliases.sh ├── 50_bmtools.sh ├── 85_1password_plugins.sh ├── 85_zoxide.sh ├── 95_cd.sh ├── bash │ ├── 10_paths.sh │ ├── 20_bash_completion.sh │ ├── 20_brew_completion.sh │ ├── 20_kubectl_completion.sh │ ├── 30_history.sh │ ├── 30_ls_aliases.sh │ ├── 30_prompt.sh │ └── 50_brew.sh ├── common │ └── paths.sh └── zsh │ ├── 05_zsh_tmux.sh │ ├── 20_paths.sh │ ├── 30_prompt.sh │ ├── 40_iterm2.sh │ ├── 50_brew.sh │ ├── 80_oh-my-zsh.sh │ ├── 90_zsh_options.sh │ └── oh-my-zsh │ └── themes │ └── custom.zsh-theme └── variables ├── EDITOR.d ├── 00_sublime.sh ├── 01_textmate.sh ├── 80_vim.sh ├── 81_vi.sh └── 99_nano.sh ├── GOPATH.sh ├── HOMEBREW_TEMP.sh ├── JAVA_HOME.sh ├── KUBECONFIG.sh ├── LESS └── PAGER /.gitignore: -------------------------------------------------------------------------------- 1 | variables/HOMEBREW_GITHUB_API_TOKEN.sh 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dotfiles Builder 2 | 3 | Compiles `.zshrc` and `.bashrc` using configurations and doing some tests only once. 4 | 5 | For example: 6 | 7 | * Concatenate some paths in $PATH only if directory exists and is not already in $PATH 8 | * Add aliases using easy file structure with auto-escaping 9 | * Determine best locale based on available locales 10 | * Determine best $EDITOR/$VISUAL 11 | * etc. 12 | 13 | The goal is to optimize files like `.bashrc` and `.gitconfig` to only include what works for this specific computer. 14 | 15 | Expensive checks can be done like looping through a lot of choices or even doing a `locate my-program` 16 | because the `.bashrc` is compiled once, not everytime you start a new shell. 17 | 18 | Will auto-detect the presence of many tools and configure accordingly: 19 | 20 | * bash 21 | * boot2docker 22 | * docker 23 | * git 24 | * diff-so-fancy 25 | * diffmerge 26 | * Kaleidoscope 27 | * homebrew 28 | * mysql 29 | * npm 30 | * php 31 | * rvm 32 | * screen 33 | * tmux 34 | * battery-status 35 | * temperature 36 | * vagrant 37 | * zsh 38 | * oh-my-zsh 39 | 40 | ## Usage 41 | 42 | ```bash 43 | ./install.sh # installs it in your home 44 | ./install.sh /tmp/whatever # installs it in another folder 45 | ``` 46 | 47 | See [examples/](examples/) for a list of generated files. 48 | 49 | If you modify your installation or your settings, re-run the build script. 50 | 51 | ## Configuration 52 | 53 | A folder will be created in `$DOTFILES_INSTALL_PATH/.dotfiles-config` 54 | 55 | ### Variables 56 | 57 | `~/.dotfiles-config/vars` override calculated variables 58 | 59 | * Filename must be the variable’s name 60 | * Content must be the variable’s value 61 | * Custom variables also supported 62 | 63 | ### SSH 64 | 65 | Parsed from `$HOME`. 66 | 67 | ## Documentation 68 | 69 | Functions in [lib.sh](lib.sh) are always available. 70 | 71 | ### [`.bashrc` / `.zshrc`](rc) 72 | 73 | All the main scripts are here, for zsh and bash, it will also include the file in the appropriate folder 74 | 75 | * Each script must output its part. 76 | * A comment will be added before each part saying which script it is from. 77 | * Files are sorted as if they were all in the same directory. 78 | 79 | ### [`aliases`](aliases) 80 | 81 | * Each script must output the value of the alias. 82 | * Each script must be named as the name of the alias and end with `.sh`. 83 | 84 | ### [`paths`](paths) 85 | 86 | * Each script must output the value of the path. 87 | * Each outputted path will be tested for existence, no need to do it. 88 | * Files with the highest number will be prepended last so it will have the highest precedence. 89 | * The current `$PATH` will be appended (but will be removed if not existent). 90 | * Duplicates will be removed. 91 | * You can add custom generators in `$DOTFILES_INSTALL_PATH/.dotfiles-config/paths`. 92 | 93 | ### [`variables`](variables) 94 | 95 | * Generates a `export VAR="value"` for each variable. 96 | * Each script must output the value of the variable. 97 | * Files in `variables` must be named as the name of the variable and end with `.sh`. 98 | * Folders in `variables` must be named as the name of the variable and end with `.d`. For folders, the first script to output something will be kept. 99 | 100 | ### [`configure`](configure) 101 | 102 | * Scripts that are ran when using `./configure.sh` 103 | * Will create configuration files in `$DOTFILES_INSTALL_PATH/.dotfiles-config`. 104 | 105 | ### [`dotfiles`](dotfiles) 106 | 107 | * Each file will be copied to the destination. 108 | * Folders must have a `_generate.sh`, it will the executed and its output will be used to generate a file named like the folder. 109 | 110 | 111 | #### [`.gitconfig`](dotfiles/.gitconfig.dist) 112 | 113 | * Creates a `~/.gitconfig.dist`, which gets included from `~/.gitconfig`. 114 | * Contains many [aliases](dotfiles/.gitconfig.dist/alias) and auto-detected features. 115 | 116 | ## Todo 117 | 118 | * Add config files 119 | * Editor preferences 120 | * Name, email, etc. 121 | * $PS1 122 | * Multiplexer 123 | * Remove dependency to `ruby` for `realpath` 124 | * Investigate more common practices for dotfiles 125 | * Investigate https://github.com/mathiasbynens/dotfiles 126 | * Add documentation for configuration options 127 | 128 | ## Author 129 | Sébastien Lavoie (github@lavoie.sl) 130 | 131 | -------------------------------------------------------------------------------- /aliases/cacl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | program_exists php && echo "find app/logs -name '*.log' -delete && app/console ca:cl --no-warmup" 4 | -------------------------------------------------------------------------------- /aliases/g.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | program_exists git && echo 'git' 4 | -------------------------------------------------------------------------------- /aliases/git-root.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | program_exists git && echo 'cd "$(git root)"' 4 | -------------------------------------------------------------------------------- /aliases/k.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | program_exists kubectl && echo 'kubectl' 4 | -------------------------------------------------------------------------------- /aliases/rrm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo 'rm -Rf' 4 | -------------------------------------------------------------------------------- /aliases/vihosts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo 'sudo vi /etc/hosts' 4 | -------------------------------------------------------------------------------- /configure.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Install path defaults to $HOME 4 | # Usage: configure.sh [path] 5 | 6 | export DOTFILES_DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 7 | 8 | . "${DOTFILES_DIR}/lib.sh" 9 | 10 | DOTFILES_INSTALL_PATH="${1:-${DOTFILES_INSTALL_PATH:-${HOME}}}" 11 | 12 | [ -d "${DOTFILES_INSTALL_PATH}" ] || mkdir -p "${DOTFILES_INSTALL_PATH}" 13 | 14 | export DOTFILES_INSTALL_PATH="$(realpath "${DOTFILES_INSTALL_PATH}")" 15 | export DOTFILES_CONFIG_DIR="${DOTFILES_INSTALL_PATH}/.dotfiles-config" 16 | 17 | [ -d "${DOTFILES_CONFIG_DIR}" ] || mkdir "${DOTFILES_CONFIG_DIR}" 18 | 19 | for configure in "${DOTFILES_DIR}/configure"/*.sh; do 20 | . "${configure}" 21 | done 22 | -------------------------------------------------------------------------------- /configure/homebrew.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if program_exists brew; then 4 | ensure_config_var HOMEBREW_GITHUB_API_TOKEN "Homebrew GitHub token, including public_repo permission (https://github.com/settings/tokens/new):" 5 | fi 6 | -------------------------------------------------------------------------------- /configure/ssh.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ -f "${DOTFILES_INSTALL_PATH}/.ssh/config" ]]; then 4 | config_dir="${DOTFILES_CONFIG_DIR}/ssh/config" 5 | [ -d "${config_dir}/hosts" ] || mkdir -p "${config_dir}/hosts" 6 | 7 | host="" 8 | 9 | while read line; do 10 | # trim leading spaces 11 | line="$(echo "${line}" | sed 's/^ +//')" 12 | 13 | if echo "${line}" | grep -qE '^(#|$)'; then 14 | # skip empty and commented 15 | continue 16 | elif echo "${line}" | grep -qE '^Host\s'; then 17 | host="$(echo "${line}" | sed -E 's/^Host +//')" 18 | echo > "${config_dir}/hosts/${host}" 19 | echo "${line}" >> "${config_dir}/hosts/${host}" 20 | else 21 | if [[ -n "${host}" ]]; then 22 | # per-host configs will be indented 23 | echo " ${line}" >> "${config_dir}/hosts/${host}" 24 | else 25 | # global configs will have their own file 26 | config_name="$(echo "${line}" | grep -oE '^ *[A-Z][a-zA-Z]+ *' | head -n1 | sed 's/[^a-zA-Z]//')" 27 | if [[ -z "${config_name}" ]]; then 28 | echo "Error: unable to parse line of ${DOTFILES_INSTALL_PATH}/.ssh/config: ${line}" >&2 29 | exit 30 | fi 31 | 32 | echo "${line}" > "${config_dir}/${config_name}" 33 | fi 34 | fi 35 | done < "${DOTFILES_INSTALL_PATH}/.ssh/config" 36 | fi 37 | 38 | config_dir="${DOTFILES_CONFIG_DIR}/ssh/authorized_keys" 39 | function ssh_add_authorized_keys() { 40 | local line="${1}" 41 | 42 | local ssh_type="$(echo "${line}" | awk '{ print $1 }')" 43 | local key="$(echo "${line}" | awk '{ print $2 }')" 44 | local comment="$(echo "${line}" | awk '{ print $3 }')" 45 | 46 | # skip if key already exists 47 | grep -qRF "${key}" "${config_dir}" && return 48 | 49 | while [[ -z "${comment}" ]] || echo "${comment}" | grep -q '[/ ]'; do 50 | echo "This authorized SSH key does not have a valid comment:" 51 | echo "${line}" 52 | comment="$(prompt_value "Please specify one now, without spaces:")" 53 | done 54 | 55 | echo "${ssh_type} ${key} ${comment}" > "${config_dir}/${comment}" 56 | } 57 | 58 | if [[ -f "${DOTFILES_INSTALL_PATH}/.ssh/authorized_keys" ]]; then 59 | [ -d "${config_dir}" ] || mkdir -p "${config_dir}" 60 | 61 | while read -u 3 line; do 62 | ssh_add_authorized_keys "${line}" 63 | done 3< <(grep '^ssh-' "${DOTFILES_INSTALL_PATH}/.ssh/authorized_keys") 64 | 65 | # Do not read from ssh-add anymore 66 | # while read -u 3 line; do 67 | # ssh_add_authorized_keys "${line}" 68 | # done 3< <(ssh-add -L) 69 | fi 70 | -------------------------------------------------------------------------------- /dotfiles/.bashrc/_generate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . "${DOTFILES_DIR}/dotfiles/.bashrc/common.sh" 4 | 5 | program_exists bash && rc_dump bash 6 | -------------------------------------------------------------------------------- /dotfiles/.bashrc/common.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function rc_dump() { 4 | local shell="$1" 5 | 6 | echo "#!/usr/bin/env ${shell}" 7 | echo 8 | 9 | # sort by filename (ignoring directory) 10 | files=$(ls -1 {"${DOTFILES_DIR}","${DOTFILES_CONFIG_DIR}"}/rc/{$shell/,}*.sh 2>/dev/null | sort_by_filename) 11 | 12 | for file in $files; do 13 | echo " > $(basename $file)" >&2 14 | content=$(. "$file") 15 | 16 | if [[ -n "$content" ]]; then 17 | echo "# "$(echo "$file" | sed -e 's/^\.\///' -e "s|${HOME}|~|") 18 | echo "$content" 19 | echo 20 | fi 21 | done 22 | } 23 | -------------------------------------------------------------------------------- /dotfiles/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.go] 12 | indent_size = 4 13 | indent_style = tab 14 | -------------------------------------------------------------------------------- /dotfiles/.gitattributes: -------------------------------------------------------------------------------- 1 | *.php diff=php 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/README.md: -------------------------------------------------------------------------------- 1 | # .gitconfig 2 | 3 | * Folders represent sections. 4 | * Subfolder represent subsections (difftool/diffmerge/cmd.sh) will generate [difftool "diffmerge"] cmd = "VALUE". 5 | * Filenames represent the config name, the content is the config value. 6 | Files ending with `.sh` will be executed and the output will be used. 7 | * Empty sections will not be included. 8 | * Folders ending with `.d` will have the suffix stripped. 9 | This is to allow subsections having the same name as configs in parent section. 10 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/_generate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | program_exists git || exit 4 | 5 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 6 | 7 | echo '# http://blog.lavoie.sl/2012/10/git-tutorial-and-global-configs.html' 8 | echo 9 | 10 | print_section() { 11 | local section_dir="${1}" 12 | local section="${2}" 13 | local section_content="" 14 | 15 | for config_file in $(find "${section_dir}" -mindepth 1 -maxdepth 1 -type f -not -name README | sort); do 16 | local config="$(basename -s .sh "${config_file}")" 17 | local content="$(cat_or_exec "${config_file}")" 18 | 19 | if [[ -n "${content}" ]]; then 20 | content="$(escape_chars "${content}" '\' '"')" 21 | section_content="${section_content}\t${config} = \"${content}\"\n" 22 | fi 23 | done 24 | 25 | if [[ -n "${section_content}" ]]; then 26 | [ -f "${section_dir}/README" ] && cat "${section_dir}/README" | sed 's/^/# /' 27 | echo -e "[${section}]" 28 | echo -e "${section_content}" 29 | fi 30 | } 31 | 32 | for section_dir in $(find "${DIR}" -mindepth 1 -maxdepth 1 -type d | sort); do 33 | section="$(basename "${section_dir}")" 34 | print_section "${section_dir}" "${section}" 35 | 36 | for subsection_dir in $(find "${section_dir}" -mindepth 1 -maxdepth 1 -type d | sort); do 37 | subsection="${section} \"$(basename -s .d "${subsection_dir}")\"" 38 | print_section "${subsection_dir}" "${subsection}" 39 | done 40 | done 41 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/alias: -------------------------------------------------------------------------------- 1 | !sh -c '[ $# = 2 ] && git config --global alias."$1" "$2" && exit 0 || echo "usage: git alias " >&2 && exit 1' - 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/aliases: -------------------------------------------------------------------------------- 1 | !git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /' 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/amend: -------------------------------------------------------------------------------- 1 | commit -a --amend 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/br: -------------------------------------------------------------------------------- 1 | branch 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/br-gone: -------------------------------------------------------------------------------- 1 | !git branch -vv | grep -F ': gone]' | awk '{ print $1 }' | grep -vF '*' 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/br-prune: -------------------------------------------------------------------------------- 1 | !git branch -vv --merged | grep -F ': gone]' | awk '{ print $1 }' | grep -vF '*' | xargs git branch -d 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/brp: -------------------------------------------------------------------------------- 1 | !sh -c '[ $# = 1 ] && git checkout -b "$1" && git push -u origin "$1" || echo "usage: git brp " >&2 && exit 1' - 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/checkout-pr: -------------------------------------------------------------------------------- 1 | !sh -c 'pr="$1"; remote=${2:-origin}; [ -n "$pr" ] && (br="pr${pr}"; if [ "$(git rev-parse --abbrev-ref HEAD)" = $br ]; then git pull --autostash --rebase $remote pull/$pr/head; else git fetch $remote +pull/$pr/head:$br && git checkout $br; fi) || echo "usage: git checkout-pr 123 " >&2 && exit 1' - 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/ci: -------------------------------------------------------------------------------- 1 | commit 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/co: -------------------------------------------------------------------------------- 1 | checkout 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/d: -------------------------------------------------------------------------------- 1 | diff 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/dc: -------------------------------------------------------------------------------- 1 | diff --cached 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/dn: -------------------------------------------------------------------------------- 1 | diff --name-status 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/find-merge: -------------------------------------------------------------------------------- 1 | !sh -c 'commit=$0 && branch=${1:-HEAD} && (git rev-list $commit..$branch --ancestry-path | cat -n; git rev-list $commit..$branch --first-parent | cat -n) | sort -k2 -s | uniq -f1 -d | sort -n | tail -1 | cut -f2' 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/forest: -------------------------------------------------------------------------------- 1 | log --pretty=format:'%H%d: %s%n %ad %n %an (%ae)' --graph --all 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/graphviz.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | program_exists digraph && echo "!f() { echo 'digraph git {' ; git log --pretty='format: %h -> { %p }' \"$@\" | sed 's/[0-9a-f][0-9a-f]*/\"&\"/g' ; echo '}'; }; f" 4 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/ign: -------------------------------------------------------------------------------- 1 | ls-files -o -i --exclude-standard 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/lg: -------------------------------------------------------------------------------- 1 | log --graph --pretty=format:'%Cred%h %C(yellow)%d %C(bold blue)<%an> %Cgreen(%cr) %n %Creset %s' --abbrev-commit --date=relative 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/lg-local: -------------------------------------------------------------------------------- 1 | !git lg $(git remote-default-branch)~1..HEAD 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/loglines: -------------------------------------------------------------------------------- 1 | !f() { git log --format="%s" --reverse ${1:-$(git remote-default-branch)}..HEAD | sed "s/^/- /"; }; f "$@" 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/pf: -------------------------------------------------------------------------------- 1 | push --force-with-lease 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/pp: -------------------------------------------------------------------------------- 1 | !git pull && git push 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/pu: -------------------------------------------------------------------------------- 1 | !git push -u origin HEAD:$(git branch --show-current) 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/pull-rebase: -------------------------------------------------------------------------------- 1 | !git pull --rebase --autostash origin "$(git remote-default-branch)" 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/pull-rebase-push: -------------------------------------------------------------------------------- 1 | !git pull-rebase && git push --force-with-lease origin "$(git branch --show-current)" 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/rank: -------------------------------------------------------------------------------- 1 | shortlog -sn --no-merges 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/remote-default-branch: -------------------------------------------------------------------------------- 1 | !sh -c "git config branch.remote-default-branch || (git config branch.remote-default-branch \\$(git remote show origin | grep 'HEAD branch' | cut -d' ' -f5) && git config branch.remote-default-branch)" 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/root: -------------------------------------------------------------------------------- 1 | rev-parse --show-toplevel 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/s: -------------------------------------------------------------------------------- 1 | show 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/searchcommits: -------------------------------------------------------------------------------- 1 | !f() { query="$1"; shift; git log -S"$query" "$@"; }; f "$@" 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/show-merge: -------------------------------------------------------------------------------- 1 | !sh -c 'merge=$(git find-merge $0 $1) && [ -n "$merge" ] && git show $merge' 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/sn: -------------------------------------------------------------------------------- 1 | show --name-status --pretty=fuller 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/st: -------------------------------------------------------------------------------- 1 | status 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/tree: -------------------------------------------------------------------------------- 1 | log --pretty=format:'%H%d: %s%n %ad %n %an (%ae)' --graph 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/w: -------------------------------------------------------------------------------- 1 | whatchanged 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/alias/who: -------------------------------------------------------------------------------- 1 | shortlog -s -- 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/apply/whitespace: -------------------------------------------------------------------------------- 1 | fix 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/branch/README: -------------------------------------------------------------------------------- 1 | http://stevenharman.net/git-pull-with-automatic-rebase 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/branch/autosetuprebase: -------------------------------------------------------------------------------- 1 | always 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/branch/sort: -------------------------------------------------------------------------------- 1 | -committerdate 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/color/branch: -------------------------------------------------------------------------------- 1 | auto 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/color/branch.d/current: -------------------------------------------------------------------------------- 1 | yellow reverse 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/color/branch.d/local: -------------------------------------------------------------------------------- 1 | yellow 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/color/branch.d/remote: -------------------------------------------------------------------------------- 1 | green 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/color/diff: -------------------------------------------------------------------------------- 1 | auto 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/color/diff.d/frag: -------------------------------------------------------------------------------- 1 | magenta bold 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/color/diff.d/meta: -------------------------------------------------------------------------------- 1 | yellow bold 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/color/diff.d/new: -------------------------------------------------------------------------------- 1 | green bold 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/color/diff.d/old: -------------------------------------------------------------------------------- 1 | red bold 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/color/interactive: -------------------------------------------------------------------------------- 1 | auto 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/color/pager: -------------------------------------------------------------------------------- 1 | true 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/color/status: -------------------------------------------------------------------------------- 1 | auto 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/color/status.d/added: -------------------------------------------------------------------------------- 1 | yellow 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/color/status.d/changed: -------------------------------------------------------------------------------- 1 | green 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/color/status.d/untracked: -------------------------------------------------------------------------------- 1 | cyan 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/color/ui: -------------------------------------------------------------------------------- 1 | true 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/commit/gpgsign.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | gpgsign="$(git config --global --bool --get commit.gpgsign)" 4 | 5 | if [ -z "$gpgsign" ] && 6 | program_exists gpg && 7 | gpg --list-secret-keys --with-colons | grep -q '^fpr'; then 8 | gpgsign=true 9 | fi 10 | 11 | echo "${gpgsign}" 12 | 13 | 14 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/core/attributesfile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "$HOME/.gitattributes" 4 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/core/editor.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if program_exists vim; then 4 | which vim 5 | exit 6 | fi 7 | 8 | if program_exists vi; then 9 | which vi 10 | exit 11 | fi 12 | 13 | if program_exists nano; then 14 | which nano 15 | exit 16 | fi 17 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/core/excludesfile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "$HOME/.gitignore" 4 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/core/pager: -------------------------------------------------------------------------------- 1 | less -FRSX 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/core/trustctime: -------------------------------------------------------------------------------- 1 | false 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/core/whitespace: -------------------------------------------------------------------------------- 1 | fix,-indent-with-non-tab,trailing-space,cr-at-eol,space-before-tab 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/credential/helper.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | program_exists git-credential-osxkeychain && echo 'osxkeychain' 4 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/diff-so-fancy/README: -------------------------------------------------------------------------------- 1 | https://github.com/so-fancy/diff-so-fancy 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/diff-so-fancy/changeHunkIndicators: -------------------------------------------------------------------------------- 1 | false 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/diff-so-fancy/markEmptyLines: -------------------------------------------------------------------------------- 1 | false 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/diff-so-fancy/stripLeadingSymbols: -------------------------------------------------------------------------------- 1 | false 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/diff/algorithm: -------------------------------------------------------------------------------- 1 | patience 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/diff/compactionHeuristic: -------------------------------------------------------------------------------- 1 | true 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/diff/noprefix: -------------------------------------------------------------------------------- 1 | true 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/diff/renames: -------------------------------------------------------------------------------- 1 | copies 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/diff/tool.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if program_exists ksdiff; then 4 | echo 'Kaleidoscope' 5 | elif program_exists diffmerge; then 6 | # http://twobitlabs.com/2011/08/install-diffmerge-git-mac-os-x/ 7 | echo 'diffmerge --nosplash' 8 | fi 9 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/difftool/Kaleidoscope/cmd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | program_exists ksdiff && echo 'ksdiff --partial-changeset --relative-path "$MERGED" -- "$LOCAL" "$REMOTE"' 4 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/difftool/diffmerge/cmd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | program_exists diffmerge && echo 'diffmerge --nosplash "$LOCAL" "$REMOTE"' 4 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/difftool/prompt: -------------------------------------------------------------------------------- 1 | false 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/fetch/prune: -------------------------------------------------------------------------------- 1 | true 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/filter/lfs/clean: -------------------------------------------------------------------------------- 1 | git-lfs clean -- %f 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/filter/lfs/process: -------------------------------------------------------------------------------- 1 | git-lfs filter-process 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/filter/lfs/required: -------------------------------------------------------------------------------- 1 | true 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/filter/lfs/smudge: -------------------------------------------------------------------------------- 1 | git-lfs smudge -- %f 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/init/defaultBranch: -------------------------------------------------------------------------------- 1 | main 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/interactive/diffFilter.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | program_exists diff-so-fancy && echo "diff-so-fancy" 4 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/merge/README: -------------------------------------------------------------------------------- 1 | http://twobitlabs.com/2011/08/install-diffmerge-git-mac-os-x/ 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/merge/log: -------------------------------------------------------------------------------- 1 | true 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/merge/tool.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if program_exists ksdiff; then 4 | echo 'Kaleidoscope' 5 | elif program_exists diffmerge; then 6 | # http://twobitlabs.com/2011/08/install-diffmerge-git-mac-os-x/ 7 | echo 'diffmerge --nosplash' 8 | fi 9 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/mergetool/Kaleidoscope/cmd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | program_exists ksdiff && echo 'ksdiff --merge --output "$MERGED" --base "$BASE" -- "$LOCAL" --snapshot "$REMOTE" --snapshot' 4 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/mergetool/Kaleidoscope/trustExitCode.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | program_exists ksdiff && echo 'true' 4 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/mergetool/README: -------------------------------------------------------------------------------- 1 | http://stackoverflow.com/questions/1251681/diff-tool-generates-unwanted-orig-files 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/mergetool/diffmerge/cmd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | program_exists diffmerge && echo 'diffmerge --nosplash --merge --result="$MERGED" "$LOCAL" "$(if test -f "$BASE"; then echo "$BASE"; else echo "$LOCAL"; fi)" "$REMOTE"' 4 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/mergetool/diffmerge/trustExitCode.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | program_exists diffmerge && echo 'true' 4 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/mergetool/keepBackup: -------------------------------------------------------------------------------- 1 | false 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/pager/diff.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | program_exists diff-so-fancy && echo "diff-so-fancy | less --tabs=4 -RFX" 4 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/pager/show.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | program_exists diff-so-fancy && echo "diff-so-fancy | less --tabs=4 -RFX" 4 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/push/README: -------------------------------------------------------------------------------- 1 | http://pivotallabs.com/users/alex/blog/articles/883-git-config-push-default-matching 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/push/default: -------------------------------------------------------------------------------- 1 | upstream 2 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/user/email.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | email="$(git config -f "${DOTFILES_INSTALL_PATH}/.gitconfig" --includes user.email)" 4 | 5 | [ -z "${email}" ] && email="$(prompt_value "What is your email ?")" 6 | 7 | echo "${email}" 8 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/user/name.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | name="$(git config -f "${DOTFILES_INSTALL_PATH}/.gitconfig" --includes user.name)" 4 | 5 | [ -z "${name}" ] && name="$(prompt_value "What is your name ?")" 6 | 7 | echo "${name}" 8 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig.dist/user/signingkey.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | signingkey="$(git config --global user.signingkey)" 4 | 5 | [ -z "${signingkey}" ] && program_exists gpg && signingkey="$(gpg --list-secret-keys --with-colons | grep '^sec' | grep -oE '[A-F0-9]{10,}' | head -n1)" 6 | 7 | echo "${signingkey}!" 8 | 9 | 10 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig/_generate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | program_exists git || exit 4 | 5 | gitconfig="${DOTFILES_INSTALL_PATH}/.gitconfig" 6 | 7 | tmp="$(mktemp)" 8 | if [ -e "${gitconfig}" ]; then 9 | cat "${gitconfig}" > "${tmp}" 10 | fi 11 | 12 | if ! git config -f "${tmp}" --get-all include.path ".gitconfig.dist" 2>&1 >/dev/null; then 13 | git config -f "${tmp}" --add include.path ".gitconfig.dist" 14 | fi 15 | 16 | cat "${tmp}" 17 | rm "${tmp}" 18 | -------------------------------------------------------------------------------- /dotfiles/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled source 2 | *.class 3 | *.com 4 | !*.com/ 5 | *.dll 6 | *.exe 7 | *.o 8 | *.pyc 9 | *.pyo 10 | *.so 11 | .bundle 12 | 13 | # IDEs 14 | .idea 15 | 16 | # OS generated files 17 | .Spotlight-V100 18 | *.DS_Store 19 | .Trashes 20 | ehthumbs.db 21 | Icon? 22 | Thumbs.db 23 | 24 | # Temp and swap files 25 | *.sw[nop] 26 | *.tmp 27 | *~ 28 | .*.swp 29 | ._* 30 | -------------------------------------------------------------------------------- /dotfiles/.inputrc: -------------------------------------------------------------------------------- 1 | # Make Tab autocomplete regardless of filename case 2 | set completion-ignore-case on 3 | 4 | # List all matches in case multiple possible completions are possible 5 | set show-all-if-ambiguous on 6 | 7 | # Immediately add a trailing slash when autocompleting symlinks to directories 8 | set mark-symlinked-directories on 9 | 10 | # Use the text that has already been typed as the prefix for searching through 11 | # commands (i.e. more intelligent Up/Down behavior) 12 | "\e[B": history-search-forward 13 | "\e[A": history-search-backward 14 | 15 | # Do not autocomplete hidden files unless the pattern explicitly begins with a dot 16 | set match-hidden-files off 17 | 18 | # Show all autocomplete results at once 19 | set page-completions off 20 | 21 | # If there are more than 200 possible completions for a word, ask to show them all 22 | set completion-query-items 200 23 | 24 | # Show extra file information when completing, like `ls -F` does 25 | set visible-stats on 26 | 27 | # Be more intelligent when autocompleting by also looking at the text after 28 | # the cursor. For example, when the current line is "cd ~/src/mozil", and 29 | # the cursor is on the "z", pressing Tab will not autocomplete it to "cd 30 | # ~/src/mozillail", but to "cd ~/src/mozilla". (This is supported by the 31 | # Readline used by Bash 4.) 32 | set skip-completed-text on 33 | 34 | # Allow UTF-8 input and output, instead of showing stuff like $'\0123\0456' 35 | set input-meta on 36 | set output-meta on 37 | set convert-meta off 38 | 39 | # Use Alt/Meta + Delete to delete the preceding word 40 | "\e[3;3~": kill-word 41 | -------------------------------------------------------------------------------- /dotfiles/.my.cnf/_generate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function mysql_default() { 4 | local current="$(mysql --print-defaults | grep -oE -- "--${1}=[^ ]+" | sed "s/--${1}=//")" 5 | local message="${2}" 6 | local default="${3}" 7 | 8 | if [ -n "${current}" ]; then 9 | echo "${current}" 10 | else 11 | prompt_value "${message}" "${default}" 12 | fi 13 | } 14 | 15 | function mysql_test() { 16 | local config_file="${1}" 17 | 18 | mysql --defaults-extra-file="${config_file}" -e "SELECT 1" 2>/dev/null >/dev/null 19 | 20 | return $? 21 | } 22 | 23 | if program_exists mysql && [[ "$(echo | mysql 2>&1)" != *"Can't connect to local MySQL"* ]]; then 24 | file="$(mktemp /tmp/.my.cnf.XXXXXX)" 25 | 26 | echo '[client]' > "${file}" 27 | echo "host=\"$(mysql_default host "MySQL host" "localhost")\"" >> "${file}" 28 | echo "user=\"$(mysql_default user "MySQL user" "root")\"" >> "${file}" 29 | echo "password=\"$(mysql_default password "MySQL password" "root")\"" >> "${file}" 30 | 31 | if mysql_test "${file}"; then 32 | cat "${file}" 33 | else 34 | echo "WARNING: Unable to connect to MySQL using provided options, skipping .my.cnf generation." >&2 35 | fi 36 | 37 | rm "${file}" 38 | fi 39 | -------------------------------------------------------------------------------- /dotfiles/.osx: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # ~/.osx — https://mths.be/osx 4 | 5 | # Ask for the administrator password upfront 6 | sudo -v 7 | 8 | # Keep-alive: update existing `sudo` time stamp until `.osx` has finished 9 | while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & 10 | 11 | ############################################################################### 12 | # General UI/UX # 13 | ############################################################################### 14 | 15 | # Set computer name (as done via System Preferences → Sharing) 16 | #sudo scutil --set ComputerName "0x6D746873" 17 | #sudo scutil --set HostName "0x6D746873" 18 | #sudo scutil --set LocalHostName "0x6D746873" 19 | #sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "0x6D746873" 20 | 21 | # Set standby delay to 24 hours (default is 1 hour) 22 | sudo pmset -a standbydelay 86400 23 | 24 | # Disable the sound effects on boot 25 | sudo nvram SystemAudioVolume=" " 26 | 27 | # Disable transparency in the menu bar and elsewhere on Yosemite 28 | # defaults write com.apple.universalaccess reduceTransparency -bool true 29 | 30 | # Menu bar: hide the Time Machine, Volume, User, and Bluetooth icons 31 | # for domain in ~/Library/Preferences/ByHost/com.apple.systemuiserver.*; do 32 | # defaults write "${domain}" dontAutoLoad -array \ 33 | # "/System/Library/CoreServices/Menu Extras/TimeMachine.menu" \ 34 | # "/System/Library/CoreServices/Menu Extras/Volume.menu" \ 35 | # "/System/Library/CoreServices/Menu Extras/User.menu" 36 | # done 37 | defaults write com.apple.systemuiserver menuExtras -array \ 38 | "/System/Library/CoreServices/Menu Extras/Bluetooth.menu" \ 39 | "/System/Library/CoreServices/Menu Extras/AirPort.menu" \ 40 | "/System/Library/CoreServices/Menu Extras/Battery.menu" \ 41 | "/System/Library/CoreServices/Menu Extras/Clock.menu" \ 42 | "/System/Library/CoreServices/Menu Extras/User.menu" 43 | 44 | # Set highlight color to green 45 | # defaults write NSGlobalDomain AppleHighlightColor -string "0.764700 0.976500 0.568600" 46 | 47 | # Set sidebar icon size to medium 48 | # defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 2 49 | 50 | # Always show scrollbars 51 | # defaults write NSGlobalDomain AppleShowScrollBars -string "Always" 52 | # Possible values: `WhenScrolling`, `Automatic` and `Always` 53 | 54 | # Disable smooth scrolling 55 | # (Uncomment if you’re on an older Mac that messes up the animation) 56 | #defaults write NSGlobalDomain NSScrollAnimationEnabled -bool false 57 | 58 | # Increase window resize speed for Cocoa applications 59 | defaults write NSGlobalDomain NSWindowResizeTime -float 0.001 60 | 61 | # Expand save panel by default 62 | defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true 63 | defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true 64 | 65 | # Expand print panel by default 66 | defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true 67 | defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true 68 | 69 | # Save to disk (not to iCloud) by default 70 | defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false 71 | 72 | # Automatically quit printer app once the print jobs complete 73 | defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true 74 | 75 | # Disable the “Are you sure you want to open this application?” dialog 76 | defaults write com.apple.LaunchServices LSQuarantine -bool false 77 | 78 | # Remove duplicates in the “Open With” menu (also see `lscleanup` alias) 79 | /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user 80 | 81 | # Display ASCII control characters using caret notation in standard text views 82 | # Try e.g. `cd /tmp; unidecode "\x{0000}" > cc.txt; open -e cc.txt` 83 | # defaults write NSGlobalDomain NSTextShowsControlCharacters -bool true 84 | 85 | # Disable Resume system-wide 86 | defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false 87 | 88 | # Disable automatic termination of inactive apps 89 | # defaults write NSGlobalDomain NSDisableAutomaticTermination -bool true 90 | 91 | # Disable the crash reporter 92 | #defaults write com.apple.CrashReporter DialogType -string "none" 93 | 94 | # Set Help Viewer windows to non-floating mode 95 | # defaults write com.apple.helpviewer DevMode -bool true 96 | 97 | # Fix for the ancient UTF-8 bug in QuickLook (https://mths.be/bbo) 98 | # Commented out, as this is known to cause problems in various Adobe apps :( 99 | # See https://github.com/mathiasbynens/dotfiles/issues/237 100 | #echo "0x08000100:0" > ~/.CFUserTextEncoding 101 | 102 | # Reveal IP address, hostname, OS version, etc. when clicking the clock 103 | # in the login window 104 | sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName 105 | 106 | # Restart automatically if the computer freezes 107 | sudo systemsetup -setrestartfreeze on 108 | 109 | # Never go into computer sleep mode 110 | sudo systemsetup -setcomputersleep Off > /dev/null 111 | 112 | # Check for software updates daily, not just once per week 113 | defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 114 | 115 | # Disable Notification Center and remove the menu bar icon 116 | launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist 2> /dev/null 117 | 118 | # Disable smart quotes as they’re annoying when typing code 119 | # defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false 120 | 121 | # Disable smart dashes as they’re annoying when typing code 122 | # defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false 123 | 124 | # Set a custom wallpaper image. `DefaultDesktop.jpg` is already a symlink, and 125 | # all wallpapers are in `/Library/Desktop Pictures/`. The default is `Wave.jpg`. 126 | #rm -rf ~/Library/Application Support/Dock/desktoppicture.db 127 | #sudo rm -rf /System/Library/CoreServices/DefaultDesktop.jpg 128 | #sudo ln -s /path/to/your/image /System/Library/CoreServices/DefaultDesktop.jpg 129 | 130 | ############################################################################### 131 | # SSD-specific tweaks # 132 | ############################################################################### 133 | 134 | # Disable local Time Machine snapshots 135 | sudo tmutil disablelocal 136 | 137 | # Disable hibernation (speeds up entering sleep mode) 138 | sudo pmset -a hibernatemode 0 139 | 140 | # Remove the sleep image file to save disk space 141 | sudo rm /Private/var/vm/sleepimage 142 | # Create a zero-byte file instead… 143 | sudo touch /Private/var/vm/sleepimage 144 | # …and make sure it can’t be rewritten 145 | sudo chflags uchg /Private/var/vm/sleepimage 146 | 147 | # Disable the sudden motion sensor as it’s not useful for SSDs 148 | sudo pmset -a sms 0 149 | 150 | ############################################################################### 151 | # Trackpad, mouse, keyboard, Bluetooth accessories, and input # 152 | ############################################################################### 153 | 154 | # Trackpad: enable tap to click for this user and for the login screen 155 | # defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true 156 | # defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 157 | # defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 158 | 159 | # Trackpad: map bottom right corner to right-click 160 | # defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2 161 | # defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true 162 | # defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1 163 | # defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true 164 | 165 | # Disable “natural” (Lion-style) scrolling 166 | # defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false 167 | 168 | # Increase sound quality for Bluetooth headphones/headsets 169 | defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40 170 | 171 | # Enable full keyboard access for all controls 172 | # (e.g. enable Tab in modal dialogs) 173 | defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 174 | 175 | # Use scroll gesture with the Ctrl (^) modifier key to zoom 176 | defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true 177 | defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144 178 | # Follow the keyboard focus while zoomed in 179 | defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true 180 | 181 | # Disable press-and-hold for keys in favor of key repeat 182 | defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false 183 | 184 | # Set a blazingly fast keyboard repeat rate 185 | defaults write NSGlobalDomain KeyRepeat -int 0.1 186 | 187 | # Set language and text formats 188 | # Note: if you’re in the US, replace `EUR` with `USD`, `Centimeters` with 189 | # `Inches`, `en_GB` with `en_US`, and `true` with `false`. 190 | defaults write NSGlobalDomain AppleLanguages -array "en" "fr" 191 | defaults write NSGlobalDomain AppleLocale -string "en_CA@currency=CAD" 192 | defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters" 193 | defaults write NSGlobalDomain AppleMetricUnits -bool true 194 | 195 | # Set the timezone; see `sudo systemsetup -listtimezones` for other values 196 | sudo systemsetup -settimezone "America/Montreal" > /dev/null 197 | 198 | # Disable auto-correct 199 | # defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false 200 | 201 | # Stop iTunes from responding to the keyboard media keys 202 | #launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist 2> /dev/null 203 | 204 | ############################################################################### 205 | # Screen # 206 | ############################################################################### 207 | 208 | # Require password immediately after sleep or screen saver begins 209 | defaults write com.apple.screensaver askForPassword -int 1 210 | defaults write com.apple.screensaver askForPasswordDelay -int 0 211 | 212 | # Save screenshots to the desktop 213 | defaults write com.apple.screencapture location -string "${HOME}/Desktop" 214 | 215 | # Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF) 216 | defaults write com.apple.screencapture type -string "png" 217 | 218 | # Disable shadow in screenshots 219 | # defaults write com.apple.screencapture disable-shadow -bool true 220 | 221 | # Enable subpixel font rendering on non-Apple LCDs 222 | defaults write NSGlobalDomain AppleFontSmoothing -int 2 223 | 224 | # Enable HiDPI display modes (requires restart) 225 | # sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true 226 | 227 | ############################################################################### 228 | # Finder # 229 | ############################################################################### 230 | 231 | # Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons 232 | # defaults write com.apple.finder QuitMenuItem -bool true 233 | 234 | # Finder: disable window animations and Get Info animations 235 | # defaults write com.apple.finder DisableAllAnimations -bool true 236 | 237 | # Set Desktop as the default location for new Finder windows 238 | # For other paths, use `PfLo` and `file:///full/path/here/` 239 | defaults write com.apple.finder NewWindowTarget -string "PfLo" 240 | defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/" 241 | 242 | # Show icons for hard drives, servers, and removable media on the desktop 243 | defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true 244 | defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true 245 | defaults write com.apple.finder ShowMountedServersOnDesktop -bool true 246 | defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true 247 | 248 | # Finder: show hidden files by default 249 | #defaults write com.apple.finder AppleShowAllFiles -bool true 250 | 251 | # Finder: show all filename extensions 252 | defaults write NSGlobalDomain AppleShowAllExtensions -bool true 253 | 254 | # Finder: show status bar 255 | defaults write com.apple.finder ShowStatusBar -bool true 256 | 257 | # Finder: show path bar 258 | defaults write com.apple.finder ShowPathbar -bool true 259 | 260 | # Finder: allow text selection in Quick Look 261 | defaults write com.apple.finder QLEnableTextSelection -bool true 262 | 263 | # Display full POSIX path as Finder window title 264 | # defaults write com.apple.finder _FXShowPosixPathInTitle -bool true 265 | 266 | # When performing a search, search the current folder by default 267 | defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" 268 | 269 | # Disable the warning when changing a file extension 270 | defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false 271 | 272 | # Enable spring loading for directories 273 | defaults write NSGlobalDomain com.apple.springing.enabled -bool true 274 | 275 | # Remove the spring loading delay for directories 276 | defaults write NSGlobalDomain com.apple.springing.delay -float 0 277 | 278 | # Avoid creating .DS_Store files on network volumes 279 | defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true 280 | 281 | # Disable disk image verification 282 | defaults write com.apple.frameworks.diskimages skip-verify -bool true 283 | defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true 284 | defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true 285 | 286 | # Automatically open a new Finder window when a volume is mounted 287 | defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true 288 | defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true 289 | defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true 290 | 291 | # Show item info near icons on the desktop and in other icon views 292 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist 293 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist 294 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist 295 | 296 | # Show item info to the right of the icons on the desktop 297 | /usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:labelOnBottom false" ~/Library/Preferences/com.apple.finder.plist 298 | 299 | # Enable snap-to-grid for icons on the desktop and in other icon views 300 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist 301 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist 302 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist 303 | 304 | # Increase grid spacing for icons on the desktop and in other icon views 305 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist 306 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist 307 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist 308 | 309 | # Increase the size of icons on the desktop and in other icon views 310 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist 311 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist 312 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist 313 | 314 | # Use list view in all Finder windows by default 315 | # Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv`, `Nlsv` 316 | defaults write com.apple.finder FXPreferredViewStyle -string "clmv" 317 | 318 | # Disable the warning before emptying the Trash 319 | defaults write com.apple.finder WarnOnEmptyTrash -bool false 320 | 321 | # Empty Trash securely by default 322 | defaults write com.apple.finder EmptyTrashSecurely -bool true 323 | 324 | # Enable AirDrop over Ethernet and on unsupported Macs running Lion 325 | defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true 326 | 327 | # Enable the MacBook Air SuperDrive on any Mac 328 | sudo nvram boot-args="mbasd=1" 329 | 330 | # Show the ~/Library folder 331 | chflags nohidden ~/Library 332 | 333 | # Remove Dropbox’s green checkmark icons in Finder 334 | # file=/Applications/Dropbox.app/Contents/Resources/emblem-dropbox-uptodate.icns 335 | # [ -e "${file}" ] && mv -f "${file}" "${file}.bak" 336 | 337 | # Expand the following File Info panes: 338 | # “General”, “Open with”, and “Sharing & Permissions” 339 | defaults write com.apple.finder FXInfoPanesExpanded -dict \ 340 | General -bool true \ 341 | OpenWith -bool true \ 342 | Privileges -bool true 343 | 344 | ############################################################################### 345 | # Dock, Dashboard, and hot corners # 346 | ############################################################################### 347 | 348 | # Enable highlight hover effect for the grid view of a stack (Dock) 349 | defaults write com.apple.dock mouse-over-hilite-stack -bool true 350 | 351 | # Set the icon size of Dock items to 36 pixels 352 | # defaults write com.apple.dock tilesize -int 36 353 | 354 | # Change minimize/maximize window effect 355 | # defaults write com.apple.dock mineffect -string "scale" 356 | 357 | # Minimize windows into their application’s icon 358 | defaults write com.apple.dock minimize-to-application -bool true 359 | 360 | # Enable spring loading for all Dock items 361 | defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true 362 | 363 | # Show indicator lights for open applications in the Dock 364 | defaults write com.apple.dock show-process-indicators -bool true 365 | 366 | # Wipe all (default) app icons from the Dock 367 | # This is only really useful when setting up a new Mac, or if you don’t use 368 | # the Dock to launch apps. 369 | #defaults write com.apple.dock persistent-apps -array "" 370 | 371 | # Don’t animate opening applications from the Dock 372 | defaults write com.apple.dock launchanim -bool false 373 | 374 | # Speed up Mission Control animations 375 | defaults write com.apple.dock expose-animation-duration -float 0.1 376 | 377 | # Don’t group windows by application in Mission Control 378 | # (i.e. use the old Exposé behavior instead) 379 | defaults write com.apple.dock expose-group-by-app -bool false 380 | 381 | # Disable Dashboard 382 | defaults write com.apple.dashboard mcx-disabled -bool true 383 | 384 | # Don’t show Dashboard as a Space 385 | defaults write com.apple.dock dashboard-in-overlay -bool true 386 | 387 | # Don’t automatically rearrange Spaces based on most recent use 388 | defaults write com.apple.dock mru-spaces -bool false 389 | 390 | # Remove the auto-hiding Dock delay 391 | defaults write com.apple.dock autohide-delay -float 0 392 | # Remove the animation when hiding/showing the Dock 393 | defaults write com.apple.dock autohide-time-modifier -float 0 394 | 395 | # Automatically hide and show the Dock 396 | defaults write com.apple.dock autohide -bool true 397 | 398 | # Make Dock icons of hidden applications translucent 399 | defaults write com.apple.dock showhidden -bool true 400 | 401 | # Disable the Launchpad gesture (pinch with thumb and three fingers) 402 | #defaults write com.apple.dock showLaunchpadGestureEnabled -int 0 403 | 404 | # Reset Launchpad, but keep the desktop wallpaper intact 405 | find "${HOME}/Library/Application Support/Dock" -maxdepth 1 -name "*-*.db" -delete 406 | 407 | # Add iOS Simulator to Launchpad 408 | # sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app" "/Applications/iOS Simulator.app" 409 | 410 | # Add a spacer to the left side of the Dock (where the applications are) 411 | #defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}' 412 | # Add a spacer to the right side of the Dock (where the Trash is) 413 | #defaults write com.apple.dock persistent-others -array-add '{tile-data={}; tile-type="spacer-tile";}' 414 | 415 | # Hot corners 416 | # Possible values: 417 | # 0: no-op 418 | # 2: Mission Control 419 | # 3: Show application windows 420 | # 4: Desktop 421 | # 5: Start screen saver 422 | # 6: Disable screen saver 423 | # 7: Dashboard 424 | # 10: Put display to sleep 425 | # 11: Launchpad 426 | # 12: Notification Center 427 | # Top left screen corner → Mission Control 428 | # defaults write com.apple.dock wvous-tl-corner -int 2 429 | # defaults write com.apple.dock wvous-tl-modifier -int 0 430 | # Top right screen corner → Desktop 431 | # defaults write com.apple.dock wvous-tr-corner -int 4 432 | # defaults write com.apple.dock wvous-tr-modifier -int 0 433 | # Bottom left screen corner → Start screen saver 434 | # defaults write com.apple.dock wvous-bl-corner -int 5 435 | # defaults write com.apple.dock wvous-bl-modifier -int 0 436 | 437 | ############################################################################### 438 | # Safari & WebKit # 439 | ############################################################################### 440 | 441 | # Privacy: don’t send search queries to Apple 442 | defaults write com.apple.Safari UniversalSearchEnabled -bool false 443 | 444 | # Press Tab to highlight each item on a web page 445 | defaults write com.apple.Safari WebKitTabToLinksPreferenceKey -bool true 446 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2TabsToLinks -bool true 447 | 448 | # Show the full URL in the address bar (note: this still hides the scheme) 449 | defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true 450 | 451 | # Set Safari’s home page to `about:blank` for faster loading 452 | defaults write com.apple.Safari HomePage -string "about:blank" 453 | 454 | # Prevent Safari from opening ‘safe’ files automatically after downloading 455 | defaults write com.apple.Safari AutoOpenSafeDownloads -bool false 456 | 457 | # Allow hitting the Backspace key to go to the previous page in history 458 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool true 459 | 460 | # Hide Safari’s bookmarks bar by default 461 | defaults write com.apple.Safari ShowFavoritesBar -bool false 462 | 463 | # Hide Safari’s sidebar in Top Sites 464 | defaults write com.apple.Safari ShowSidebarInTopSites -bool false 465 | 466 | # Disable Safari’s thumbnail cache for History and Top Sites 467 | defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2 468 | 469 | # Enable Safari’s debug menu 470 | defaults write com.apple.Safari IncludeInternalDebugMenu -bool true 471 | 472 | # Make Safari’s search banners default to Contains instead of Starts With 473 | defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false 474 | 475 | # Remove useless icons from Safari’s bookmarks bar 476 | defaults write com.apple.Safari ProxiesInBookmarksBar "()" 477 | 478 | # Enable the Develop menu and the Web Inspector in Safari 479 | defaults write com.apple.Safari IncludeDevelopMenu -bool true 480 | defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true 481 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true 482 | 483 | # Add a context menu item for showing the Web Inspector in web views 484 | defaults write NSGlobalDomain WebKitDeveloperExtras -bool true 485 | 486 | ############################################################################### 487 | # Mail # 488 | ############################################################################### 489 | 490 | # Disable send and reply animations in Mail.app 491 | defaults write com.apple.mail DisableReplyAnimations -bool true 492 | defaults write com.apple.mail DisableSendAnimations -bool true 493 | 494 | # Copy email addresses as `foo@example.com` instead of `Foo Bar ` in Mail.app 495 | defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false 496 | 497 | # Add the keyboard shortcut ⌘ + Enter to send an email in Mail.app 498 | defaults write com.apple.mail NSUserKeyEquivalents -dict-add "Send" -string "@\\U21a9" 499 | 500 | # Display emails in threaded mode, sorted by date (oldest at the top) 501 | defaults write com.apple.mail DraftsViewerAttributes -dict-add "DisplayInThreadedMode" -string "yes" 502 | defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortedDescending" -string "yes" 503 | defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortOrder" -string "received-date" 504 | 505 | # Disable inline attachments (just show the icons) 506 | defaults write com.apple.mail DisableInlineAttachmentViewing -bool true 507 | 508 | # Disable automatic spell checking 509 | defaults write com.apple.mail SpellCheckingBehavior -string "NoSpellCheckingEnabled" 510 | 511 | ############################################################################### 512 | # Spotlight # 513 | ############################################################################### 514 | 515 | # Hide Spotlight tray-icon (and subsequent helper) 516 | #sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search 517 | # Disable Spotlight indexing for any volume that gets mounted and has not yet 518 | # been indexed before. 519 | # Use `sudo mdutil -i off "/Volumes/foo"` to stop indexing any volume. 520 | sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Volumes" 521 | # Change indexing order and disable some file types 522 | defaults write com.apple.spotlight orderedItems -array \ 523 | '{"enabled" = 1;"name" = "APPLICATIONS";}' \ 524 | '{"enabled" = 1;"name" = "SYSTEM_PREFS";}' \ 525 | '{"enabled" = 1;"name" = "DIRECTORIES";}' \ 526 | '{"enabled" = 1;"name" = "PDF";}' \ 527 | '{"enabled" = 1;"name" = "FONTS";}' \ 528 | '{"enabled" = 0;"name" = "DOCUMENTS";}' \ 529 | '{"enabled" = 0;"name" = "MESSAGES";}' \ 530 | '{"enabled" = 0;"name" = "CONTACT";}' \ 531 | '{"enabled" = 0;"name" = "EVENT_TODO";}' \ 532 | '{"enabled" = 0;"name" = "IMAGES";}' \ 533 | '{"enabled" = 0;"name" = "BOOKMARKS";}' \ 534 | '{"enabled" = 0;"name" = "MUSIC";}' \ 535 | '{"enabled" = 0;"name" = "MOVIES";}' \ 536 | '{"enabled" = 0;"name" = "PRESENTATIONS";}' \ 537 | '{"enabled" = 0;"name" = "SPREADSHEETS";}' \ 538 | '{"enabled" = 0;"name" = "SOURCE";}' 539 | # Load new settings before rebuilding the index 540 | killall mds > /dev/null 2>&1 541 | # Make sure indexing is enabled for the main volume 542 | sudo mdutil -i on / > /dev/null 543 | # Rebuild the index from scratch 544 | sudo mdutil -E / > /dev/null 545 | 546 | ############################################################################### 547 | # Terminal & iTerm 2 # 548 | ############################################################################### 549 | 550 | # Only use UTF-8 in Terminal.app 551 | defaults write com.apple.terminal StringEncodings -array 4 552 | 553 | # Use a modified version of the Solarized Dark theme by default in Terminal.app 554 | # TERM_PROFILE='Solarized Dark xterm-256color'; 555 | # CURRENT_PROFILE="$(defaults read com.apple.terminal 'Default Window Settings')"; 556 | # if [ "${CURRENT_PROFILE}" != "${TERM_PROFILE}" ]; then 557 | # open "${HOME}/init/${TERM_PROFILE}.terminal"; 558 | # sleep 1; # Wait a bit to make sure the theme is loaded 559 | # defaults write com.apple.terminal 'Default Window Settings' -string "${TERM_PROFILE}"; 560 | # defaults write com.apple.terminal 'Startup Window Settings' -string "${TERM_PROFILE}"; 561 | # fi; 562 | 563 | # Enable “focus follows mouse” for Terminal.app and all X11 apps 564 | # i.e. hover over a window and start typing in it without clicking first 565 | #defaults write com.apple.terminal FocusFollowsMouse -bool true 566 | #defaults write org.x.X11 wm_ffm -bool true 567 | 568 | # Install the Solarized Dark theme for iTerm 569 | # open "${HOME}/init/Solarized Dark.itermcolors" 570 | 571 | # Don’t display the annoying prompt when quitting iTerm 572 | defaults write com.googlecode.iterm2 PromptOnQuit -bool false 573 | 574 | ############################################################################### 575 | # Time Machine # 576 | ############################################################################### 577 | 578 | # Prevent Time Machine from prompting to use new hard drives as backup volume 579 | defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true 580 | 581 | # Disable local Time Machine backups 582 | hash tmutil &> /dev/null && sudo tmutil disablelocal 583 | 584 | ############################################################################### 585 | # Activity Monitor # 586 | ############################################################################### 587 | 588 | # Show the main window when launching Activity Monitor 589 | defaults write com.apple.ActivityMonitor OpenMainWindow -bool true 590 | 591 | # Visualize CPU usage in the Activity Monitor Dock icon 592 | defaults write com.apple.ActivityMonitor IconType -int 5 593 | 594 | # Show all processes in Activity Monitor 595 | defaults write com.apple.ActivityMonitor ShowCategory -int 0 596 | 597 | # Sort Activity Monitor results by CPU usage 598 | defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage" 599 | defaults write com.apple.ActivityMonitor SortDirection -int 0 600 | 601 | ############################################################################### 602 | # Address Book, Dashboard, iCal, TextEdit, and Disk Utility # 603 | ############################################################################### 604 | 605 | # Enable the debug menu in Address Book 606 | defaults write com.apple.addressbook ABShowDebugMenu -bool true 607 | 608 | # Enable Dashboard dev mode (allows keeping widgets on the desktop) 609 | defaults write com.apple.dashboard devmode -bool true 610 | 611 | # Enable the debug menu in iCal (pre-10.8) 612 | defaults write com.apple.iCal IncludeDebugMenu -bool true 613 | 614 | # Use plain text mode for new TextEdit documents 615 | defaults write com.apple.TextEdit RichText -int 0 616 | # Open and save files as UTF-8 in TextEdit 617 | defaults write com.apple.TextEdit PlainTextEncoding -int 4 618 | defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4 619 | 620 | # Enable the debug menu in Disk Utility 621 | defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true 622 | defaults write com.apple.DiskUtility advanced-image-options -bool true 623 | 624 | ############################################################################### 625 | # Mac App Store # 626 | ############################################################################### 627 | 628 | # Enable the WebKit Developer Tools in the Mac App Store 629 | defaults write com.apple.appstore WebKitDeveloperExtras -bool true 630 | 631 | # Enable Debug Menu in the Mac App Store 632 | defaults write com.apple.appstore ShowDebugMenu -bool true 633 | 634 | ############################################################################### 635 | # Messages # 636 | ############################################################################### 637 | 638 | # Disable automatic emoji substitution (i.e. use plain text smileys) 639 | defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticEmojiSubstitutionEnablediMessage" -bool false 640 | 641 | # Disable smart quotes as it’s annoying for messages that contain code 642 | defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticQuoteSubstitutionEnabled" -bool false 643 | 644 | # Disable continuous spell checking 645 | defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "continuousSpellCheckingEnabled" -bool false 646 | 647 | ############################################################################### 648 | # Google Chrome & Google Chrome Canary # 649 | ############################################################################### 650 | 651 | # Allow installing user scripts via GitHub Gist or Userscripts.org 652 | defaults write com.google.Chrome ExtensionInstallSources -array "https://gist.githubusercontent.com/" "http://userscripts.org/*" 653 | defaults write com.google.Chrome.canary ExtensionInstallSources -array "https://gist.githubusercontent.com/" "http://userscripts.org/*" 654 | 655 | # Disable the all too sensitive backswipe 656 | defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false 657 | defaults write com.google.Chrome.canary AppleEnableSwipeNavigateWithScrolls -bool false 658 | 659 | # Use the system-native print preview dialog 660 | # defaults write com.google.Chrome DisablePrintPreview -bool true 661 | # defaults write com.google.Chrome.canary DisablePrintPreview -bool true 662 | 663 | ############################################################################### 664 | # GPGMail 2 # 665 | ############################################################################### 666 | 667 | # Disable signing emails by default 668 | # defaults write ~/Library/Preferences/org.gpgtools.gpgmail SignNewEmailsByDefault -bool false 669 | 670 | ############################################################################### 671 | # SizeUp.app # 672 | ############################################################################### 673 | 674 | # Start SizeUp at login 675 | # defaults write com.irradiatedsoftware.SizeUp StartAtLogin -bool true 676 | 677 | # Don’t show the preferences window on next start 678 | # defaults write com.irradiatedsoftware.SizeUp ShowPrefsOnNextStart -bool false 679 | 680 | ############################################################################### 681 | # Sublime Text # 682 | ############################################################################### 683 | 684 | # Install Sublime Text settings 685 | # cp -r init/Preferences.sublime-settings ~/Library/Application\ Support/Sublime\ Text*/Packages/User/Preferences.sublime-settings 2> /dev/null 686 | 687 | ############################################################################### 688 | # Transmission.app # 689 | ############################################################################### 690 | 691 | # Use `~/Documents/Torrents` to store incomplete downloads 692 | # defaults write org.m0k.transmission UseIncompleteDownloadFolder -bool true 693 | # defaults write org.m0k.transmission IncompleteDownloadFolder -string "${HOME}/Documents/Torrents" 694 | 695 | # Don’t prompt for confirmation before downloading 696 | # defaults write org.m0k.transmission DownloadAsk -bool false 697 | 698 | # Trash original torrent files 699 | # defaults write org.m0k.transmission DeleteOriginalTorrent -bool true 700 | 701 | # Hide the donate message 702 | # defaults write org.m0k.transmission WarningDonate -bool false 703 | # Hide the legal disclaimer 704 | # defaults write org.m0k.transmission WarningLegal -bool false 705 | 706 | ############################################################################### 707 | # Twitter.app # 708 | ############################################################################### 709 | 710 | # Disable smart quotes as it’s annoying for code tweets 711 | # defaults write com.twitter.twitter-mac AutomaticQuoteSubstitutionEnabled -bool false 712 | 713 | # Show the app window when clicking the menu bar icon 714 | # defaults write com.twitter.twitter-mac MenuItemBehavior -int 1 715 | 716 | # Enable the hidden ‘Develop’ menu 717 | # defaults write com.twitter.twitter-mac ShowDevelopMenu -bool true 718 | 719 | # Open links in the background 720 | # defaults write com.twitter.twitter-mac openLinksInBackground -bool true 721 | 722 | # Allow closing the ‘new tweet’ window by pressing `Esc` 723 | # defaults write com.twitter.twitter-mac ESCClosesComposeWindow -bool true 724 | 725 | # Show full names rather than Twitter handles 726 | # defaults write com.twitter.twitter-mac ShowFullNames -bool true 727 | 728 | # Hide the app in the background if it’s not the front-most window 729 | # defaults write com.twitter.twitter-mac HideInBackground -bool true 730 | 731 | ############################################################################### 732 | # Kill affected applications # 733 | ############################################################################### 734 | 735 | for app in "Activity Monitor" "Address Book" "Calendar" "Contacts" "cfprefsd" \ 736 | "Dock" "Finder" "Mail" "Messages" "Safari" "SizeUp" "SystemUIServer" \ 737 | "Terminal" "Transmission" "Twitter" "iCal"; do 738 | killall "${app}" > /dev/null 2>&1 739 | done 740 | echo "Done. Note that some of these changes require a logout/restart to take effect." 741 | -------------------------------------------------------------------------------- /dotfiles/.screenrc: -------------------------------------------------------------------------------- 1 | # Copyright 1999-2005 Gentoo Foundation 2 | # Distributed under the terms of the GNU General Public License v2 3 | # 4 | # /etc/screenrc 5 | # 6 | # This is the system wide screenrc. 7 | # 8 | # You can use this file to change the default behavior of screen system wide 9 | # or copy it to ~/.screenrc and use it as a starting point for your own 10 | # settings. 11 | # 12 | # Commands in this file are used to set options, bind screen functions to 13 | # keys, redefine terminal capabilities, and to automatically establish one or 14 | # more windows at the beginning of your screen session. 15 | # 16 | # This is not a comprehensive list of options, look at the screen manual for 17 | # details on everything that you can put in this file. 18 | # 19 | # 20 | 21 | # ============================================================================== 22 | # SCREEN SETTINGS 23 | # ============================================================================== 24 | 25 | # ESCAPE - the COMMAND CHARACTER 26 | # =============================================================== 27 | # escape ^aa # default 28 | # escape ^pp # suggested binding for emacs users 29 | 30 | 31 | # PASSWORD 32 | # =============================================================== 33 | # This commands sets the *internal* password for the screen session. 34 | # WARNING!! If this is set then a "lock" command will only let you in to the 35 | # session after you enter the user's account password and then *also* 36 | # the internal password for that session. This gives additional safety but, 37 | # if you forget the internal password then you cannot resume your session. 38 | # Use :password to generate a password 39 | # password ODSJQf.4IJN7E # "1234" 40 | 41 | 42 | # VARIABLES 43 | # =============================================================== 44 | # No annoying audible bell, using "visual bell" 45 | vbell off # default: off 46 | # vbell_msg " -- Bell,Bell!! -- " # default: "Wuff,Wuff!!" 47 | 48 | # Automatically detach on hangup. 49 | autodetach on # default: on 50 | 51 | # Alternative screen 52 | altscreen on 53 | 54 | # Don't display the copyright page 55 | startup_message off # default: on 56 | 57 | # Uses nethack-style messages 58 | # nethack on # default: off 59 | 60 | # Affects the copying of text regions 61 | crlf off # default: off 62 | 63 | # Enable UTF-8 64 | defutf8 on 65 | 66 | # Enable/disable multiuser mode. Standard screen operation is singleuser. 67 | # In multiuser mode the commands acladd, aclchg, aclgrp and acldel can be used 68 | # to enable (and disable) other user accessing this screen session. 69 | # Requires suid-root. 70 | multiuser off 71 | 72 | # Change default scrollback value for new windows 73 | defscrollback 1000 # default: 100 74 | 75 | # Define the time that all windows monitored for silence should 76 | # wait before displaying a message. Default 30 seconds. 77 | silencewait 15 # default: 30 78 | 79 | # bufferfile: The file to use for commands 80 | # "readbuf" ('<') and "writebuf" ('>'): 81 | bufferfile $HOME/.screen_exchange 82 | # 83 | # hardcopydir: The directory which contains all hardcopies. 84 | # hardcopydir ~/.hardcopy 85 | # hardcopydir ~/.screen 86 | # 87 | # shell: Default process started in screen's windows. 88 | # Makes it possible to use a different shell inside screen 89 | # than is set as the default login shell. 90 | # If begins with a '-' character, the shell will be started as a login shell. 91 | # shell zsh 92 | # shell bash 93 | # shell ksh 94 | shell -$SHELL 95 | 96 | # shellaka '> |tcsh' 97 | shelltitle '$ |bash' 98 | 99 | # emulate .logout message 100 | pow_detach_msg "Screen session of \$LOGNAME \$:cr:\$:nl:ended." 101 | 102 | # caption always " %w --- %c:%s" 103 | # caption always "%3n %t%? @%u%?%? [%h]%?%=%c" 104 | 105 | # advertise hardstatus support to $TERMCAP 106 | # termcapinfo * '' 'hs:ts=\E_:fs=\E\\:ds=\E_\E\\' 107 | 108 | # set every new windows hardstatus line to somenthing descriptive 109 | # defhstatus "screen: ^En (^Et)" 110 | 111 | # don't kill window after the process died 112 | # zombie "^[" 113 | 114 | 115 | # XTERM TWEAKS 116 | # =============================================================== 117 | 118 | # xterm understands both im/ic and doesn't have a status line. 119 | # Note: Do not specify im and ic in the real termcap/info file as 120 | # some programs (e.g. vi) will not work anymore. 121 | termcap xterm hs@:cs=\E[%i%d;%dr:im=\E[4h:ei=\E[4l 122 | terminfo xterm hs@:cs=\E[%i%p1%d;%p2%dr:im=\E[4h:ei=\E[4l 123 | 124 | # 80/132 column switching must be enabled for ^AW to work 125 | # change init sequence to not switch width 126 | termcapinfo xterm Z0=\E[?3h:Z1=\E[?3l:is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l 127 | 128 | # Make the output buffer large for (fast) xterms. 129 | # termcapinfo xterm* OL=10000 130 | termcapinfo xterm* OL=100 131 | 132 | # tell screen that xterm can switch to dark background and has function 133 | # keys. 134 | termcapinfo xterm 'VR=\E[?5h:VN=\E[?5l' 135 | termcapinfo xterm 'k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~' 136 | termcapinfo xterm 'kh=\EOH:kI=\E[2~:kD=\E[3~:kH=\EOF:kP=\E[5~:kN=\E[6~' 137 | 138 | # special xterm hardstatus: use the window title. 139 | termcapinfo xterm 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007' 140 | 141 | #terminfo xterm 'vb=\E[?5h$<200/>\E[?5l' 142 | termcapinfo xterm 'vi=\E[?25l:ve=\E[34h\E[?25h:vs=\E[34l' 143 | 144 | # emulate part of the 'K' charset 145 | termcapinfo xterm 'XC=K%,%\E(B,[\304,\\\\\326,]\334,{\344,|\366,}\374,~\337' 146 | 147 | # xterm-52 tweaks: 148 | # - uses background color for delete operations 149 | termcapinfo xterm* be 150 | 151 | # Do not use xterm's alternative window buffer, it breaks scrollback (see bug #61195) 152 | termcapinfo xterm|xterms|xs ti@:te=\E[2J 153 | 154 | # WYSE TERMINALS 155 | # =============================================================== 156 | 157 | #wyse-75-42 must have flow control (xo = "terminal uses xon/xoff") 158 | #essential to have it here, as this is a slow terminal. 159 | termcapinfo wy75-42 xo:hs@ 160 | 161 | # New termcap sequences for cursor application mode. 162 | termcapinfo wy* CS=\E[?1h:CE=\E[?1l:vi=\E[?25l:ve=\E[?25h:VR=\E[?5h:VN=\E[?5l:cb=\E[1K:CD=\E[1J 163 | 164 | 165 | # OTHER TERMINALS 166 | # =============================================================== 167 | 168 | # make hp700 termcap/info better 169 | termcapinfo hp700 'Z0=\E[?3h:Z1=\E[?3l:hs:ts=\E[62"p\E[0$~\E[2$~\E[1$}:fs=\E[0}\E[61"p:ds=\E[62"p\E[1$~\E[61"p:ic@' 170 | 171 | # Extend the vt100 desciption by some sequences. 172 | termcap vt100* ms:AL=\E[%dL:DL=\E[%dM:UP=\E[%dA:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC 173 | terminfo vt100* ms:AL=\E[%p1%dL:DL=\E[%p1%dM:UP=\E[%p1%dA:DO=\E[%p1%dB:LE=\E[%p1%dD:RI=\E[%p1%dC 174 | termcapinfo linux C8 175 | # old rxvt versions also need this 176 | # termcapinfo rxvt C8 177 | 178 | 179 | # KEYBINDINGS 180 | # ============================================================== 181 | # The "bind" command assign keys to (internal) commands 182 | # SCREEN checks all the keys you type; you type the key 183 | # which is known as the "command character" then SCREEN 184 | # eats this key, too, and checks whether this key is 185 | # "bound" to a command. If so then SCREEN will execute it. 186 | # 187 | # The command "bind" allows you to chose which keys 188 | # will be assigned to the commands. 189 | # 190 | # Some commands are bound to several keys - 191 | # usually to both some letter and its corresponding 192 | # control key combination, eg the command 193 | # "(create) screen" is bound to both 'c' and '^C'. 194 | # 195 | # The following list shows the default bindings: 196 | # 197 | # break ^B b 198 | # clear C 199 | # colon : 200 | # copy ^[ [ 201 | # detach ^D d 202 | # digraph ^V 203 | # displays * 204 | # dumptermcap . 205 | # fit F 206 | # flow ^F f 207 | # focus ^I 208 | # hardcopy h 209 | # help ? 210 | # history { } 211 | # info i 212 | # kill K k 213 | # lastmsg ^M m 214 | # license , 215 | # log H 216 | # login L 217 | # meta x 218 | # monitor M 219 | # next ^@ ^N sp n 220 | # number N 221 | # only Q 222 | # other ^X 223 | # pow_break B 224 | # pow_detach D 225 | # prev ^H ^P p ^? 226 | # quit \ 227 | # readbuf < 228 | # redisplay ^L l 229 | # remove X 230 | # removebuf = 231 | # reset Z 232 | # screen ^C c 233 | # select " ' 234 | # silence _ 235 | # split S 236 | # suspend ^Z z 237 | # time ^T t 238 | # title A 239 | # vbell ^G 240 | # version v 241 | # width W 242 | # windows ^W w 243 | # wrap ^R r 244 | # writebuf > 245 | # xoff ^S s 246 | # xon ^Q q 247 | # ^] paste . 248 | # - select - 249 | # 0 select 0 250 | # 1 select 1 251 | # 2 select 2 252 | # 3 select 3 253 | # 4 select 4 254 | # 5 select 5 255 | # 6 select 6 256 | # 7 select 7 257 | # 8 select 8 258 | # 9 select 9 259 | # I login on 260 | # O login off 261 | # ] paste . 262 | # 263 | 264 | # And here are the default bind commands if you need them: 265 | # 266 | # bind A title 267 | # bind C clear 268 | # bind D pow_detach 269 | # bind F fit 270 | # bind H log 271 | # bind I login on 272 | # bind K kill 273 | # bind L login 274 | # bind M monitor 275 | # bind N number 276 | # bind O login off 277 | # bind Q only 278 | # bind S split 279 | # bind W width 280 | # bind X remove 281 | # bind Z reset 282 | 283 | # Let's remove some dangerous key bindings ... 284 | bind k 285 | bind ^k 286 | # bind . dumptermcap # default 287 | bind . 288 | # bind ^\ quit # default 289 | bind ^\ 290 | # bind \\ quit # default 291 | bind \\ 292 | # bind ^h ??? # default 293 | bind ^h 294 | # bind h hardcopy # default 295 | bind h 296 | 297 | # ... and make them better. 298 | bind 'K' kill 299 | bind 'I' login on 300 | bind 'O' login off 301 | bind '}' history 302 | 303 | # Yet another hack: 304 | # Prepend/append register [/] to the paste if ^a^] is pressed. 305 | # This lets me have autoindent mode in vi. 306 | # register [ "\033:se noai\015a" 307 | # register ] "\033:se ai\015a" 308 | bind ^] paste [.] 309 | 310 | 311 | # hardstatus alwaysignore 312 | # hardstatus alwayslastline "%Lw" 313 | 314 | # Resize the current region. The space will be removed from or added to 315 | # the region below or if there's not enough space from the region above. 316 | bind = resize = 317 | bind + resize +3 318 | bind - resize -3 319 | # bind _ resize max 320 | # 321 | # attrcolor u "-u b" 322 | # attrcolor b "R" 323 | 324 | # STARTUP SCREENS 325 | # =============================================================== 326 | # Defines the time screen delays a new message when one message 327 | # is currently displayed. The default is 1 second. 328 | # msgminwait 2 329 | 330 | # Time a message is displayed if screen is not disturbed by 331 | # other activity. The dafault is 5 seconds: 332 | # msgwait 2 333 | 334 | # Briefly show the version number of this starting 335 | # screen session - but only for *one* second: 336 | # msgwait 1 337 | # version 338 | 339 | # Welcome the user: 340 | # echo "welcome :-)" 341 | # echo "I love you today." 342 | 343 | # Uncomment one/some following lines to automatically let 344 | # SCREEN start some programs in the given window numbers: 345 | # screen -t MAIL 0 mutt 346 | # screen -t EDIT 1 vim 347 | # screen -t GOOGLE 2 links http://www.google.com 348 | # screen -t NEWS 3 slrn 349 | # screen -t WWW 4 links http://www.math.fu-berlin.de/~guckes/ 350 | # screen 5 351 | # screen 6 352 | 353 | # Set the environment variable var to value string. If only var is specified, 354 | # you'll be prompted to enter a value. If no parameters are specified, 355 | # you'll be prompted for both variable and value. The environment is 356 | # inherited by all subsequently forked shells. 357 | 358 | # Don't you want to start programs which need a DISPLAY ? 359 | # setenv DISPLAY '' 360 | 361 | #change the hardstatus settings to give an window list at the bottom of the 362 | #screen, with the time and date and with the current window highlighted 363 | hardstatus alwayslastline 364 | #hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]' 365 | 366 | hardstatus string '%{= kw}%{c}[%H]%{w} %?%-Lw%?%{r}(%{W}%n-%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{c}%D %Y-%m-%d %0c' 367 | -------------------------------------------------------------------------------- /dotfiles/.ssh/authorized_keys/_generate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | config_dir="${DOTFILES_CONFIG_DIR}/ssh/authorized_keys" 4 | 5 | [[ -d "${config_dir}" ]] && find "${config_dir}" -maxdepth 1 -type f -exec cat '{}' \; 6 | -------------------------------------------------------------------------------- /dotfiles/.ssh/config/_generate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | config_dir="${DOTFILES_CONFIG_DIR}/ssh/config" 4 | 5 | [[ -d "${config_dir}" ]] && find "${config_dir}" -maxdepth 1 -type f -exec cat '{}' \; 6 | 7 | [[ -d "${config_dir}/hosts" ]] && find "${config_dir}/hosts" -type f -exec cat '{}' \; 8 | -------------------------------------------------------------------------------- /dotfiles/.tmux.conf/README.md: -------------------------------------------------------------------------------- 1 | # .tmux.conf 2 | 3 | 1. All files in [`parts`](parts) will be included in order. 4 | If the file ends with `.sh`, it will be executed and its output will be used. 5 | 2. All files in [`status-left`](status-left) will be concatenated to form `status-left` option. 6 | If the file ends with `.sh`, it will be executed and its output will be used. 7 | 3. Same for [`status-right`](status-right). 8 | -------------------------------------------------------------------------------- /dotfiles/.tmux.conf/_generate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 4 | 5 | for part in $(find "${DIR}/parts" -type f | sort); do 6 | content="$(cat_or_exec "${part}")" 7 | [ -n "${content}" ] && echo -e "\n# $(basename "${part}")\n${content}" 8 | done 9 | 10 | echo 11 | 12 | for side in left right; do 13 | status="" 14 | 15 | for part in $(find "${DIR}/status-${side}" -type f | sort); do 16 | content="$(cat_or_exec "${part}")" 17 | [[ -n "${content}" ]] && status="${status} ${content}" 18 | done 19 | 20 | if [[ -n "${status}" ]]; then 21 | status="$(escape_chars "${status}" "'" | sed -e 's/^ *//' -e 's/ *$//')" 22 | echo "set -g status-${side} '${status}#[default]'" 23 | fi 24 | done 25 | -------------------------------------------------------------------------------- /dotfiles/.tmux.conf/parts/10_bindings: -------------------------------------------------------------------------------- 1 | # act like GNU screen 2 | unbind C-b 3 | set -g prefix C-a 4 | bind-key C-a last-window 5 | bind-key a send-prefix 6 | 7 | # Reload key 8 | bind r source-file ~/.tmux.conf 9 | 10 | set-window-option -g mode-keys vi 11 | set-option -g mouse on 12 | -------------------------------------------------------------------------------- /dotfiles/.tmux.conf/parts/10_shell.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | shell="${SHELL}" 4 | 5 | echo "set-option -g default-shell $shell" 6 | 7 | if [[ "$(uname)" == "Darwin" ]]; then 8 | if program_exists reattach-to-user-namespace; then 9 | echo "set-option -g default-command \"reattach-to-user-namespace -l $shell\"" 10 | else 11 | echo "WARN: reattach-to-user-namespace is missing: brew install reattach-to-user-namespace" >&2 12 | fi 13 | fi 14 | -------------------------------------------------------------------------------- /dotfiles/.tmux.conf/parts/10_terminal.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # http://unix.stackexchange.com/questions/30058/how-can-i-check-which-terminal-definitions-are-available 4 | 5 | for term in xterm-256color screen-256color xterm-color screen xterm rxvt; do 6 | if tput -T $term cols >/dev/null 2>/dev/null; then 7 | echo "set -g default-terminal \"$term\"" 8 | if [[ "$term" = "xterm-256color" ]]; then 9 | # Support for italics 10 | # https://medium.com/@dubistkomisch/how-to-actually-get-italics-and-true-colour-to-work-in-iterm-tmux-vim-9ebe55ebc2be 11 | echo "set -as terminal-overrides ',xterm*:Tc:sitm=\E[3m'" 12 | fi 13 | break 14 | fi 15 | done 16 | -------------------------------------------------------------------------------- /dotfiles/.tmux.conf/parts/15_window_order: -------------------------------------------------------------------------------- 1 | # start window numbers at 1 to match keyboard order with tmux window order 2 | set -g base-index 1 3 | set-window-option -g pane-base-index 1 4 | # renumber windows sequentially after closing any of them 5 | set -g renumber-windows on -------------------------------------------------------------------------------- /dotfiles/.tmux.conf/parts/20_pbcopy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | program_exists reattach-to-user-namespace && program_exists pbcopy && echo "bind y run-shell \"reattach-to-user-namespace -l zsh -c 'tmux show-buffer | pbcopy'\"" 4 | -------------------------------------------------------------------------------- /dotfiles/.tmux.conf/parts/50_envvars: -------------------------------------------------------------------------------- 1 | # http://superuser.com/questions/237822/how-can-i-get-ssh-agent-working-over-ssh-and-in-tmux-on-os-x 2 | set -g update-environment "SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION" 3 | -------------------------------------------------------------------------------- /dotfiles/.tmux.conf/parts/50_theme: -------------------------------------------------------------------------------- 1 | set -g status-bg colour234 2 | set -g status-fg colour248 3 | set -g status-interval 3 4 | set -g status-left-length 30 5 | set -wg window-status-format ' #I-#W ' 6 | set -wg window-status-current-format '#[fg=white][#[default]#I-#W#[fg=white]]#[default]' 7 | set -g status-right-length 50 8 | -------------------------------------------------------------------------------- /dotfiles/.tmux.conf/parts/90_other: -------------------------------------------------------------------------------- 1 | set-option -g history-limit 4096 2 | set -g visual-bell off 3 | -------------------------------------------------------------------------------- /dotfiles/.tmux.conf/status-left/10_whoami: -------------------------------------------------------------------------------- 1 | #[fg=colour32]#(whoami)@#H 2 | -------------------------------------------------------------------------------- /dotfiles/.tmux.conf/status-right/10_temperature.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if program_exists sensors; then 4 | echo '#[fg=red]#(sensors | grep -E "\(Core|CPU\)" | grep -oE "[0-9]+\.[0-9]+°" | head -n1)' 5 | elif program_exists osx-cpu-temp; then 6 | echo '#[fg=red]#(osx-cpu-temp)' 7 | fi 8 | -------------------------------------------------------------------------------- /dotfiles/.tmux.conf/status-right/20_battery.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # https://gist.github.com/lavoiesl/11023856 4 | program_exists battery-status.sh && echo '#[fg=cyan]#(battery-status.sh 10)' 5 | -------------------------------------------------------------------------------- /dotfiles/.tmux.conf/status-right/30_load.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if program_exists uptime; then 4 | echo '#[fg=yellow]#(uptime | grep -oE "[0-9\., ]+$" | tr -d ",")' 5 | elif [[ -e '/proc/loadavg' ]]; then 6 | echo '#[fg=yellow]#(cut -d " " -f 1-3 /proc/loadavg)' 7 | fi 8 | -------------------------------------------------------------------------------- /dotfiles/.tmux.conf/status-right/90_time: -------------------------------------------------------------------------------- 1 | #[fg=white]%H:%M:%S 2 | -------------------------------------------------------------------------------- /dotfiles/.vimrc: -------------------------------------------------------------------------------- 1 | syntax on 2 | 3 | runtime mswin.vim 4 | " Disable paste mode when pasting (introduced by pasting in Windows) 5 | noremap 6 | 7 | filetype plugin on 8 | au filetype * setl nowrap 9 | au filetype * let b:did_indent = 1 10 | au filetype ruby setl sw=2 sts=2 ts=2 11 | 12 | " IMPORTANT: grep will sometimes skip displaying the file name if you 13 | " search in a singe file. This will confuse Latex-Suite. Set your grep 14 | " program to always generate a file-name. 15 | set grepprg=grep\ -nH\ $* 16 | 17 | " OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to 18 | " 'plaintex' instead of 'tex', which results in vim-latex not being loaded. 19 | " The following changes the default filetype back to 'tex': 20 | let g:tex_flavor='latex' 21 | 22 | set wildmenu 23 | set cpo-=< 24 | set wcm= 25 | map :emenu 26 | map "=strftime("%c")P 27 | 28 | set autoindent 29 | set autoread 30 | set autowriteall 31 | set backspace=2 32 | set complete-=t 33 | set clipboard=unnamed 34 | set expandtab 35 | set guioptions=c 36 | set hidden 37 | set history=100 38 | set incsearch 39 | set linebreak 40 | set mouse=a 41 | set nobackup 42 | set nostartofline 43 | set noswapfile 44 | set wrap 45 | set ruler 46 | set shiftwidth=2 47 | set showmode 48 | set softtabstop=2 49 | set tabstop=2 50 | set undolevels=100 51 | set mouse-=a 52 | set modeline 53 | set background=dark 54 | set nobomb 55 | 56 | if has("multi_byte") 57 | if &termencoding == "" 58 | let &termencoding = &encoding 59 | endif 60 | set encoding=utf-8 61 | setglobal fileencoding=utf-8 nobomb 62 | set fileencodings=ucs-bom,utf-8,latin1 63 | endif 64 | 65 | function! CleverTab() 66 | if strpart(getline('.'), col('.') - 2 , 1) =~ '\w' | return "\" | else | return "\" 67 | endfunction 68 | inoremap =CleverTab() 69 | 70 | let g:user_zen_settings = { 71 | \ 'indentation' : ' ', 72 | \} 73 | let g:user_zen_expandabbr_key = '' 74 | let g:use_zen_complete_tag = 1 75 | 76 | "set ofu=syntaxcomplete#Complete 77 | "set cindent 78 | "set smartindent 79 | "set autoindent 80 | "set expandtab 81 | "set tabstop=2 82 | "set shiftwidth=2 83 | -------------------------------------------------------------------------------- /dotfiles/.wgetrc: -------------------------------------------------------------------------------- 1 | # Use the server-provided last modification date, if available 2 | timestamping = on 3 | 4 | # Do not go up in the directory structure when downloading recursively 5 | no_parent = on 6 | 7 | # Wait 60 seconds before timing out. This applies to all timeouts: DNS, connect and read. (The default read timeout is 15 minutes!) 8 | timeout = 60 9 | 10 | # Retry a few times when a download fails, but don’t overdo it. (The default is 20!) 11 | tries = 3 12 | 13 | # Retry even when the connection was refused 14 | retry_connrefused = on 15 | 16 | # Use the last component of a redirection URL for the local file name 17 | trust_server_names = on 18 | 19 | # Follow FTP links from HTML documents by default 20 | follow_ftp = on 21 | 22 | # 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 23 | adjust_extension = on 24 | 25 | # Use UTF-8 as the default system encoding 26 | # Disabled as it makes `wget` builds that don’t support this feature unusable. 27 | # Does anyone know how to conditionally configure a wget setting? 28 | # http://unix.stackexchange.com/q/34730/6040 29 | #local_encoding = UTF-8 30 | 31 | # Ignore `robots.txt` and `` 32 | robots = off 33 | 34 | # Print the HTTP and FTP server responses 35 | server_response = on 36 | 37 | # Disguise as IE 9 on Windows 7 38 | user_agent = Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0) 39 | -------------------------------------------------------------------------------- /dotfiles/.zer0prompt.conf: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ####################### [USER CONFIGURATION] ####################### 4 | # You can change various settings for zer0prompt below! 5 | 6 | 7 | ### set zer0prompt colour theme ### 8 | # options -- cyan, blue, green, red, purple, yellow, black, white, none 9 | zpcl="cyan" 10 | 11 | 12 | ### set colour theme inverse mode ### 13 | # set to 1 to inverse colour theme 14 | zpcl_inverse="0" 15 | 16 | 17 | ### set colours for various info ### 18 | # colour reference at http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html 19 | zi1="\[\033[1;32m\]" # user@host:tty 20 | zi2="\[\033[1;35m\]" # current path 21 | zi3="\[\033[1;33m\]" # time 22 | zi4="\[\033[1;31m\]" # exit status 23 | zi5="\[\033[1;32m\]" # user identifier ($ or #) 24 | 25 | 26 | ### set time format ### 27 | # uncomment the one you want or make your own 28 | # formatting reference and examples at http://www.foragoodstrftime.com/ 29 | # ztime="%I:%M %P" # 12 hour, am/pm lowercase 30 | #ztime="%I:%M %p" # 12 hour, AM/PM uppercase 31 | #ztime="%I:%M:%S %P" # 12 hour, am/pm lowercase, with seconds 32 | #ztime="%I:%M:%S %p" # 12 hour, AM/PM uppercase, with seconds 33 | #ztime="%H:%M" # 24 hour 34 | ztime="%H:%M:%S" # 24 hour, with seconds 35 | #ztime="%F %I:%M %P" # complete date with 12 hour, am/pm lowercase 36 | #ztime="%a %b-%d %I:%M %P" # day with 12 hour, am/pm lowercase 37 | 38 | 39 | ### override line graphics ### 40 | # set to 1 to force line graphics into fallback mode 41 | zgfx_override="0" 42 | -------------------------------------------------------------------------------- /dotfiles/.zer0prompt.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ############################ [MAIN CODE] ############################ 4 | # DO NOT alter below this line unless you know what you are doing! 5 | # user configuration options are found in zer0prompt.conf 6 | 7 | # grab user config files via import 8 | source ~/.zer0prompt.conf 9 | 10 | # use bash builtin checkwinsize option for terminals which fail to properly 11 | # set the $COLUMNS variable. (bug workaround) 12 | shopt -s checkwinsize 13 | 14 | # set line graphics to use based on locale 15 | if [ "$zgfx_override" = "1" ]; then 16 | zg1="-"; zg2="r"; zg3="L"; zg4="|"; zg5="|"; zg6=">" # fallback GFX (forced) 17 | elif [ $(locale charmap) = "UTF-8" ]; then 18 | zg1="─"; zg2="┌"; zg3="└"; zg4="┤"; zg5="├"; zg6=">" # better GFX 19 | else 20 | zg1="-"; zg2="r"; zg3="L"; zg4="|"; zg5="|"; zg6=">" # fallback GFX 21 | fi 22 | 23 | # set inverse mode if set 24 | if [ "$zpcl_inverse" = "1" ]; then 25 | zci="\[\033[7m\]" #inverse 26 | else 27 | zci="" 28 | fi 29 | 30 | # set user info same colour as user selected host info colour 31 | zi0=$zi1 32 | 33 | # if root user then colour user info and user identifier red. 34 | [ "${UID}" = 0 ] && zi0="\[\033[1;31m\]" && zi5="\[\033[1;31m\]" 35 | 36 | # this function is run at every prompt update, keeping our variables updated. 37 | # bash's PROMPT_COMMAND option handles this (see end of this function). 38 | function pre_prompt { 39 | # show exit code of last failed command 40 | ZEXIT="${?}" 41 | [ "$ZEXIT" = "0" ] && ZEXIT="" 42 | 43 | ZPWD=${PWD/#$HOME/\~} # sorten home dir to ~ 44 | 45 | # set length of our important info 46 | local infolength="$(whoami)@$(hostname):$(basename $(tty))$ZPWD" 47 | # set length of our graphics 48 | local gfxlength=23 49 | 50 | # construct ZFILL size to fill terminal width (minus info/gfx lengths). 51 | local fillsize 52 | let fillsize=${COLUMNS}-${gfxlength}-${#infolength} 53 | ZFILL="" 54 | while [ "$fillsize" -gt "0" ]; do 55 | ZFILL="$ZFILL$zg1" 56 | let fillsize=${fillsize}-1 57 | done 58 | 59 | # determine how much to truncate ZPWD, if ZFILL can't shrink anymore. 60 | if [ "$fillsize" -lt "0" ]; then 61 | local cut=3-${fillsize} # some tricky math, 3-(-number)=+number 62 | ZPWD="...${ZPWD:${cut}}" 63 | fi 64 | } 65 | PROMPT_COMMAND=pre_prompt 66 | 67 | # this function tells bash how to draw our prompt 68 | function zer0prompt { 69 | local zc0="\[\033[0m\]" # clear all colors 70 | local zc1="\[\033[1;37m\]" 71 | local zc2="\[\033[0;37m\]" 72 | 73 | # set colour theme 74 | if [ "$zpcl" = "cyan" ]; then 75 | local zc3="\[\033[1;36m\]"; local zc4="\[\033[0;36m\]" 76 | elif [ "$zpcl" = "blue" ]; then 77 | local zc3="\[\033[1;34m\]"; local zc4="\[\033[0;34m\]" 78 | elif [ "$zpcl" = "green" ]; then 79 | local zc3="\[\033[1;32m\]"; local zc4="\[\033[0;32m\]" 80 | elif [ "$zpcl" = "red" ]; then 81 | local zc3="\[\033[1;31m\]"; local zc4="\[\033[0;31m\]" 82 | elif [ "$zpcl" = "purple" ]; then 83 | local zc3="\[\033[1;35m\]"; local zc4="\[\033[0;35m\]" 84 | elif [ "$zpcl" = "yellow" ]; then 85 | local zc3="\[\033[1;33m\]"; local zc4="\[\033[0;33m\]" 86 | elif [ "$zpcl" = "black" ]; then 87 | local zc3="\[\033[1;30m\]"; local zc4="\[\033[0;30m\]" 88 | elif [ "$zpcl" = "white" ]; then 89 | local zc3="\[\033[1;37m\]"; local zc4="\[\033[0;37m\]" 90 | else # none (no colour) 91 | local zc3=""; local zc4=""; local zc1=""; local zc2="" 92 | zi0=""; zi1=""; zi2=""; zi3=""; zi4=""; zi5="" 93 | fi 94 | 95 | # set titlebar info if xterm/rxvt 96 | case $TERM in 97 | xterm*|rxvt*) 98 | local TITLEBAR='\[\033]0;\u (\w) [${COLUMNS}x${LINES}]\007\]';; 99 | *) 100 | local TITLEBAR="";; 101 | esac 102 | 103 | # standard prompt 104 | PS1="${TITLEBAR}\ 105 | $zc1$zci$zg2$zg1$zc3$zg1$zc4$zci$zg1$zg4$zi0\u$zi1@\h:\l$zc4$zci$zg5$zg1$zc2$zci$zg1$zg1$zc4$zci\ 106 | \$ZFILL$zc3$zg1$zg1$zg1$zg1$zc1$zg1$zg1$zg1$zc3$zg1$zg1$zc4$zci$zg1$zg4$zi2\ 107 | \$ZPWD$zc4$zci$zg5$zg1$zc2$zci$zg1 108 | $zc3$zg3$zc4$zci$zg1$zg4$zi3\D{$ztime}$zci $zi5\\\$$zc4$zci$zg5$zi4\ 109 | \$ZEXIT$zc2$zci$zg1$zc3$zg6$zc0 " 110 | 111 | # continuation prompt 112 | PS2="$zc3$zci$zg3$zc4$zci$zg1$zg4$zi5\\\$$zc4$zci$zg5$zc2$zci$zg1$zc3$zg6$zc0 " 113 | } -------------------------------------------------------------------------------- /dotfiles/.zshrc/_generate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . "${DOTFILES_DIR}/dotfiles/.bashrc/common.sh" 4 | 5 | program_exists zsh && rc_dump zsh 6 | -------------------------------------------------------------------------------- /examples/.bashrc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # 00_PS1_guard.sh 4 | [ -z "$PS1" ] && return 5 | 6 | # 05_tmux.sh 7 | 8 | export ZSH_TMUX_AUTOSTART=true 9 | if [ -n "$TMUX" ]; then 10 | tmup () 11 | { 12 | echo -n "Updating to latest tmux environment..."; 13 | export IFS=","; 14 | for line in $(tmux showenv -t $(tmux display -p "#S") | tr "\n" ","); 15 | do 16 | if [[ $line == -* ]]; then 17 | unset $(echo $line | cut -c2-); 18 | else 19 | export $line; 20 | fi; 21 | done; 22 | unset IFS; 23 | echo "Done" 24 | } 25 | fi 26 | 27 | # 10_locale.sh 28 | export LANG='en_US.UTF-8' 29 | export LANGUAGE='en_US.UTF-8' 30 | export LC_ALL='en_US.UTF-8' 31 | export LESSCHARSET='UTF-8' 32 | 33 | # bash/10_paths.sh 34 | export PATH='/Users/lavoie_sl/bin:/usr/X11/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' 35 | 36 | # bash/20_brew_completion.sh 37 | . /usr/local/etc/bash_completion 38 | 39 | # 20_variables.sh 40 | export EDITOR=subl 41 | export HOMEBREW_GITHUB_API_TOKEN=INVALID 42 | export HOMEBREW_TEMP=/usr/local/tmp 43 | export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home 44 | 45 | # 30_grep_aliases.sh 46 | alias grep='grep --color=auto' 47 | alias egrep='egrep --color=auto' 48 | alias fgrep='fgrep --color=auto' 49 | 50 | # bash/30_ls_aliases.sh 51 | alias ls='ls -FC' 52 | alias l='ls -FC' 53 | alias la='ls -FCa' 54 | alias ll='ls -FCl' 55 | alias lal='ls -FCal' 56 | 57 | # bash/30_prompt.sh 58 | export CLICOLOR='1' 59 | export LSCOLORS='exfxcxdxbxegedabagacad' 60 | . /Users/lavoie_sl/.zer0prompt.sh 61 | zer0prompt 62 | 63 | # 30_rvm.sh 64 | source "/Users/lavoie_sl/.rvm/scripts/rvm" 65 | 66 | # 30_ssh_settitle.sh 67 | 68 | if [ -n "$TMUX" ]; then 69 | settitle() { 70 | printf "\033k$1\033\\" 71 | } 72 | 73 | ssh() { 74 | settitle "$(echo $* | head -c 20)" 75 | command ssh "$@" 76 | settitle "bash" 77 | } 78 | fi 79 | 80 | # 50_aliases.sh 81 | alias cacl="find app/logs -name '*.log' -delete && app/console ca:cl --no-warmup" 82 | alias g="git" 83 | alias git-root="cd \"\$(git root)\"" 84 | alias rrm="rm -Rf" 85 | alias vihosts="sudo vi /etc/hosts" 86 | 87 | # 95_cd.sh 88 | cd 89 | -------------------------------------------------------------------------------- /examples/.dotfiles-config/ssh/authorized_keys/EXAMPLE: -------------------------------------------------------------------------------- 1 | ssh-rsa INVALID EXAMPLE 2 | -------------------------------------------------------------------------------- /examples/.dotfiles-config/ssh/config/ForwardAgent: -------------------------------------------------------------------------------- 1 | ForwardAgent yes 2 | -------------------------------------------------------------------------------- /examples/.dotfiles-config/ssh/config/PermitLocalCommand: -------------------------------------------------------------------------------- 1 | PermitLocalCommand yes 2 | -------------------------------------------------------------------------------- /examples/.dotfiles-config/ssh/config/ServerAliveInterval: -------------------------------------------------------------------------------- 1 | ServerAliveInterval 20 2 | -------------------------------------------------------------------------------- /examples/.dotfiles-config/ssh/config/hosts/example: -------------------------------------------------------------------------------- 1 | 2 | Host example 3 | HostName 127.0.0.1 4 | User me 5 | -------------------------------------------------------------------------------- /examples/.dotfiles-config/vars/HOMEBREW_GITHUB_API_TOKEN: -------------------------------------------------------------------------------- 1 | INVALID 2 | -------------------------------------------------------------------------------- /examples/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 4 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /examples/.gitattributes: -------------------------------------------------------------------------------- 1 | *.php diff=php 2 | -------------------------------------------------------------------------------- /examples/.gitconfig: -------------------------------------------------------------------------------- 1 | [someother] 2 | config = "not overwritten" 3 | [include] 4 | path = .gitconfig.dist 5 | -------------------------------------------------------------------------------- /examples/.gitconfig.dist: -------------------------------------------------------------------------------- 1 | # http://blog.lavoie.sl/2012/10/git-tutorial-and-global-configs.html 2 | 3 | [alias] 4 | alias = "!sh -c '[ $# = 2 ] && git config --global alias.\"$1\" \"$2\" && exit 0 || echo \"usage: git alias \" >&2 && exit 1' -" 5 | aliases = "!git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /'" 6 | br = "branch" 7 | br-gone = "!git branch -vv | grep -F ': gone]' | awk '{ print $1 }' | grep -vF '*'" 8 | br-prune = "!git branch -vv --merged | grep -F ': gone]' | awk '{ print $1 }' | grep -vF '*' | xargs git branch -d" 9 | brp = "!sh -c '[ $# = 1 ] && git checkout -b \"$1\" && git push -u origin \"$1\" || echo \"usage: git brp \" >&2 && exit 1' -" 10 | checkout-pr = "!sh -c 'pr=\"$1\"; remote=${2:-origin}; [ -n \"$pr\" ] && (br=\"pr${pr}\"; if [ \"$(git rev-parse --abbrev-ref HEAD)\" = $br ]; then git pull --autostash --rebase $remote pull/$pr/head; else git fetch $remote +pull/$pr/head:$br && git checkout $br; fi) || echo \"usage: git checkout-pr 123 \" >&2 && exit 1' -" 11 | ci = "commit" 12 | co = "checkout" 13 | d = "diff" 14 | dc = "diff --cached" 15 | dn = "diff --name-status" 16 | forest = "log --pretty=format:'%H%d: %s%n %ad %n %an (%ae)' --graph --all" 17 | ign = "ls-files -o -i --exclude-standard" 18 | lg = "log --graph --pretty=format:'%Cred%h %C(yellow)%d %C(bold blue)<%an> %Cgreen(%cr) %n %Creset %s' --abbrev-commit --date=relative" 19 | lg-local = "!git lg $(git branch | tr -d ' *' | awk '{ print \"master~1..\"$0 }')" 20 | pp = "!git pull && git push" 21 | pu = "!git push -u origin HEAD:$(git rev-parse --abbrev-ref HEAD)" 22 | rank = "shortlog -sn --no-merges" 23 | rbp = "!sh -c 'git pull && git rebase master && git push -f origin $(git br | grep \"^\\*\" | sed \"s/^\\* *//\")'" 24 | root = "rev-parse --show-toplevel" 25 | s = "show" 26 | searchcommits = "!f() { query=\"$1\"; shift; git log -S\"$query\" \"$@\"; }; f \"$@\"" 27 | sn = "show --name-status --pretty=fuller" 28 | st = "status" 29 | tree = "log --pretty=format:'%H%d: %s%n %ad %n %an (%ae)' --graph" 30 | w = "whatchanged" 31 | who = "shortlog -s --" 32 | 33 | [apply] 34 | whitespace = "fix" 35 | 36 | # http://stevenharman.net/git-pull-with-automatic-rebase 37 | [branch] 38 | autosetuprebase = "always" 39 | 40 | [color] 41 | branch = "auto" 42 | diff = "auto" 43 | interactive = "auto" 44 | pager = "true" 45 | status = "auto" 46 | ui = "true" 47 | 48 | [color "branch"] 49 | current = "yellow reverse" 50 | local = "yellow" 51 | remote = "green" 52 | 53 | [color "diff"] 54 | frag = "magenta bold" 55 | meta = "yellow bold" 56 | new = "green bold" 57 | old = "red bold" 58 | 59 | [color "status"] 60 | added = "yellow" 61 | changed = "green" 62 | untracked = "cyan" 63 | 64 | [commit] 65 | gpgsign = "true" 66 | 67 | [core] 68 | attributesfile = "/Users/lavoie_sl/.gitattributes" 69 | editor = "/usr/local/bin/vim" 70 | excludesfile = "/Users/lavoie_sl/.gitignore" 71 | pager = "diff-so-fancy" 72 | trustctime = "false" 73 | whitespace = "fix,-indent-with-non-tab,trailing-space,cr-at-eol,space-before-tab" 74 | 75 | [credential] 76 | helper = "osxkeychain" 77 | 78 | [diff] 79 | compactionHeuristic = "true" 80 | renames = "copies" 81 | tool = "Kaleidoscope" 82 | 83 | # https://github.com/so-fancy/diff-so-fancy 84 | [diff-so-fancy] 85 | changeHunkIndicators = "false" 86 | markEmptyLines = "false" 87 | stripLeadingSymbols = "false" 88 | 89 | [difftool] 90 | prompt = "false" 91 | 92 | [difftool "Kaleidoscope"] 93 | cmd = "ksdiff --partial-changeset --relative-path \"$MERGED\" -- \"$LOCAL\" \"$REMOTE\"" 94 | 95 | [fetch] 96 | prune = "true" 97 | 98 | [filter "lfs"] 99 | clean = "git-lfs clean -- %f" 100 | required = "true" 101 | smudge = "git-lfs smudge -- %f" 102 | 103 | [interactive] 104 | diffFilter = "diff-so-fancy" 105 | 106 | # http://twobitlabs.com/2011/08/install-diffmerge-git-mac-os-x/ 107 | [merge] 108 | log = "true" 109 | tool = "Kaleidoscope" 110 | 111 | # http://stackoverflow.com/questions/1251681/diff-tool-generates-unwanted-orig-files 112 | [mergetool] 113 | keepBackup = "false" 114 | 115 | [mergetool "Kaleidoscope"] 116 | cmd = "ksdiff --merge --output \"$MERGED\" --base \"$BASE\" -- \"$LOCAL\" --snapshot \"$REMOTE\" --snapshot" 117 | trustExitCode = "true" 118 | 119 | [pager] 120 | diff = "diff-so-fancy | less --tabs=4 -RFX" 121 | show = "diff-so-fancy | less --tabs=4 -RFX" 122 | 123 | # http://pivotallabs.com/users/alex/blog/articles/883-git-config-push-default-matching 124 | [push] 125 | default = "upstream" 126 | 127 | [user] 128 | email = "lavoie_sl@apple.com" 129 | name = "Sebastien Lavoie" 130 | signingkey = "706C5F8A43AD63B9" 131 | -------------------------------------------------------------------------------- /examples/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled source 2 | *.class 3 | *.com 4 | *.dll 5 | *.exe 6 | *.o 7 | *.pyc 8 | *.pyo 9 | *.so 10 | .bundle 11 | 12 | # OS generated files 13 | .Spotlight-V100 14 | *.DS_Store 15 | .Trashes 16 | ehthumbs.db 17 | Icon? 18 | Thumbs.db 19 | 20 | # Temp and swap files 21 | *.sw[nop] 22 | *.tmp 23 | *~ 24 | .*.swp 25 | ._* 26 | -------------------------------------------------------------------------------- /examples/.inputrc: -------------------------------------------------------------------------------- 1 | # Make Tab autocomplete regardless of filename case 2 | set completion-ignore-case on 3 | 4 | # List all matches in case multiple possible completions are possible 5 | set show-all-if-ambiguous on 6 | 7 | # Immediately add a trailing slash when autocompleting symlinks to directories 8 | set mark-symlinked-directories on 9 | 10 | # Use the text that has already been typed as the prefix for searching through 11 | # commands (i.e. more intelligent Up/Down behavior) 12 | "\e[B": history-search-forward 13 | "\e[A": history-search-backward 14 | 15 | # Do not autocomplete hidden files unless the pattern explicitly begins with a dot 16 | set match-hidden-files off 17 | 18 | # Show all autocomplete results at once 19 | set page-completions off 20 | 21 | # If there are more than 200 possible completions for a word, ask to show them all 22 | set completion-query-items 200 23 | 24 | # Show extra file information when completing, like `ls -F` does 25 | set visible-stats on 26 | 27 | # Be more intelligent when autocompleting by also looking at the text after 28 | # the cursor. For example, when the current line is "cd ~/src/mozil", and 29 | # the cursor is on the "z", pressing Tab will not autocomplete it to "cd 30 | # ~/src/mozillail", but to "cd ~/src/mozilla". (This is supported by the 31 | # Readline used by Bash 4.) 32 | set skip-completed-text on 33 | 34 | # Allow UTF-8 input and output, instead of showing stuff like $'\0123\0456' 35 | set input-meta on 36 | set output-meta on 37 | set convert-meta off 38 | 39 | # Use Alt/Meta + Delete to delete the preceding word 40 | "\e[3;3~": kill-word 41 | -------------------------------------------------------------------------------- /examples/.osx: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # ~/.osx — https://mths.be/osx 4 | 5 | # Ask for the administrator password upfront 6 | sudo -v 7 | 8 | # Keep-alive: update existing `sudo` time stamp until `.osx` has finished 9 | while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & 10 | 11 | ############################################################################### 12 | # General UI/UX # 13 | ############################################################################### 14 | 15 | # Set computer name (as done via System Preferences → Sharing) 16 | #sudo scutil --set ComputerName "0x6D746873" 17 | #sudo scutil --set HostName "0x6D746873" 18 | #sudo scutil --set LocalHostName "0x6D746873" 19 | #sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "0x6D746873" 20 | 21 | # Set standby delay to 24 hours (default is 1 hour) 22 | sudo pmset -a standbydelay 86400 23 | 24 | # Disable the sound effects on boot 25 | sudo nvram SystemAudioVolume=" " 26 | 27 | # Disable transparency in the menu bar and elsewhere on Yosemite 28 | # defaults write com.apple.universalaccess reduceTransparency -bool true 29 | 30 | # Menu bar: hide the Time Machine, Volume, User, and Bluetooth icons 31 | # for domain in ~/Library/Preferences/ByHost/com.apple.systemuiserver.*; do 32 | # defaults write "${domain}" dontAutoLoad -array \ 33 | # "/System/Library/CoreServices/Menu Extras/TimeMachine.menu" \ 34 | # "/System/Library/CoreServices/Menu Extras/Volume.menu" \ 35 | # "/System/Library/CoreServices/Menu Extras/User.menu" 36 | # done 37 | defaults write com.apple.systemuiserver menuExtras -array \ 38 | "/System/Library/CoreServices/Menu Extras/Bluetooth.menu" \ 39 | "/System/Library/CoreServices/Menu Extras/AirPort.menu" \ 40 | "/System/Library/CoreServices/Menu Extras/Battery.menu" \ 41 | "/System/Library/CoreServices/Menu Extras/Clock.menu" \ 42 | "/System/Library/CoreServices/Menu Extras/User.menu" 43 | 44 | # Set highlight color to green 45 | # defaults write NSGlobalDomain AppleHighlightColor -string "0.764700 0.976500 0.568600" 46 | 47 | # Set sidebar icon size to medium 48 | # defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 2 49 | 50 | # Always show scrollbars 51 | # defaults write NSGlobalDomain AppleShowScrollBars -string "Always" 52 | # Possible values: `WhenScrolling`, `Automatic` and `Always` 53 | 54 | # Disable smooth scrolling 55 | # (Uncomment if you’re on an older Mac that messes up the animation) 56 | #defaults write NSGlobalDomain NSScrollAnimationEnabled -bool false 57 | 58 | # Increase window resize speed for Cocoa applications 59 | defaults write NSGlobalDomain NSWindowResizeTime -float 0.001 60 | 61 | # Expand save panel by default 62 | defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true 63 | defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true 64 | 65 | # Expand print panel by default 66 | defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true 67 | defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true 68 | 69 | # Save to disk (not to iCloud) by default 70 | defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false 71 | 72 | # Automatically quit printer app once the print jobs complete 73 | defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true 74 | 75 | # Disable the “Are you sure you want to open this application?” dialog 76 | defaults write com.apple.LaunchServices LSQuarantine -bool false 77 | 78 | # Remove duplicates in the “Open With” menu (also see `lscleanup` alias) 79 | /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user 80 | 81 | # Display ASCII control characters using caret notation in standard text views 82 | # Try e.g. `cd /tmp; unidecode "\x{0000}" > cc.txt; open -e cc.txt` 83 | # defaults write NSGlobalDomain NSTextShowsControlCharacters -bool true 84 | 85 | # Disable Resume system-wide 86 | defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false 87 | 88 | # Disable automatic termination of inactive apps 89 | # defaults write NSGlobalDomain NSDisableAutomaticTermination -bool true 90 | 91 | # Disable the crash reporter 92 | #defaults write com.apple.CrashReporter DialogType -string "none" 93 | 94 | # Set Help Viewer windows to non-floating mode 95 | # defaults write com.apple.helpviewer DevMode -bool true 96 | 97 | # Fix for the ancient UTF-8 bug in QuickLook (https://mths.be/bbo) 98 | # Commented out, as this is known to cause problems in various Adobe apps :( 99 | # See https://github.com/mathiasbynens/dotfiles/issues/237 100 | #echo "0x08000100:0" > ~/.CFUserTextEncoding 101 | 102 | # Reveal IP address, hostname, OS version, etc. when clicking the clock 103 | # in the login window 104 | sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName 105 | 106 | # Restart automatically if the computer freezes 107 | sudo systemsetup -setrestartfreeze on 108 | 109 | # Never go into computer sleep mode 110 | sudo systemsetup -setcomputersleep Off > /dev/null 111 | 112 | # Check for software updates daily, not just once per week 113 | defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 114 | 115 | # Disable Notification Center and remove the menu bar icon 116 | launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist 2> /dev/null 117 | 118 | # Disable smart quotes as they’re annoying when typing code 119 | # defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false 120 | 121 | # Disable smart dashes as they’re annoying when typing code 122 | # defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false 123 | 124 | # Set a custom wallpaper image. `DefaultDesktop.jpg` is already a symlink, and 125 | # all wallpapers are in `/Library/Desktop Pictures/`. The default is `Wave.jpg`. 126 | #rm -rf ~/Library/Application Support/Dock/desktoppicture.db 127 | #sudo rm -rf /System/Library/CoreServices/DefaultDesktop.jpg 128 | #sudo ln -s /path/to/your/image /System/Library/CoreServices/DefaultDesktop.jpg 129 | 130 | ############################################################################### 131 | # SSD-specific tweaks # 132 | ############################################################################### 133 | 134 | # Disable local Time Machine snapshots 135 | sudo tmutil disablelocal 136 | 137 | # Disable hibernation (speeds up entering sleep mode) 138 | sudo pmset -a hibernatemode 0 139 | 140 | # Remove the sleep image file to save disk space 141 | sudo rm /Private/var/vm/sleepimage 142 | # Create a zero-byte file instead… 143 | sudo touch /Private/var/vm/sleepimage 144 | # …and make sure it can’t be rewritten 145 | sudo chflags uchg /Private/var/vm/sleepimage 146 | 147 | # Disable the sudden motion sensor as it’s not useful for SSDs 148 | sudo pmset -a sms 0 149 | 150 | ############################################################################### 151 | # Trackpad, mouse, keyboard, Bluetooth accessories, and input # 152 | ############################################################################### 153 | 154 | # Trackpad: enable tap to click for this user and for the login screen 155 | # defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true 156 | # defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 157 | # defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 158 | 159 | # Trackpad: map bottom right corner to right-click 160 | # defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2 161 | # defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true 162 | # defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1 163 | # defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true 164 | 165 | # Disable “natural” (Lion-style) scrolling 166 | # defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false 167 | 168 | # Increase sound quality for Bluetooth headphones/headsets 169 | defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40 170 | 171 | # Enable full keyboard access for all controls 172 | # (e.g. enable Tab in modal dialogs) 173 | defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 174 | 175 | # Use scroll gesture with the Ctrl (^) modifier key to zoom 176 | defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true 177 | defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144 178 | # Follow the keyboard focus while zoomed in 179 | defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true 180 | 181 | # Disable press-and-hold for keys in favor of key repeat 182 | defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false 183 | 184 | # Set a blazingly fast keyboard repeat rate 185 | defaults write NSGlobalDomain KeyRepeat -int 0.1 186 | 187 | # Set language and text formats 188 | # Note: if you’re in the US, replace `EUR` with `USD`, `Centimeters` with 189 | # `Inches`, `en_GB` with `en_US`, and `true` with `false`. 190 | defaults write NSGlobalDomain AppleLanguages -array "en" "fr" 191 | defaults write NSGlobalDomain AppleLocale -string "en_CA@currency=CAD" 192 | defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters" 193 | defaults write NSGlobalDomain AppleMetricUnits -bool true 194 | 195 | # Set the timezone; see `sudo systemsetup -listtimezones` for other values 196 | sudo systemsetup -settimezone "America/Montreal" > /dev/null 197 | 198 | # Disable auto-correct 199 | # defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false 200 | 201 | # Stop iTunes from responding to the keyboard media keys 202 | #launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist 2> /dev/null 203 | 204 | ############################################################################### 205 | # Screen # 206 | ############################################################################### 207 | 208 | # Require password immediately after sleep or screen saver begins 209 | defaults write com.apple.screensaver askForPassword -int 1 210 | defaults write com.apple.screensaver askForPasswordDelay -int 0 211 | 212 | # Save screenshots to the desktop 213 | defaults write com.apple.screencapture location -string "${HOME}/Desktop" 214 | 215 | # Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF) 216 | defaults write com.apple.screencapture type -string "png" 217 | 218 | # Disable shadow in screenshots 219 | # defaults write com.apple.screencapture disable-shadow -bool true 220 | 221 | # Enable subpixel font rendering on non-Apple LCDs 222 | defaults write NSGlobalDomain AppleFontSmoothing -int 2 223 | 224 | # Enable HiDPI display modes (requires restart) 225 | # sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true 226 | 227 | ############################################################################### 228 | # Finder # 229 | ############################################################################### 230 | 231 | # Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons 232 | # defaults write com.apple.finder QuitMenuItem -bool true 233 | 234 | # Finder: disable window animations and Get Info animations 235 | # defaults write com.apple.finder DisableAllAnimations -bool true 236 | 237 | # Set Desktop as the default location for new Finder windows 238 | # For other paths, use `PfLo` and `file:///full/path/here/` 239 | defaults write com.apple.finder NewWindowTarget -string "PfLo" 240 | defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/" 241 | 242 | # Show icons for hard drives, servers, and removable media on the desktop 243 | defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true 244 | defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true 245 | defaults write com.apple.finder ShowMountedServersOnDesktop -bool true 246 | defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true 247 | 248 | # Finder: show hidden files by default 249 | #defaults write com.apple.finder AppleShowAllFiles -bool true 250 | 251 | # Finder: show all filename extensions 252 | defaults write NSGlobalDomain AppleShowAllExtensions -bool true 253 | 254 | # Finder: show status bar 255 | defaults write com.apple.finder ShowStatusBar -bool true 256 | 257 | # Finder: show path bar 258 | defaults write com.apple.finder ShowPathbar -bool true 259 | 260 | # Finder: allow text selection in Quick Look 261 | defaults write com.apple.finder QLEnableTextSelection -bool true 262 | 263 | # Display full POSIX path as Finder window title 264 | # defaults write com.apple.finder _FXShowPosixPathInTitle -bool true 265 | 266 | # When performing a search, search the current folder by default 267 | defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" 268 | 269 | # Disable the warning when changing a file extension 270 | defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false 271 | 272 | # Enable spring loading for directories 273 | defaults write NSGlobalDomain com.apple.springing.enabled -bool true 274 | 275 | # Remove the spring loading delay for directories 276 | defaults write NSGlobalDomain com.apple.springing.delay -float 0 277 | 278 | # Avoid creating .DS_Store files on network volumes 279 | defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true 280 | 281 | # Disable disk image verification 282 | defaults write com.apple.frameworks.diskimages skip-verify -bool true 283 | defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true 284 | defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true 285 | 286 | # Automatically open a new Finder window when a volume is mounted 287 | defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true 288 | defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true 289 | defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true 290 | 291 | # Show item info near icons on the desktop and in other icon views 292 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist 293 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist 294 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist 295 | 296 | # Show item info to the right of the icons on the desktop 297 | /usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:labelOnBottom false" ~/Library/Preferences/com.apple.finder.plist 298 | 299 | # Enable snap-to-grid for icons on the desktop and in other icon views 300 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist 301 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist 302 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist 303 | 304 | # Increase grid spacing for icons on the desktop and in other icon views 305 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist 306 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist 307 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist 308 | 309 | # Increase the size of icons on the desktop and in other icon views 310 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist 311 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist 312 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist 313 | 314 | # Use list view in all Finder windows by default 315 | # Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv`, `Nlsv` 316 | defaults write com.apple.finder FXPreferredViewStyle -string "clmv" 317 | 318 | # Disable the warning before emptying the Trash 319 | defaults write com.apple.finder WarnOnEmptyTrash -bool false 320 | 321 | # Empty Trash securely by default 322 | defaults write com.apple.finder EmptyTrashSecurely -bool true 323 | 324 | # Enable AirDrop over Ethernet and on unsupported Macs running Lion 325 | defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true 326 | 327 | # Enable the MacBook Air SuperDrive on any Mac 328 | sudo nvram boot-args="mbasd=1" 329 | 330 | # Show the ~/Library folder 331 | chflags nohidden ~/Library 332 | 333 | # Remove Dropbox’s green checkmark icons in Finder 334 | # file=/Applications/Dropbox.app/Contents/Resources/emblem-dropbox-uptodate.icns 335 | # [ -e "${file}" ] && mv -f "${file}" "${file}.bak" 336 | 337 | # Expand the following File Info panes: 338 | # “General”, “Open with”, and “Sharing & Permissions” 339 | defaults write com.apple.finder FXInfoPanesExpanded -dict \ 340 | General -bool true \ 341 | OpenWith -bool true \ 342 | Privileges -bool true 343 | 344 | ############################################################################### 345 | # Dock, Dashboard, and hot corners # 346 | ############################################################################### 347 | 348 | # Enable highlight hover effect for the grid view of a stack (Dock) 349 | defaults write com.apple.dock mouse-over-hilite-stack -bool true 350 | 351 | # Set the icon size of Dock items to 36 pixels 352 | # defaults write com.apple.dock tilesize -int 36 353 | 354 | # Change minimize/maximize window effect 355 | # defaults write com.apple.dock mineffect -string "scale" 356 | 357 | # Minimize windows into their application’s icon 358 | defaults write com.apple.dock minimize-to-application -bool true 359 | 360 | # Enable spring loading for all Dock items 361 | defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true 362 | 363 | # Show indicator lights for open applications in the Dock 364 | defaults write com.apple.dock show-process-indicators -bool true 365 | 366 | # Wipe all (default) app icons from the Dock 367 | # This is only really useful when setting up a new Mac, or if you don’t use 368 | # the Dock to launch apps. 369 | #defaults write com.apple.dock persistent-apps -array "" 370 | 371 | # Don’t animate opening applications from the Dock 372 | defaults write com.apple.dock launchanim -bool false 373 | 374 | # Speed up Mission Control animations 375 | defaults write com.apple.dock expose-animation-duration -float 0.1 376 | 377 | # Don’t group windows by application in Mission Control 378 | # (i.e. use the old Exposé behavior instead) 379 | defaults write com.apple.dock expose-group-by-app -bool false 380 | 381 | # Disable Dashboard 382 | defaults write com.apple.dashboard mcx-disabled -bool true 383 | 384 | # Don’t show Dashboard as a Space 385 | defaults write com.apple.dock dashboard-in-overlay -bool true 386 | 387 | # Don’t automatically rearrange Spaces based on most recent use 388 | defaults write com.apple.dock mru-spaces -bool false 389 | 390 | # Remove the auto-hiding Dock delay 391 | defaults write com.apple.dock autohide-delay -float 0 392 | # Remove the animation when hiding/showing the Dock 393 | defaults write com.apple.dock autohide-time-modifier -float 0 394 | 395 | # Automatically hide and show the Dock 396 | defaults write com.apple.dock autohide -bool true 397 | 398 | # Make Dock icons of hidden applications translucent 399 | defaults write com.apple.dock showhidden -bool true 400 | 401 | # Disable the Launchpad gesture (pinch with thumb and three fingers) 402 | #defaults write com.apple.dock showLaunchpadGestureEnabled -int 0 403 | 404 | # Reset Launchpad, but keep the desktop wallpaper intact 405 | find "${HOME}/Library/Application Support/Dock" -maxdepth 1 -name "*-*.db" -delete 406 | 407 | # Add iOS Simulator to Launchpad 408 | # sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app" "/Applications/iOS Simulator.app" 409 | 410 | # Add a spacer to the left side of the Dock (where the applications are) 411 | #defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}' 412 | # Add a spacer to the right side of the Dock (where the Trash is) 413 | #defaults write com.apple.dock persistent-others -array-add '{tile-data={}; tile-type="spacer-tile";}' 414 | 415 | # Hot corners 416 | # Possible values: 417 | # 0: no-op 418 | # 2: Mission Control 419 | # 3: Show application windows 420 | # 4: Desktop 421 | # 5: Start screen saver 422 | # 6: Disable screen saver 423 | # 7: Dashboard 424 | # 10: Put display to sleep 425 | # 11: Launchpad 426 | # 12: Notification Center 427 | # Top left screen corner → Mission Control 428 | # defaults write com.apple.dock wvous-tl-corner -int 2 429 | # defaults write com.apple.dock wvous-tl-modifier -int 0 430 | # Top right screen corner → Desktop 431 | # defaults write com.apple.dock wvous-tr-corner -int 4 432 | # defaults write com.apple.dock wvous-tr-modifier -int 0 433 | # Bottom left screen corner → Start screen saver 434 | # defaults write com.apple.dock wvous-bl-corner -int 5 435 | # defaults write com.apple.dock wvous-bl-modifier -int 0 436 | 437 | ############################################################################### 438 | # Safari & WebKit # 439 | ############################################################################### 440 | 441 | # Privacy: don’t send search queries to Apple 442 | defaults write com.apple.Safari UniversalSearchEnabled -bool false 443 | 444 | # Press Tab to highlight each item on a web page 445 | defaults write com.apple.Safari WebKitTabToLinksPreferenceKey -bool true 446 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2TabsToLinks -bool true 447 | 448 | # Show the full URL in the address bar (note: this still hides the scheme) 449 | defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true 450 | 451 | # Set Safari’s home page to `about:blank` for faster loading 452 | defaults write com.apple.Safari HomePage -string "about:blank" 453 | 454 | # Prevent Safari from opening ‘safe’ files automatically after downloading 455 | defaults write com.apple.Safari AutoOpenSafeDownloads -bool false 456 | 457 | # Allow hitting the Backspace key to go to the previous page in history 458 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool true 459 | 460 | # Hide Safari’s bookmarks bar by default 461 | defaults write com.apple.Safari ShowFavoritesBar -bool false 462 | 463 | # Hide Safari’s sidebar in Top Sites 464 | defaults write com.apple.Safari ShowSidebarInTopSites -bool false 465 | 466 | # Disable Safari’s thumbnail cache for History and Top Sites 467 | defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2 468 | 469 | # Enable Safari’s debug menu 470 | defaults write com.apple.Safari IncludeInternalDebugMenu -bool true 471 | 472 | # Make Safari’s search banners default to Contains instead of Starts With 473 | defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false 474 | 475 | # Remove useless icons from Safari’s bookmarks bar 476 | defaults write com.apple.Safari ProxiesInBookmarksBar "()" 477 | 478 | # Enable the Develop menu and the Web Inspector in Safari 479 | defaults write com.apple.Safari IncludeDevelopMenu -bool true 480 | defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true 481 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true 482 | 483 | # Add a context menu item for showing the Web Inspector in web views 484 | defaults write NSGlobalDomain WebKitDeveloperExtras -bool true 485 | 486 | ############################################################################### 487 | # Mail # 488 | ############################################################################### 489 | 490 | # Disable send and reply animations in Mail.app 491 | defaults write com.apple.mail DisableReplyAnimations -bool true 492 | defaults write com.apple.mail DisableSendAnimations -bool true 493 | 494 | # Copy email addresses as `foo@example.com` instead of `Foo Bar ` in Mail.app 495 | defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false 496 | 497 | # Add the keyboard shortcut ⌘ + Enter to send an email in Mail.app 498 | defaults write com.apple.mail NSUserKeyEquivalents -dict-add "Send" -string "@\\U21a9" 499 | 500 | # Display emails in threaded mode, sorted by date (oldest at the top) 501 | defaults write com.apple.mail DraftsViewerAttributes -dict-add "DisplayInThreadedMode" -string "yes" 502 | defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortedDescending" -string "yes" 503 | defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortOrder" -string "received-date" 504 | 505 | # Disable inline attachments (just show the icons) 506 | defaults write com.apple.mail DisableInlineAttachmentViewing -bool true 507 | 508 | # Disable automatic spell checking 509 | defaults write com.apple.mail SpellCheckingBehavior -string "NoSpellCheckingEnabled" 510 | 511 | ############################################################################### 512 | # Spotlight # 513 | ############################################################################### 514 | 515 | # Hide Spotlight tray-icon (and subsequent helper) 516 | #sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search 517 | # Disable Spotlight indexing for any volume that gets mounted and has not yet 518 | # been indexed before. 519 | # Use `sudo mdutil -i off "/Volumes/foo"` to stop indexing any volume. 520 | sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Volumes" 521 | # Change indexing order and disable some file types 522 | defaults write com.apple.spotlight orderedItems -array \ 523 | '{"enabled" = 1;"name" = "APPLICATIONS";}' \ 524 | '{"enabled" = 1;"name" = "SYSTEM_PREFS";}' \ 525 | '{"enabled" = 1;"name" = "DIRECTORIES";}' \ 526 | '{"enabled" = 1;"name" = "PDF";}' \ 527 | '{"enabled" = 1;"name" = "FONTS";}' \ 528 | '{"enabled" = 0;"name" = "DOCUMENTS";}' \ 529 | '{"enabled" = 0;"name" = "MESSAGES";}' \ 530 | '{"enabled" = 0;"name" = "CONTACT";}' \ 531 | '{"enabled" = 0;"name" = "EVENT_TODO";}' \ 532 | '{"enabled" = 0;"name" = "IMAGES";}' \ 533 | '{"enabled" = 0;"name" = "BOOKMARKS";}' \ 534 | '{"enabled" = 0;"name" = "MUSIC";}' \ 535 | '{"enabled" = 0;"name" = "MOVIES";}' \ 536 | '{"enabled" = 0;"name" = "PRESENTATIONS";}' \ 537 | '{"enabled" = 0;"name" = "SPREADSHEETS";}' \ 538 | '{"enabled" = 0;"name" = "SOURCE";}' 539 | # Load new settings before rebuilding the index 540 | killall mds > /dev/null 2>&1 541 | # Make sure indexing is enabled for the main volume 542 | sudo mdutil -i on / > /dev/null 543 | # Rebuild the index from scratch 544 | sudo mdutil -E / > /dev/null 545 | 546 | ############################################################################### 547 | # Terminal & iTerm 2 # 548 | ############################################################################### 549 | 550 | # Only use UTF-8 in Terminal.app 551 | defaults write com.apple.terminal StringEncodings -array 4 552 | 553 | # Use a modified version of the Solarized Dark theme by default in Terminal.app 554 | # TERM_PROFILE='Solarized Dark xterm-256color'; 555 | # CURRENT_PROFILE="$(defaults read com.apple.terminal 'Default Window Settings')"; 556 | # if [ "${CURRENT_PROFILE}" != "${TERM_PROFILE}" ]; then 557 | # open "${HOME}/init/${TERM_PROFILE}.terminal"; 558 | # sleep 1; # Wait a bit to make sure the theme is loaded 559 | # defaults write com.apple.terminal 'Default Window Settings' -string "${TERM_PROFILE}"; 560 | # defaults write com.apple.terminal 'Startup Window Settings' -string "${TERM_PROFILE}"; 561 | # fi; 562 | 563 | # Enable “focus follows mouse” for Terminal.app and all X11 apps 564 | # i.e. hover over a window and start typing in it without clicking first 565 | #defaults write com.apple.terminal FocusFollowsMouse -bool true 566 | #defaults write org.x.X11 wm_ffm -bool true 567 | 568 | # Install the Solarized Dark theme for iTerm 569 | # open "${HOME}/init/Solarized Dark.itermcolors" 570 | 571 | # Don’t display the annoying prompt when quitting iTerm 572 | defaults write com.googlecode.iterm2 PromptOnQuit -bool false 573 | 574 | ############################################################################### 575 | # Time Machine # 576 | ############################################################################### 577 | 578 | # Prevent Time Machine from prompting to use new hard drives as backup volume 579 | defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true 580 | 581 | # Disable local Time Machine backups 582 | hash tmutil &> /dev/null && sudo tmutil disablelocal 583 | 584 | ############################################################################### 585 | # Activity Monitor # 586 | ############################################################################### 587 | 588 | # Show the main window when launching Activity Monitor 589 | defaults write com.apple.ActivityMonitor OpenMainWindow -bool true 590 | 591 | # Visualize CPU usage in the Activity Monitor Dock icon 592 | defaults write com.apple.ActivityMonitor IconType -int 5 593 | 594 | # Show all processes in Activity Monitor 595 | defaults write com.apple.ActivityMonitor ShowCategory -int 0 596 | 597 | # Sort Activity Monitor results by CPU usage 598 | defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage" 599 | defaults write com.apple.ActivityMonitor SortDirection -int 0 600 | 601 | ############################################################################### 602 | # Address Book, Dashboard, iCal, TextEdit, and Disk Utility # 603 | ############################################################################### 604 | 605 | # Enable the debug menu in Address Book 606 | defaults write com.apple.addressbook ABShowDebugMenu -bool true 607 | 608 | # Enable Dashboard dev mode (allows keeping widgets on the desktop) 609 | defaults write com.apple.dashboard devmode -bool true 610 | 611 | # Enable the debug menu in iCal (pre-10.8) 612 | defaults write com.apple.iCal IncludeDebugMenu -bool true 613 | 614 | # Use plain text mode for new TextEdit documents 615 | defaults write com.apple.TextEdit RichText -int 0 616 | # Open and save files as UTF-8 in TextEdit 617 | defaults write com.apple.TextEdit PlainTextEncoding -int 4 618 | defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4 619 | 620 | # Enable the debug menu in Disk Utility 621 | defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true 622 | defaults write com.apple.DiskUtility advanced-image-options -bool true 623 | 624 | ############################################################################### 625 | # Mac App Store # 626 | ############################################################################### 627 | 628 | # Enable the WebKit Developer Tools in the Mac App Store 629 | defaults write com.apple.appstore WebKitDeveloperExtras -bool true 630 | 631 | # Enable Debug Menu in the Mac App Store 632 | defaults write com.apple.appstore ShowDebugMenu -bool true 633 | 634 | ############################################################################### 635 | # Messages # 636 | ############################################################################### 637 | 638 | # Disable automatic emoji substitution (i.e. use plain text smileys) 639 | defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticEmojiSubstitutionEnablediMessage" -bool false 640 | 641 | # Disable smart quotes as it’s annoying for messages that contain code 642 | defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticQuoteSubstitutionEnabled" -bool false 643 | 644 | # Disable continuous spell checking 645 | defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "continuousSpellCheckingEnabled" -bool false 646 | 647 | ############################################################################### 648 | # Google Chrome & Google Chrome Canary # 649 | ############################################################################### 650 | 651 | # Allow installing user scripts via GitHub Gist or Userscripts.org 652 | defaults write com.google.Chrome ExtensionInstallSources -array "https://gist.githubusercontent.com/" "http://userscripts.org/*" 653 | defaults write com.google.Chrome.canary ExtensionInstallSources -array "https://gist.githubusercontent.com/" "http://userscripts.org/*" 654 | 655 | # Disable the all too sensitive backswipe 656 | defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false 657 | defaults write com.google.Chrome.canary AppleEnableSwipeNavigateWithScrolls -bool false 658 | 659 | # Use the system-native print preview dialog 660 | # defaults write com.google.Chrome DisablePrintPreview -bool true 661 | # defaults write com.google.Chrome.canary DisablePrintPreview -bool true 662 | 663 | ############################################################################### 664 | # GPGMail 2 # 665 | ############################################################################### 666 | 667 | # Disable signing emails by default 668 | # defaults write ~/Library/Preferences/org.gpgtools.gpgmail SignNewEmailsByDefault -bool false 669 | 670 | ############################################################################### 671 | # SizeUp.app # 672 | ############################################################################### 673 | 674 | # Start SizeUp at login 675 | # defaults write com.irradiatedsoftware.SizeUp StartAtLogin -bool true 676 | 677 | # Don’t show the preferences window on next start 678 | # defaults write com.irradiatedsoftware.SizeUp ShowPrefsOnNextStart -bool false 679 | 680 | ############################################################################### 681 | # Sublime Text # 682 | ############################################################################### 683 | 684 | # Install Sublime Text settings 685 | # cp -r init/Preferences.sublime-settings ~/Library/Application\ Support/Sublime\ Text*/Packages/User/Preferences.sublime-settings 2> /dev/null 686 | 687 | ############################################################################### 688 | # Transmission.app # 689 | ############################################################################### 690 | 691 | # Use `~/Documents/Torrents` to store incomplete downloads 692 | # defaults write org.m0k.transmission UseIncompleteDownloadFolder -bool true 693 | # defaults write org.m0k.transmission IncompleteDownloadFolder -string "${HOME}/Documents/Torrents" 694 | 695 | # Don’t prompt for confirmation before downloading 696 | # defaults write org.m0k.transmission DownloadAsk -bool false 697 | 698 | # Trash original torrent files 699 | # defaults write org.m0k.transmission DeleteOriginalTorrent -bool true 700 | 701 | # Hide the donate message 702 | # defaults write org.m0k.transmission WarningDonate -bool false 703 | # Hide the legal disclaimer 704 | # defaults write org.m0k.transmission WarningLegal -bool false 705 | 706 | ############################################################################### 707 | # Twitter.app # 708 | ############################################################################### 709 | 710 | # Disable smart quotes as it’s annoying for code tweets 711 | # defaults write com.twitter.twitter-mac AutomaticQuoteSubstitutionEnabled -bool false 712 | 713 | # Show the app window when clicking the menu bar icon 714 | # defaults write com.twitter.twitter-mac MenuItemBehavior -int 1 715 | 716 | # Enable the hidden ‘Develop’ menu 717 | # defaults write com.twitter.twitter-mac ShowDevelopMenu -bool true 718 | 719 | # Open links in the background 720 | # defaults write com.twitter.twitter-mac openLinksInBackground -bool true 721 | 722 | # Allow closing the ‘new tweet’ window by pressing `Esc` 723 | # defaults write com.twitter.twitter-mac ESCClosesComposeWindow -bool true 724 | 725 | # Show full names rather than Twitter handles 726 | # defaults write com.twitter.twitter-mac ShowFullNames -bool true 727 | 728 | # Hide the app in the background if it’s not the front-most window 729 | # defaults write com.twitter.twitter-mac HideInBackground -bool true 730 | 731 | ############################################################################### 732 | # Kill affected applications # 733 | ############################################################################### 734 | 735 | for app in "Activity Monitor" "Address Book" "Calendar" "Contacts" "cfprefsd" \ 736 | "Dock" "Finder" "Mail" "Messages" "Safari" "SizeUp" "SystemUIServer" \ 737 | "Terminal" "Transmission" "Twitter" "iCal"; do 738 | killall "${app}" > /dev/null 2>&1 739 | done 740 | echo "Done. Note that some of these changes require a logout/restart to take effect." 741 | -------------------------------------------------------------------------------- /examples/.screenrc: -------------------------------------------------------------------------------- 1 | # Copyright 1999-2005 Gentoo Foundation 2 | # Distributed under the terms of the GNU General Public License v2 3 | # 4 | # /etc/screenrc 5 | # 6 | # This is the system wide screenrc. 7 | # 8 | # You can use this file to change the default behavior of screen system wide 9 | # or copy it to ~/.screenrc and use it as a starting point for your own 10 | # settings. 11 | # 12 | # Commands in this file are used to set options, bind screen functions to 13 | # keys, redefine terminal capabilities, and to automatically establish one or 14 | # more windows at the beginning of your screen session. 15 | # 16 | # This is not a comprehensive list of options, look at the screen manual for 17 | # details on everything that you can put in this file. 18 | # 19 | # 20 | 21 | # ============================================================================== 22 | # SCREEN SETTINGS 23 | # ============================================================================== 24 | 25 | # ESCAPE - the COMMAND CHARACTER 26 | # =============================================================== 27 | # escape ^aa # default 28 | # escape ^pp # suggested binding for emacs users 29 | 30 | 31 | # PASSWORD 32 | # =============================================================== 33 | # This commands sets the *internal* password for the screen session. 34 | # WARNING!! If this is set then a "lock" command will only let you in to the 35 | # session after you enter the user's account password and then *also* 36 | # the internal password for that session. This gives additional safety but, 37 | # if you forget the internal password then you cannot resume your session. 38 | # Use :password to generate a password 39 | # password ODSJQf.4IJN7E # "1234" 40 | 41 | 42 | # VARIABLES 43 | # =============================================================== 44 | # No annoying audible bell, using "visual bell" 45 | vbell off # default: off 46 | # vbell_msg " -- Bell,Bell!! -- " # default: "Wuff,Wuff!!" 47 | 48 | # Automatically detach on hangup. 49 | autodetach on # default: on 50 | 51 | # Alternative screen 52 | altscreen on 53 | 54 | # Don't display the copyright page 55 | startup_message off # default: on 56 | 57 | # Uses nethack-style messages 58 | # nethack on # default: off 59 | 60 | # Affects the copying of text regions 61 | crlf off # default: off 62 | 63 | # Enable UTF-8 64 | defutf8 on 65 | 66 | # Enable/disable multiuser mode. Standard screen operation is singleuser. 67 | # In multiuser mode the commands acladd, aclchg, aclgrp and acldel can be used 68 | # to enable (and disable) other user accessing this screen session. 69 | # Requires suid-root. 70 | multiuser off 71 | 72 | # Change default scrollback value for new windows 73 | defscrollback 1000 # default: 100 74 | 75 | # Define the time that all windows monitored for silence should 76 | # wait before displaying a message. Default 30 seconds. 77 | silencewait 15 # default: 30 78 | 79 | # bufferfile: The file to use for commands 80 | # "readbuf" ('<') and "writebuf" ('>'): 81 | bufferfile $HOME/.screen_exchange 82 | # 83 | # hardcopydir: The directory which contains all hardcopies. 84 | # hardcopydir ~/.hardcopy 85 | # hardcopydir ~/.screen 86 | # 87 | # shell: Default process started in screen's windows. 88 | # Makes it possible to use a different shell inside screen 89 | # than is set as the default login shell. 90 | # If begins with a '-' character, the shell will be started as a login shell. 91 | # shell zsh 92 | # shell bash 93 | # shell ksh 94 | shell -$SHELL 95 | 96 | # shellaka '> |tcsh' 97 | shelltitle '$ |bash' 98 | 99 | # emulate .logout message 100 | pow_detach_msg "Screen session of \$LOGNAME \$:cr:\$:nl:ended." 101 | 102 | # caption always " %w --- %c:%s" 103 | # caption always "%3n %t%? @%u%?%? [%h]%?%=%c" 104 | 105 | # advertise hardstatus support to $TERMCAP 106 | # termcapinfo * '' 'hs:ts=\E_:fs=\E\\:ds=\E_\E\\' 107 | 108 | # set every new windows hardstatus line to somenthing descriptive 109 | # defhstatus "screen: ^En (^Et)" 110 | 111 | # don't kill window after the process died 112 | # zombie "^[" 113 | 114 | 115 | # XTERM TWEAKS 116 | # =============================================================== 117 | 118 | # xterm understands both im/ic and doesn't have a status line. 119 | # Note: Do not specify im and ic in the real termcap/info file as 120 | # some programs (e.g. vi) will not work anymore. 121 | termcap xterm hs@:cs=\E[%i%d;%dr:im=\E[4h:ei=\E[4l 122 | terminfo xterm hs@:cs=\E[%i%p1%d;%p2%dr:im=\E[4h:ei=\E[4l 123 | 124 | # 80/132 column switching must be enabled for ^AW to work 125 | # change init sequence to not switch width 126 | termcapinfo xterm Z0=\E[?3h:Z1=\E[?3l:is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l 127 | 128 | # Make the output buffer large for (fast) xterms. 129 | # termcapinfo xterm* OL=10000 130 | termcapinfo xterm* OL=100 131 | 132 | # tell screen that xterm can switch to dark background and has function 133 | # keys. 134 | termcapinfo xterm 'VR=\E[?5h:VN=\E[?5l' 135 | termcapinfo xterm 'k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~' 136 | termcapinfo xterm 'kh=\EOH:kI=\E[2~:kD=\E[3~:kH=\EOF:kP=\E[5~:kN=\E[6~' 137 | 138 | # special xterm hardstatus: use the window title. 139 | termcapinfo xterm 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007' 140 | 141 | #terminfo xterm 'vb=\E[?5h$<200/>\E[?5l' 142 | termcapinfo xterm 'vi=\E[?25l:ve=\E[34h\E[?25h:vs=\E[34l' 143 | 144 | # emulate part of the 'K' charset 145 | termcapinfo xterm 'XC=K%,%\E(B,[\304,\\\\\326,]\334,{\344,|\366,}\374,~\337' 146 | 147 | # xterm-52 tweaks: 148 | # - uses background color for delete operations 149 | termcapinfo xterm* be 150 | 151 | # Do not use xterm's alternative window buffer, it breaks scrollback (see bug #61195) 152 | termcapinfo xterm|xterms|xs ti@:te=\E[2J 153 | 154 | # WYSE TERMINALS 155 | # =============================================================== 156 | 157 | #wyse-75-42 must have flow control (xo = "terminal uses xon/xoff") 158 | #essential to have it here, as this is a slow terminal. 159 | termcapinfo wy75-42 xo:hs@ 160 | 161 | # New termcap sequences for cursor application mode. 162 | termcapinfo wy* CS=\E[?1h:CE=\E[?1l:vi=\E[?25l:ve=\E[?25h:VR=\E[?5h:VN=\E[?5l:cb=\E[1K:CD=\E[1J 163 | 164 | 165 | # OTHER TERMINALS 166 | # =============================================================== 167 | 168 | # make hp700 termcap/info better 169 | termcapinfo hp700 'Z0=\E[?3h:Z1=\E[?3l:hs:ts=\E[62"p\E[0$~\E[2$~\E[1$}:fs=\E[0}\E[61"p:ds=\E[62"p\E[1$~\E[61"p:ic@' 170 | 171 | # Extend the vt100 desciption by some sequences. 172 | termcap vt100* ms:AL=\E[%dL:DL=\E[%dM:UP=\E[%dA:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC 173 | terminfo vt100* ms:AL=\E[%p1%dL:DL=\E[%p1%dM:UP=\E[%p1%dA:DO=\E[%p1%dB:LE=\E[%p1%dD:RI=\E[%p1%dC 174 | termcapinfo linux C8 175 | # old rxvt versions also need this 176 | # termcapinfo rxvt C8 177 | 178 | 179 | # KEYBINDINGS 180 | # ============================================================== 181 | # The "bind" command assign keys to (internal) commands 182 | # SCREEN checks all the keys you type; you type the key 183 | # which is known as the "command character" then SCREEN 184 | # eats this key, too, and checks whether this key is 185 | # "bound" to a command. If so then SCREEN will execute it. 186 | # 187 | # The command "bind" allows you to chose which keys 188 | # will be assigned to the commands. 189 | # 190 | # Some commands are bound to several keys - 191 | # usually to both some letter and its corresponding 192 | # control key combination, eg the command 193 | # "(create) screen" is bound to both 'c' and '^C'. 194 | # 195 | # The following list shows the default bindings: 196 | # 197 | # break ^B b 198 | # clear C 199 | # colon : 200 | # copy ^[ [ 201 | # detach ^D d 202 | # digraph ^V 203 | # displays * 204 | # dumptermcap . 205 | # fit F 206 | # flow ^F f 207 | # focus ^I 208 | # hardcopy h 209 | # help ? 210 | # history { } 211 | # info i 212 | # kill K k 213 | # lastmsg ^M m 214 | # license , 215 | # log H 216 | # login L 217 | # meta x 218 | # monitor M 219 | # next ^@ ^N sp n 220 | # number N 221 | # only Q 222 | # other ^X 223 | # pow_break B 224 | # pow_detach D 225 | # prev ^H ^P p ^? 226 | # quit \ 227 | # readbuf < 228 | # redisplay ^L l 229 | # remove X 230 | # removebuf = 231 | # reset Z 232 | # screen ^C c 233 | # select " ' 234 | # silence _ 235 | # split S 236 | # suspend ^Z z 237 | # time ^T t 238 | # title A 239 | # vbell ^G 240 | # version v 241 | # width W 242 | # windows ^W w 243 | # wrap ^R r 244 | # writebuf > 245 | # xoff ^S s 246 | # xon ^Q q 247 | # ^] paste . 248 | # - select - 249 | # 0 select 0 250 | # 1 select 1 251 | # 2 select 2 252 | # 3 select 3 253 | # 4 select 4 254 | # 5 select 5 255 | # 6 select 6 256 | # 7 select 7 257 | # 8 select 8 258 | # 9 select 9 259 | # I login on 260 | # O login off 261 | # ] paste . 262 | # 263 | 264 | # And here are the default bind commands if you need them: 265 | # 266 | # bind A title 267 | # bind C clear 268 | # bind D pow_detach 269 | # bind F fit 270 | # bind H log 271 | # bind I login on 272 | # bind K kill 273 | # bind L login 274 | # bind M monitor 275 | # bind N number 276 | # bind O login off 277 | # bind Q only 278 | # bind S split 279 | # bind W width 280 | # bind X remove 281 | # bind Z reset 282 | 283 | # Let's remove some dangerous key bindings ... 284 | bind k 285 | bind ^k 286 | # bind . dumptermcap # default 287 | bind . 288 | # bind ^\ quit # default 289 | bind ^\ 290 | # bind \\ quit # default 291 | bind \\ 292 | # bind ^h ??? # default 293 | bind ^h 294 | # bind h hardcopy # default 295 | bind h 296 | 297 | # ... and make them better. 298 | bind 'K' kill 299 | bind 'I' login on 300 | bind 'O' login off 301 | bind '}' history 302 | 303 | # Yet another hack: 304 | # Prepend/append register [/] to the paste if ^a^] is pressed. 305 | # This lets me have autoindent mode in vi. 306 | # register [ "\033:se noai\015a" 307 | # register ] "\033:se ai\015a" 308 | bind ^] paste [.] 309 | 310 | 311 | # hardstatus alwaysignore 312 | # hardstatus alwayslastline "%Lw" 313 | 314 | # Resize the current region. The space will be removed from or added to 315 | # the region below or if there's not enough space from the region above. 316 | bind = resize = 317 | bind + resize +3 318 | bind - resize -3 319 | # bind _ resize max 320 | # 321 | # attrcolor u "-u b" 322 | # attrcolor b "R" 323 | 324 | # STARTUP SCREENS 325 | # =============================================================== 326 | # Defines the time screen delays a new message when one message 327 | # is currently displayed. The default is 1 second. 328 | # msgminwait 2 329 | 330 | # Time a message is displayed if screen is not disturbed by 331 | # other activity. The dafault is 5 seconds: 332 | # msgwait 2 333 | 334 | # Briefly show the version number of this starting 335 | # screen session - but only for *one* second: 336 | # msgwait 1 337 | # version 338 | 339 | # Welcome the user: 340 | # echo "welcome :-)" 341 | # echo "I love you today." 342 | 343 | # Uncomment one/some following lines to automatically let 344 | # SCREEN start some programs in the given window numbers: 345 | # screen -t MAIL 0 mutt 346 | # screen -t EDIT 1 vim 347 | # screen -t GOOGLE 2 links http://www.google.com 348 | # screen -t NEWS 3 slrn 349 | # screen -t WWW 4 links http://www.math.fu-berlin.de/~guckes/ 350 | # screen 5 351 | # screen 6 352 | 353 | # Set the environment variable var to value string. If only var is specified, 354 | # you'll be prompted to enter a value. If no parameters are specified, 355 | # you'll be prompted for both variable and value. The environment is 356 | # inherited by all subsequently forked shells. 357 | 358 | # Don't you want to start programs which need a DISPLAY ? 359 | # setenv DISPLAY '' 360 | 361 | #change the hardstatus settings to give an window list at the bottom of the 362 | #screen, with the time and date and with the current window highlighted 363 | hardstatus alwayslastline 364 | #hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]' 365 | 366 | hardstatus string '%{= kw}%{c}[%H]%{w} %?%-Lw%?%{r}(%{W}%n-%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{c}%D %Y-%m-%d %0c' 367 | -------------------------------------------------------------------------------- /examples/.ssh/authorized_keys: -------------------------------------------------------------------------------- 1 | ssh-rsa INVALID EXAMPLE 2 | -------------------------------------------------------------------------------- /examples/.ssh/config: -------------------------------------------------------------------------------- 1 | ForwardAgent yes 2 | PermitLocalCommand yes 3 | ServerAliveInterval 20 4 | 5 | Host example 6 | HostName 127.0.0.1 7 | User me 8 | -------------------------------------------------------------------------------- /examples/.tmux.conf: -------------------------------------------------------------------------------- 1 | 2 | # 10_bindings 3 | # act like GNU screen 4 | unbind C-b 5 | set -g prefix C-a 6 | bind-key C-a last-window 7 | bind-key a send-prefix 8 | 9 | # Reload key 10 | bind r source-file ~/.tmux.conf 11 | 12 | set-window-option -g mode-keys vi 13 | set-option -g mouse on 14 | 15 | # 10_shell.sh 16 | set-option -g default-shell /usr/local/bin/zsh 17 | set-option -g default-command "reattach-to-user-namespace -l /usr/local/bin/zsh" 18 | 19 | # 10_terminal.sh 20 | set -g default-terminal "screen-256color" 21 | 22 | # 15_window_order 23 | # start window numbers at 1 to match keyboard order with tmux window order 24 | set -g base-index 1 25 | set-window-option -g pane-base-index 1 26 | # renumber windows sequentially after closing any of them 27 | set -g renumber-windows on 28 | 29 | # 20_pbcopy.sh 30 | bind y run-shell "reattach-to-user-namespace -l zsh -c 'tmux show-buffer | pbcopy'" 31 | 32 | # 50_envvars 33 | # http://superuser.com/questions/237822/how-can-i-get-ssh-agent-working-over-ssh-and-in-tmux-on-os-x 34 | set -g update-environment "SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION" 35 | 36 | # 50_theme 37 | set -g status-bg colour234 38 | set -g status-fg colour248 39 | set -g status-interval 3 40 | set -g status-left-length 30 41 | set -wg window-status-format ' #I-#W ' 42 | set -wg window-status-current-format '#[fg=white][#[default]#I-#W#[fg=white]]#[default]' 43 | set -g status-right-length 50 44 | 45 | # 90_other 46 | set-option -g history-limit 4096 47 | set -g visual-bell off 48 | 49 | set -g status-left '#[fg=colour32]#(whoami)@#H#[default]' 50 | set -g status-right '#[fg=red]#(osx-cpu-temp) #[fg=cyan]#(battery-status.sh 10) #[fg=yellow]#(uptime | grep -oE "[0-9\., ]+$" | tr -d ",") #[fg=white]%H:%M:%S#[default]' 51 | -------------------------------------------------------------------------------- /examples/.vimrc: -------------------------------------------------------------------------------- 1 | syntax on 2 | runtime mswin.vim 3 | filetype plugin on 4 | au filetype * setl nowrap 5 | au filetype * let b:did_indent = 1 6 | au filetype ruby setl sw=2 sts=2 ts=2 7 | 8 | " IMPORTANT: grep will sometimes skip displaying the file name if you 9 | " search in a singe file. This will confuse Latex-Suite. Set your grep 10 | " program to always generate a file-name. 11 | set grepprg=grep\ -nH\ $* 12 | 13 | " OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to 14 | " 'plaintex' instead of 'tex', which results in vim-latex not being loaded. 15 | " The following changes the default filetype back to 'tex': 16 | let g:tex_flavor='latex' 17 | 18 | set wildmenu 19 | set cpo-=< 20 | set wcm= 21 | map :emenu 22 | map "=strftime("%c")P 23 | 24 | set autoindent 25 | set autoread 26 | set autowriteall 27 | set backspace=2 28 | set complete-=t 29 | set clipboard=unnamed 30 | set expandtab 31 | set guioptions=c 32 | set hidden 33 | set history=100 34 | set incsearch 35 | set linebreak 36 | set mouse=a 37 | set nobackup 38 | set nostartofline 39 | set noswapfile 40 | set wrap 41 | set ruler 42 | set shiftwidth=2 43 | set showmode 44 | set softtabstop=2 45 | set tabstop=2 46 | set undolevels=100 47 | set mouse-=a 48 | set modeline 49 | set background=dark 50 | set nobomb 51 | 52 | if has("multi_byte") 53 | if &termencoding == "" 54 | let &termencoding = &encoding 55 | endif 56 | set encoding=utf-8 57 | setglobal fileencoding=utf-8 nobomb 58 | set fileencodings=ucs-bom,utf-8,latin1 59 | endif 60 | 61 | function! CleverTab() 62 | if strpart(getline('.'), col('.') - 2 , 1) =~ '\w' | return "\" | else | return "\" 63 | endfunction 64 | inoremap =CleverTab() 65 | 66 | let g:user_zen_settings = { 67 | \ 'indentation' : ' ', 68 | \} 69 | let g:user_zen_expandabbr_key = '' 70 | let g:use_zen_complete_tag = 1 71 | 72 | "set ofu=syntaxcomplete#Complete 73 | "set cindent 74 | "set smartindent 75 | "set autoindent 76 | "set expandtab 77 | "set tabstop=2 78 | "set shiftwidth=2 79 | -------------------------------------------------------------------------------- /examples/.wgetrc: -------------------------------------------------------------------------------- 1 | # Use the server-provided last modification date, if available 2 | timestamping = on 3 | 4 | # Do not go up in the directory structure when downloading recursively 5 | no_parent = on 6 | 7 | # Wait 60 seconds before timing out. This applies to all timeouts: DNS, connect and read. (The default read timeout is 15 minutes!) 8 | timeout = 60 9 | 10 | # Retry a few times when a download fails, but don’t overdo it. (The default is 20!) 11 | tries = 3 12 | 13 | # Retry even when the connection was refused 14 | retry_connrefused = on 15 | 16 | # Use the last component of a redirection URL for the local file name 17 | trust_server_names = on 18 | 19 | # Follow FTP links from HTML documents by default 20 | follow_ftp = on 21 | 22 | # 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 23 | adjust_extension = on 24 | 25 | # Use UTF-8 as the default system encoding 26 | # Disabled as it makes `wget` builds that don’t support this feature unusable. 27 | # Does anyone know how to conditionally configure a wget setting? 28 | # http://unix.stackexchange.com/q/34730/6040 29 | #local_encoding = UTF-8 30 | 31 | # Ignore `robots.txt` and `` 32 | robots = off 33 | 34 | # Print the HTTP and FTP server responses 35 | server_response = on 36 | 37 | # Disguise as IE 9 on Windows 7 38 | user_agent = Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0) 39 | -------------------------------------------------------------------------------- /examples/.zer0prompt.conf: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ####################### [USER CONFIGURATION] ####################### 4 | # You can change various settings for zer0prompt below! 5 | 6 | 7 | ### set zer0prompt colour theme ### 8 | # options -- cyan, blue, green, red, purple, yellow, black, white, none 9 | zpcl="cyan" 10 | 11 | 12 | ### set colour theme inverse mode ### 13 | # set to 1 to inverse colour theme 14 | zpcl_inverse="0" 15 | 16 | 17 | ### set colours for various info ### 18 | # colour reference at http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html 19 | zi1="\[\033[1;32m\]" # user@host:tty 20 | zi2="\[\033[1;35m\]" # current path 21 | zi3="\[\033[1;33m\]" # time 22 | zi4="\[\033[1;31m\]" # exit status 23 | zi5="\[\033[1;32m\]" # user identifier ($ or #) 24 | 25 | 26 | ### set time format ### 27 | # uncomment the one you want or make your own 28 | # formatting reference and examples at http://www.foragoodstrftime.com/ 29 | # ztime="%I:%M %P" # 12 hour, am/pm lowercase 30 | #ztime="%I:%M %p" # 12 hour, AM/PM uppercase 31 | #ztime="%I:%M:%S %P" # 12 hour, am/pm lowercase, with seconds 32 | #ztime="%I:%M:%S %p" # 12 hour, AM/PM uppercase, with seconds 33 | #ztime="%H:%M" # 24 hour 34 | ztime="%H:%M:%S" # 24 hour, with seconds 35 | #ztime="%F %I:%M %P" # complete date with 12 hour, am/pm lowercase 36 | #ztime="%a %b-%d %I:%M %P" # day with 12 hour, am/pm lowercase 37 | 38 | 39 | ### override line graphics ### 40 | # set to 1 to force line graphics into fallback mode 41 | zgfx_override="0" 42 | -------------------------------------------------------------------------------- /examples/.zer0prompt.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ############################ [MAIN CODE] ############################ 4 | # DO NOT alter below this line unless you know what you are doing! 5 | # user configuration options are found in zer0prompt.conf 6 | 7 | # grab user config files via import 8 | source ~/.zer0prompt.conf 9 | 10 | # use bash builtin checkwinsize option for terminals which fail to properly 11 | # set the $COLUMNS variable. (bug workaround) 12 | shopt -s checkwinsize 13 | 14 | # set line graphics to use based on locale 15 | if [ "$zgfx_override" = "1" ]; then 16 | zg1="-"; zg2="r"; zg3="L"; zg4="|"; zg5="|"; zg6=">" # fallback GFX (forced) 17 | elif [ $(locale charmap) = "UTF-8" ]; then 18 | zg1="─"; zg2="┌"; zg3="└"; zg4="┤"; zg5="├"; zg6=">" # better GFX 19 | else 20 | zg1="-"; zg2="r"; zg3="L"; zg4="|"; zg5="|"; zg6=">" # fallback GFX 21 | fi 22 | 23 | # set inverse mode if set 24 | if [ "$zpcl_inverse" = "1" ]; then 25 | zci="\[\033[7m\]" #inverse 26 | else 27 | zci="" 28 | fi 29 | 30 | # set user info same colour as user selected host info colour 31 | zi0=$zi1 32 | 33 | # if root user then colour user info and user identifier red. 34 | [ "${UID}" = 0 ] && zi0="\[\033[1;31m\]" && zi5="\[\033[1;31m\]" 35 | 36 | # this function is run at every prompt update, keeping our variables updated. 37 | # bash's PROMPT_COMMAND option handles this (see end of this function). 38 | function pre_prompt { 39 | # show exit code of last failed command 40 | ZEXIT="${?}" 41 | [ "$ZEXIT" = "0" ] && ZEXIT="" 42 | 43 | ZPWD=${PWD/#$HOME/\~} # sorten home dir to ~ 44 | 45 | # set length of our important info 46 | local infolength="$(whoami)@$(hostname):$(basename $(tty))$ZPWD" 47 | # set length of our graphics 48 | local gfxlength=23 49 | 50 | # construct ZFILL size to fill terminal width (minus info/gfx lengths). 51 | local fillsize 52 | let fillsize=${COLUMNS}-${gfxlength}-${#infolength} 53 | ZFILL="" 54 | while [ "$fillsize" -gt "0" ]; do 55 | ZFILL="$ZFILL$zg1" 56 | let fillsize=${fillsize}-1 57 | done 58 | 59 | # determine how much to truncate ZPWD, if ZFILL can't shrink anymore. 60 | if [ "$fillsize" -lt "0" ]; then 61 | local cut=3-${fillsize} # some tricky math, 3-(-number)=+number 62 | ZPWD="...${ZPWD:${cut}}" 63 | fi 64 | } 65 | PROMPT_COMMAND=pre_prompt 66 | 67 | # this function tells bash how to draw our prompt 68 | function zer0prompt { 69 | local zc0="\[\033[0m\]" # clear all colors 70 | local zc1="\[\033[1;37m\]" 71 | local zc2="\[\033[0;37m\]" 72 | 73 | # set colour theme 74 | if [ "$zpcl" = "cyan" ]; then 75 | local zc3="\[\033[1;36m\]"; local zc4="\[\033[0;36m\]" 76 | elif [ "$zpcl" = "blue" ]; then 77 | local zc3="\[\033[1;34m\]"; local zc4="\[\033[0;34m\]" 78 | elif [ "$zpcl" = "green" ]; then 79 | local zc3="\[\033[1;32m\]"; local zc4="\[\033[0;32m\]" 80 | elif [ "$zpcl" = "red" ]; then 81 | local zc3="\[\033[1;31m\]"; local zc4="\[\033[0;31m\]" 82 | elif [ "$zpcl" = "purple" ]; then 83 | local zc3="\[\033[1;35m\]"; local zc4="\[\033[0;35m\]" 84 | elif [ "$zpcl" = "yellow" ]; then 85 | local zc3="\[\033[1;33m\]"; local zc4="\[\033[0;33m\]" 86 | elif [ "$zpcl" = "black" ]; then 87 | local zc3="\[\033[1;30m\]"; local zc4="\[\033[0;30m\]" 88 | elif [ "$zpcl" = "white" ]; then 89 | local zc3="\[\033[1;37m\]"; local zc4="\[\033[0;37m\]" 90 | else # none (no colour) 91 | local zc3=""; local zc4=""; local zc1=""; local zc2="" 92 | zi0=""; zi1=""; zi2=""; zi3=""; zi4=""; zi5="" 93 | fi 94 | 95 | # set titlebar info if xterm/rxvt 96 | case $TERM in 97 | xterm*|rxvt*) 98 | local TITLEBAR='\[\033]0;\u (\w) [${COLUMNS}x${LINES}]\007\]';; 99 | *) 100 | local TITLEBAR="";; 101 | esac 102 | 103 | # standard prompt 104 | PS1="${TITLEBAR}\ 105 | $zc1$zci$zg2$zg1$zc3$zg1$zc4$zci$zg1$zg4$zi0\u$zi1@\h:\l$zc4$zci$zg5$zg1$zc2$zci$zg1$zg1$zc4$zci\ 106 | \$ZFILL$zc3$zg1$zg1$zg1$zg1$zc1$zg1$zg1$zg1$zc3$zg1$zg1$zc4$zci$zg1$zg4$zi2\ 107 | \$ZPWD$zc4$zci$zg5$zg1$zc2$zci$zg1 108 | $zc3$zg3$zc4$zci$zg1$zg4$zi3\D{$ztime}$zci $zi5\\\$$zc4$zci$zg5$zi4\ 109 | \$ZEXIT$zc2$zci$zg1$zc3$zg6$zc0 " 110 | 111 | # continuation prompt 112 | PS2="$zc3$zci$zg3$zc4$zci$zg1$zg4$zi5\\\$$zc4$zci$zg5$zc2$zci$zg1$zc3$zg6$zc0 " 113 | } -------------------------------------------------------------------------------- /examples/.zshrc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | # 00_PS1_guard.sh 4 | [ -z "$PS1" ] && return 5 | 6 | # 05_tmux.sh 7 | export ZSH_TMUX_AUTOSTART=true 8 | if [ -n "$TMUX" ]; then 9 | tmup () 10 | { 11 | echo -n "Updating to latest tmux environment..."; 12 | export IFS=","; 13 | for line in $(tmux showenv -t $(tmux display -p "#S") | tr "\n" ","); 14 | do 15 | if [[ $line == -* ]]; then 16 | unset $(echo $line | cut -c2-); 17 | else 18 | export $line; 19 | fi; 20 | done; 21 | unset IFS; 22 | echo "Done" 23 | } 24 | fi 25 | 26 | # 05_zsh_tmux.sh 27 | export ZSH_TMUX_AUTOSTART=true 28 | 29 | # 10_locale.sh 30 | export LANG='en_US.UTF-8' 31 | export LANGUAGE='en_US.UTF-8' 32 | export LC_ALL='en_US.UTF-8' 33 | export LESSCHARSET='UTF-8' 34 | 35 | # zsh/20_paths.sh 36 | path=( 37 | "/Users/lavoie_sl/bin" 38 | "/usr/X11/bin" 39 | "/usr/local/sbin" 40 | "/usr/local/bin" 41 | "/usr/sbin" 42 | "/usr/bin" 43 | "/sbin" 44 | "/bin" 45 | ) 46 | 47 | # 20_variables.sh 48 | export EDITOR=subl 49 | export HOMEBREW_GITHUB_API_TOKEN=INVALID 50 | export HOMEBREW_TEMP=/usr/local/tmp 51 | export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home 52 | 53 | # 30_grep_aliases.sh 54 | alias grep='grep --color=auto' 55 | alias egrep='egrep --color=auto' 56 | alias fgrep='fgrep --color=auto' 57 | 58 | # 30_rvm.sh 59 | source "/Users/lavoie_sl/.rvm/scripts/rvm" 60 | 61 | # 30_ssh_settitle.sh 62 | 63 | if [ -n "$TMUX" ]; then 64 | settitle() { 65 | printf "\033k$1\033\\" 66 | } 67 | 68 | ssh() { 69 | settitle "$(echo $* | head -c 20)" 70 | command ssh "$@" 71 | settitle "zsh" 72 | } 73 | fi 74 | 75 | # 50_aliases.sh 76 | alias cacl="find app/logs -name '*.log' -delete && app/console ca:cl --no-warmup" 77 | alias g="git" 78 | alias git-root="cd \"\$(git root)\"" 79 | alias rrm="rm -Rf" 80 | alias vihosts="sudo vi /etc/hosts" 81 | 82 | # zsh/90_zsh_options.sh 83 | unsetopt correct 84 | unsetopt correct_all 85 | setopt APPEND_HISTORY 86 | unsetopt SHARE_HISTORY 87 | setopt HIST_IGNORE_ALL_DUPS 88 | setopt HIST_REDUCE_BLANKS 89 | 90 | # 95_cd.sh 91 | cd 92 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Install path defaults to $HOME 4 | # Usage: install.sh [path] 5 | 6 | export DOTFILES_INSTALL_PATH="${1:-$HOME}" 7 | 8 | export DOTFILES_DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 9 | 10 | . "${DOTFILES_DIR}/configure.sh" 11 | 12 | # If file: copy 13 | # If directory: 14 | # If directory/_generate.sh exists: output to file named like directory 15 | # else: recurse, creating directories 16 | function recursive_install() { 17 | local dest_dir="${1}" 18 | local source_dir="${2}" 19 | local sub_dir="${3}" 20 | 21 | [ -d "${dest_dir}${sub_dir}" ] || mkdir -p "${dest_dir}${sub_dir}" 22 | cd "${source_dir}${sub_dir}" 23 | 24 | for file in `ls -1A`; do 25 | local dest_file="${dest_dir}${sub_dir}/${file}" 26 | local source_file="${source_dir}${sub_dir}/${file}" 27 | 28 | echo "${dest_file/$HOME/~}" >&2 29 | 30 | if [[ -d "${source_file}" ]]; then 31 | if [[ -f "${source_file}/_generate.sh" ]]; then 32 | content="$(. "${source_file}/_generate.sh")" 33 | [ -n "${content}" ] && echo "${content}" > "${dest_file}" 34 | else 35 | recursive_install "${dest_dir}" "${source_dir}" "${sub_dir}/${file}" 36 | fi 37 | else 38 | cp -p "${source_file}" "${dest_file}" 39 | fi 40 | done 41 | } 42 | 43 | 44 | recursive_install "${DOTFILES_INSTALL_PATH}" "${DOTFILES_DIR}/dotfiles" 45 | -------------------------------------------------------------------------------- /lib.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## 4 | # Determine if a program is in path, without any output. 5 | # 6 | # @uses which 7 | # @param string executable name 8 | # @returns success code 9 | # 10 | function program_exists() { 11 | local program="$1" 12 | 13 | [ -n "${program}" ] && which "${program}" >/dev/null 14 | } 15 | 16 | ## 17 | # Determine if a mac Application exists 18 | # 19 | # @uses program_exists 20 | # @uses mdfind 21 | # @param string bundle name 22 | # @returns success code 23 | # 24 | function mac_app_exists() { 25 | local bundle="$1" 26 | 27 | program_exists "mdfind" && [ -n "$(mdfind "kMDItemCFBundleIdentifier == '${bundle}'")" ] 28 | } 29 | 30 | ## 31 | # Determine if a brew is installed. 32 | # 33 | # @uses brew 34 | # @param string brew name 35 | # @returns success code 36 | # 37 | function brew_installed() { 38 | local brew="${1}" 39 | 40 | brew list -1 | grep -q "^${brew}$" 41 | } 42 | 43 | ## 44 | # Convert to fully qualified path, expanding ../, symlinks, etc. 45 | # Readlink of Mac is deficient, use ruby instead. 46 | # 47 | # @uses ruby 48 | # @param string any path (can be . and such) 49 | # @outputs absolute path 50 | # 51 | function realpath() { 52 | local path="$1" 53 | 54 | echo "require 'pathname'; puts Pathname.new('${path}').realpath" | ruby 2>/dev/null 55 | } 56 | 57 | ## 58 | # Prompt the user with a question, supporting default value 59 | # 60 | # @uses read 61 | # @param string question 62 | # @param string optional default value 63 | # @outputs answer or default value 64 | # 65 | function prompt_value() { 66 | local prompt="${1} " 67 | local default="${2}" 68 | 69 | [[ -n "${default}" ]] && prompt="${prompt}(${default}) " 70 | 71 | read -p "${prompt}" reply 72 | 73 | [[ -z "${reply}" ]] && reply="${default}" 74 | 75 | if [[ -z "${reply}" ]]; then 76 | prompt_value "${1}" "${2}" 77 | else 78 | echo "${reply}" 79 | fi 80 | } 81 | 82 | ## 83 | # Prompt the user to confirm, default is yes 84 | # 85 | # @uses read 86 | # @param string question 87 | # @returns 0 if yes, 1 if no 88 | # 89 | function confirm() { 90 | local prompt="${1}" 91 | 92 | read -p "${prompt} (Y/n) " reply 93 | 94 | [[ "${reply}" != "n" ]] 95 | } 96 | 97 | function get_config_var() { 98 | local var_name="${1}" 99 | local config_dir="${DOTFILES_CONFIG_DIR}/vars" 100 | local file="${config_dir}/${var_name}" 101 | 102 | if [[ -s "${file}" ]]; then 103 | cat "${file}" 104 | fi 105 | } 106 | 107 | function set_config_var() { 108 | local var_name="${1}" 109 | local value="${2}" 110 | local config_dir="${DOTFILES_CONFIG_DIR}/vars" 111 | local file="${config_dir}/${var_name}" 112 | 113 | [[ -d "${config_dir}" ]] || mkdir -p "${config_dir}" 114 | 115 | echo "${value}" > "${file}" 116 | } 117 | 118 | function ensure_config_var() { 119 | local var="${1}" 120 | local message="${2:-$var}" 121 | local default="${3:-}" 122 | 123 | value="$(get_config_var "${var}")" 124 | 125 | if [[ -z "${value}" ]]; then 126 | value="$(prompt_value "${message}" "${default}")" 127 | set_config_var "${var}" "${value}" 128 | fi 129 | } 130 | 131 | ## 132 | # Escape custom characters in a string 133 | # WARNING: if \ is escaped, it must be the first 134 | # Example: escape "ab'\c" '\' "'" ===> ab\'\\c 135 | # 136 | # @param string The string to be escaped 137 | # @param char* All the characters to espace, multiple chars are specified as multiple params. 138 | # @outputs Escaped string 139 | # 140 | function escape_chars() { 141 | local content="${1}" 142 | shift 143 | 144 | for char in $@; do 145 | if [ "${char}" = '$' -o "${char}" = '\' ]; then 146 | char="\\${char}" 147 | fi 148 | content="$(echo "${content}" | sed -e "s/${char}/\\\\${char}/g")" 149 | done 150 | 151 | echo "${content}" 152 | } 153 | 154 | ## 155 | # Wrap a string with single quotes 156 | # Single quotes inside it will be escaped properly 157 | # 158 | function wrap_single_quote() { 159 | local content="${1}" 160 | 161 | echo "'$(echo "${content}" | sed "s/'/'\"'\"'/g")'" 162 | } 163 | 164 | function echo_export_single_quote() { 165 | local var="${1}" 166 | local content="${2}" 167 | local quoted="$(wrap_single_quote "${content}")" 168 | 169 | echo "export ${var}=${quoted}" 170 | } 171 | 172 | function echo_export_double_quote() { 173 | local var="${1}" 174 | local content="${2}" 175 | local escaped="$(escape_chars '\' '"')" 176 | 177 | echo "export ${var}=\"${escaped}\"" 178 | } 179 | 180 | ## 181 | # Sort all files by their filename, independently of their folder 182 | # Example: ls -1 /a/* /b/* | sort_by_filename 183 | # 184 | # @input One path per line 185 | # @outputs One path per line 186 | function sort_by_filename() { 187 | while read filename; do 188 | echo "${filename}" | sed -E 's/^(.+)\/([^/]+)$/\2#\1\/\2/'; 189 | done | sort -n | cut -d '#' -f 2 190 | } 191 | 192 | ## 193 | # Get files, sorted by filename, of all folders 194 | # 195 | # @param string folder* 196 | # @output One path per line 197 | function get_sorted_files() { 198 | local files="" 199 | 200 | for folder in $@; do 201 | if [[ -d "${folder}" ]]; then 202 | files="${files} 203 | $(ls -1 ${folder}/*)" 204 | fi 205 | done 206 | 207 | echo "${files}" | sort_by_filename 208 | } 209 | 210 | ## 211 | # cat a file. If it ends with .sh, execute it instead 212 | # 213 | # @param string file path 214 | # @outputs content 215 | # 216 | function cat_or_exec() { 217 | local file="${1}" 218 | 219 | if echo "${file}" | grep -q '\.sh$'; then 220 | . "${file}" 221 | else 222 | cat "${file}" 223 | fi 224 | } 225 | 226 | 227 | ## 228 | # Check if directory contains executable files 229 | # 230 | # @link http://stackoverflow.com/questions/4458120/unix-find-search-for-executable-files 231 | # @uses find 232 | # @returns 0 if contains, 1 if empty 233 | # 234 | function dir_has_executables() { 235 | local dir="${1}" 236 | 237 | [ -n "$(find -L "${dir}" -mindepth 1 -maxdepth 1 -perm -a=x -type f)" ] 238 | } 239 | 240 | ## 241 | # Print all passed arguments in reverse 242 | # 243 | # @param string* All the arguments to be printed 244 | # @outputs One argument per line 245 | # 246 | function reverse_args() { 247 | local items=($@) 248 | 249 | for (( idx=${#items[@]}-1 ; idx>=0 ; idx-- )) ; do 250 | echo "${items[idx]}" 251 | done 252 | } 253 | 254 | -------------------------------------------------------------------------------- /paths/20_home_bin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "$HOME/bin" 4 | -------------------------------------------------------------------------------- /paths/25_brew.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if program_exists brew; then 4 | echo "$(brew --prefix)/bin" 5 | fi 6 | -------------------------------------------------------------------------------- /paths/30_amazon_ec2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | [ -n "${EC2_HOME}"] && echo "$EC2_HOME/bin" 4 | -------------------------------------------------------------------------------- /paths/30_npm: -------------------------------------------------------------------------------- 1 | /usr/local/share/npm/bin 2 | -------------------------------------------------------------------------------- /paths/30_rubymine: -------------------------------------------------------------------------------- 1 | /Applications/RubyMine.app/Contents/MacOS 2 | -------------------------------------------------------------------------------- /paths/30_rvm: -------------------------------------------------------------------------------- 1 | /usr/local/rvm/bin 2 | -------------------------------------------------------------------------------- /paths/40_games: -------------------------------------------------------------------------------- 1 | /usr/games 2 | -------------------------------------------------------------------------------- /paths/40_x11: -------------------------------------------------------------------------------- 1 | /usr/X11/bin 2 | -------------------------------------------------------------------------------- /rc/00_PS1_guard.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # If not running interactively, don't do anything 4 | echo '[ -z "$PS1" ] && return' 5 | -------------------------------------------------------------------------------- /rc/05_tmux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if program_exists tmux; then 4 | echo 'if [ -n "$TMUX" ]; then 5 | tmup () 6 | { 7 | echo -n "Updating to latest tmux environment..."; 8 | export IFS=","; 9 | for line in $(tmux showenv -t $(tmux display -p "#S") | tr "\n" ","); 10 | do 11 | if [[ $line == -* ]]; then 12 | unset $(echo $line | cut -c2-); 13 | else 14 | export $line; 15 | fi; 16 | done; 17 | unset IFS; 18 | echo "Done" 19 | } 20 | fi' 21 | fi 22 | -------------------------------------------------------------------------------- /rc/10_locale.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | locales="$(locale -a)" 4 | 5 | language=en 6 | country=US 7 | charset="UTF-?8" 8 | 9 | locale=$(locale -a | sort -r | grep -iE "${language}(_${country}(\.${charset})?)?$" | head -n1) 10 | 11 | if [[ -z "${locale}" ]]; then 12 | locale=C 13 | fi 14 | 15 | for var in LANG LANGUAGE LC_ALL; do 16 | echo_export_single_quote "${var}" "${locale}" 17 | done 18 | 19 | if [[ "${locale}" =~ UTF-?8 ]]; then 20 | echo_export_single_quote LESSCHARSET 'UTF-8' 21 | fi 22 | -------------------------------------------------------------------------------- /rc/20_boot2docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if program_exists boot2docker; then 4 | boot2docker shellinit 5 | fi 6 | -------------------------------------------------------------------------------- /rc/20_variables.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | var_dir="${DOTFILES_DIR}/variables" 4 | config_dir="${DOTFILES_CONFIG_DIR}/vars" 5 | 6 | if [[ -d "${config_dir}" ]]; then 7 | for file in "${config_dir}"/*; do 8 | var_name="$(basename "${file}")" 9 | content="$(get_config_var "${var_name}")" 10 | if [[ -n "${content}" ]]; then 11 | conf_var="_DOTFILES_VAR_${var_name}" 12 | declare "${conf_var}=${content}" 13 | fi 14 | done 15 | fi 16 | 17 | if [ -d "${var_dir}" ]; then 18 | cd "${var_dir}" 19 | 20 | for file in $(ls -1 ./*.sh); do 21 | var_name="$(basename -s .sh "${file}")" 22 | conf_var="_DOTFILES_VAR_${var_name}" 23 | 24 | if [[ -z "${!conf_var}" ]]; then 25 | content="$(. "${file}")" 26 | 27 | if [[ -n "${content}" ]]; then 28 | declare "${conf_var}=${content}" 29 | fi 30 | fi 31 | done 32 | 33 | 34 | for folder in $(ls -1d ./*.d); do 35 | var_name="$(basename -s .d "${folder}")" 36 | conf_var="_DOTFILES_VAR_${var_name}" 37 | 38 | if [[ -z "${!conf_var}" ]]; then 39 | for file in $(ls -1 $folder/*.sh); do 40 | content="$(. "${file}")" 41 | 42 | if [[ -n "${content}" ]]; then 43 | declare "${conf_var}=${content}" 44 | break 45 | fi 46 | done 47 | fi 48 | done 49 | fi 50 | 51 | ( set -o posix ; set ) | grep '^_DOTFILES_VAR_' | sed -e 's/^_DOTFILES_VAR_//' -e 's/^/export /' 52 | -------------------------------------------------------------------------------- /rc/30_dircolors.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # enable color support of ls and also add handy aliases 4 | if program_exists dircolors && program_exists tput && tput colors >/dev/null; then 5 | 6 | if [[ -r ~/.dircolors ]]; then 7 | dircolors -b ~/.dircolors 8 | else 9 | dircolors -b 10 | fi 11 | fi 12 | -------------------------------------------------------------------------------- /rc/30_grep_aliases.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if program_exists tput && tput colors >/dev/null; then 4 | for color_prog in grep egrep fgrep; do 5 | if program_exists $color_prog; then 6 | echo "alias $color_prog='$color_prog --color=auto'" 7 | fi 8 | done 9 | fi 10 | -------------------------------------------------------------------------------- /rc/30_php_version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if program_exists brew && brew_installed php-version && [ -f "$(brew --prefix php-version)/php-version.sh" ]; then 4 | echo "source '$(brew --prefix php-version)/php-version.sh' && php-version 5" 5 | fi 6 | -------------------------------------------------------------------------------- /rc/30_rvm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | [[ -s "$HOME/.rvm/scripts/rvm" ]] && echo "source \"$HOME/.rvm/scripts/rvm\"" 4 | -------------------------------------------------------------------------------- /rc/30_scm_breeze.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -s "$HOME/.scm_breeze/scm_breeze.sh" ]; then 4 | echo "source '$HOME/.scm_breeze/scm_breeze.sh'" 5 | fi -------------------------------------------------------------------------------- /rc/30_ssh_settitle.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo ' 4 | if [ -n "$TMUX" ]; then 5 | settitle() { 6 | printf "\033k$1\033\\" 7 | } 8 | 9 | ssh() { 10 | settitle "$(echo $* | head -c 20)" 11 | command ssh "$@" 12 | settitle "'$shell'" 13 | } 14 | fi' 15 | -------------------------------------------------------------------------------- /rc/50_aliases.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | alias_dir="$DOTFILES_DIR/aliases" 4 | 5 | if [ -d "$alias_dir" ]; then 6 | cd $alias_dir 7 | 8 | for alias in $(ls -1 *.sh); do 9 | content="$(. ./$alias)" 10 | alias_name=$(basename -s .sh $alias) 11 | 12 | if [[ -n "$content" ]]; then 13 | content="$(escape_chars "${content}" '\' '"' '$')" 14 | echo alias $alias_name=\"$content\" 15 | fi 16 | done 17 | fi 18 | -------------------------------------------------------------------------------- /rc/50_bmtools.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if program_exists bm; then 4 | 5 | cat <<'BASHRC' 6 | function cdbm() { 7 | if [ -n "$1" ]; then 8 | cd "`bm $1`"; 9 | else 10 | bm 11 | fi 12 | } 13 | BASHRC 14 | 15 | fi 16 | -------------------------------------------------------------------------------- /rc/85_1password_plugins.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | if program_exists op && [[ -f "${HOME}/.config/op/plugins.sh" ]]; then 5 | echo "source '${HOME}/.config/op/plugins.sh'" 6 | fi 7 | -------------------------------------------------------------------------------- /rc/85_zoxide.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if program_exists zoxide; then 4 | # https://github.com/ajeetdsouza/zoxide 5 | # For completions to work, the above line must be added after compinit is called. You may have to rebuild your completions cache by running rm ~/.zcompdump*; compinit. 6 | echo 'eval "$(zoxide init --cmd cd zsh)"' 7 | fi 8 | -------------------------------------------------------------------------------- /rc/95_cd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Be sure to be in home directory 4 | # echo 'cd' 5 | -------------------------------------------------------------------------------- /rc/bash/10_paths.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | paths="$(. "${DOTFILES_DIR}/rc/common/paths.sh" | tr \"\\n\" ':' | sed s/:$//)" 4 | 5 | echo_export_single_quote PATH "${paths}" 6 | -------------------------------------------------------------------------------- /rc/bash/20_bash_completion.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # enable programmable completion features (you don't need to enable 4 | # this, if it's already enabled in /etc/bash.bashrc and /etc/profile 5 | # sources /etc/bash.bashrc). 6 | if [ -f /etc/bash_completion ]; then 7 | echo 'shopt -oq posix || . /etc/bash_completion' 8 | fi 9 | -------------------------------------------------------------------------------- /rc/bash/20_brew_completion.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if program_exists brew; then 4 | if [ -f `brew --prefix`/etc/bash_completion ]; then 5 | echo ". `brew --prefix`/etc/bash_completion" 6 | fi 7 | fi 8 | -------------------------------------------------------------------------------- /rc/bash/20_kubectl_completion.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if program_exists kubectl; then 4 | echo 'source <(kubectl completion bash)' 5 | echo 'complete -F __start_kubectl k' 6 | fi 7 | -------------------------------------------------------------------------------- /rc/bash/30_history.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # don't put duplicate lines in the history. See bash(1) for more options 4 | # don't overwrite GNU Midnight Commander's setting of `ignorespace'. 5 | # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) 6 | 7 | echo="HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoreboth" 8 | -------------------------------------------------------------------------------- /rc/bash/30_ls_aliases.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | switches="-F" 4 | 5 | if program_exists tput && tput colors >/dev/null; then 6 | switches="${switches}C" 7 | fi 8 | 9 | echo "alias ls='ls ${switches}'" 10 | echo "alias l='ls ${switches}'" 11 | echo "alias la='ls ${switches}a'" 12 | echo "alias ll='ls ${switches}l'" 13 | echo "alias lal='ls ${switches}al'" 14 | -------------------------------------------------------------------------------- /rc/bash/30_prompt.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if program_exists tput && tput setaf 1 >/dev/null; then 4 | # We have color support; assume it's compliant with Ecma-48 5 | # (ISO/IEC-6429). (Lack of such support is extremely rare, and such 6 | # a case would tend to support setf rather than setaf.) 7 | echo_export_single_quote 'CLICOLOR' '1' 8 | echo_export_single_quote 'LSCOLORS' 'exfxcxdxbxegedabagacad' 9 | 10 | if [ -f "$HOME/.zer0prompt.sh" ]; then 11 | echo ". $HOME/.zer0prompt.sh" 12 | echo "zer0prompt" 13 | else 14 | echo_export_single_quote 'PS1' '\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$ ' 15 | fi 16 | else 17 | echo_export_single_quote 'PS1' '\u@\h:\w\\$ ' 18 | fi 19 | -------------------------------------------------------------------------------- /rc/bash/50_brew.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if program_exists brew; then 4 | echo 'eval $(brew shellenv)' 5 | fi 6 | -------------------------------------------------------------------------------- /rc/common/paths.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | paths_dir="${DOTFILES_DIR}/paths" 4 | config_dir="${DOTFILES_CONFIG_DIR}/paths" 5 | 6 | default_paths=( 7 | /usr/local/sbin 8 | /usr/local/bin 9 | /usr/sbin 10 | /usr/bin 11 | /sbin 12 | /bin 13 | ) 14 | 15 | paths="" 16 | 17 | function prepend_path() { 18 | local path="${1}" 19 | 20 | # Test if dir exists, contains executable and not already in path 21 | if [ -n "${path}" -a -d "${path}" ] && dir_has_executables "${path}" && ! echo "${paths}" | grep -oE '[^:]+' | grep -q "^${path}\$"; then 22 | paths="${path}:${paths}" 23 | fi 24 | } 25 | 26 | # default POSIX paths 27 | for path in $(reverse_args ${default_paths[@]}); do 28 | prepend_path "${path}" 29 | done 30 | 31 | # prepend current PATH in reverse order (to maintain original order) 32 | # for path in $(reverse_args $(echo "${PATH}" | grep -oE '[^:]+')); do 33 | # prepend_path "${path}" 34 | # done 35 | 36 | # prepend custom PATH in reverse order (to maintain original order) 37 | for gen in $(reverse_args "$(get_sorted_files "${paths_dir}" "${config_dir}")"); do 38 | path=$(cat_or_exec "${gen}") 39 | for p in $path; do 40 | prepend_path "$p" 41 | done 42 | done 43 | 44 | # See http://stackoverflow.com/questions/11532157/unix-removing-duplicate-lines-without-sorting 45 | echo $paths | grep -oE '[^:]+' | awk ' !x[$0]++' 46 | 47 | -------------------------------------------------------------------------------- /rc/zsh/05_zsh_tmux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if program_exists tmux; then 4 | if [[ "$(uname)" == "Darwin" ]]; then 5 | echo 'if ! [[ "$(ps -ocomm= $PPID)" =~ \/Applications\/.+\.app ]]; then 6 | export ZSH_TMUX_AUTOSTART=true 7 | fi' 8 | else 9 | echo 'export ZSH_TMUX_AUTOSTART=true' 10 | fi 11 | fi -------------------------------------------------------------------------------- /rc/zsh/20_paths.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "path=(" 4 | . "${DOTFILES_DIR}/rc/common/paths.sh" | sed -e 's/^/ "/' -e 's/$/"/' 5 | echo ")" 6 | -------------------------------------------------------------------------------- /rc/zsh/30_prompt.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # skip is oh-my-zsh, which handles everything 4 | if [[ ! -d "${HOME}/.oh-my-zsh" ]]; then 5 | if program_exists tput && tput colors >/dev/null; then 6 | echo "autoload -U promptinit" 7 | echo "promptinit" 8 | echo "PROMPT='%F{magenta}[%~] %f'" 9 | else 10 | echo "PROMPT='[%~] '" 11 | fi 12 | fi 13 | -------------------------------------------------------------------------------- /rc/zsh/40_iterm2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if mac_app_exists "com.googlecode.iterm2" && [ -e "${DOTFILES_INSTALL_PATH}/.iterm2_shell_integration.zsh" ]; then 4 | echo 'source "'"${DOTFILES_INSTALL_PATH}"'/.iterm2_shell_integration.zsh"' 5 | fi 6 | -------------------------------------------------------------------------------- /rc/zsh/50_brew.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if program_exists brew; then 4 | if [[ ! -d "${DOTFILES_INSTALL_PATH}/.oh-my-zsh" ]]; then 5 | # oh-my-zsh is not installed, so we can't use the brew plugin 6 | echo 'eval $(brew shellenv)' 7 | fi 8 | fi 9 | -------------------------------------------------------------------------------- /rc/zsh/80_oh-my-zsh.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | oh_my_zsh_dir="${HOME}/.oh-my-zsh" 4 | 5 | if [[ -d "${oh_my_zsh_dir}" ]]; then 6 | echo "ZSH='${oh_my_zsh_dir}'" 7 | 8 | zsh_theme="wedisagree" 9 | zsh_theme_dir="${oh_my_zsh_dir}/custom/themes" 10 | dotfiles_zsh_theme_dir="${DOTFILES_DIR}/rc/zsh/oh-my-zsh/themes" 11 | if [[ -d "${dotfiles_zsh_theme_dir}" ]]; then 12 | # symlink all included themes 13 | mkdir -p "${zsh_theme_dir}" 14 | ln -sf "${dotfiles_zsh_theme_dir}/"*.zsh-theme "${zsh_theme_dir}/" 15 | 16 | # automically selects the first custom theme 17 | theme=$(find "${dotfiles_zsh_theme_dir}" -name '*.zsh-theme' 2>/dev/null | head -n1) 18 | if [[ -n "${theme}" ]]; then 19 | zsh_theme="$(basename -s .zsh-theme "${theme}")" 20 | fi 21 | fi 22 | echo "ZSH_THEME='${zsh_theme}'" 23 | 24 | echo 'COMPLETION_WAITING_DOTS="true"' 25 | 26 | echo 'plugins=(' 27 | echo " battery" 28 | echo " history" 29 | program_exists op && echo " 1password" 30 | program_exists bower && echo " bower" 31 | program_exists brew && echo " brew" 32 | program_exists brew-cask.rb && echo " brew-cask" 33 | program_exists composer && echo " composer" 34 | program_exists docker && echo " docker" 35 | program_exists fzf && echo " fzf" 36 | program_exists gem && echo " gem" 37 | program_exists git && echo " git" 38 | program_exists kubectl && echo " kubectl" 39 | program_exists npm && echo " npm" 40 | program_exists php && echo " symfony2" 41 | program_exists python && echo " python" 42 | program_exists ssh-agent && echo " ssh-agent" 43 | program_exists svn && echo " svn" 44 | program_exists tmux && echo " tmux" 45 | program_exists vagrant && echo " vagrant" 46 | [[ -d "${oh_my_zsh_dir}/custom/plugins/zsh-fzf-history-search" ]] && echo " zsh-fzf-history-search" 47 | echo ')' 48 | 49 | echo 'zstyle :omz:plugins:ssh-agent agent-forwarding on' 50 | echo 'source "${ZSH}/oh-my-zsh.sh"' 51 | fi 52 | 53 | -------------------------------------------------------------------------------- /rc/zsh/90_zsh_options.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo 'unsetopt correct' 4 | echo 'unsetopt correct_all' 5 | echo 'setopt APPEND_HISTORY' 6 | echo 'unsetopt SHARE_HISTORY' 7 | echo 'setopt HIST_IGNORE_ALL_DUPS' 8 | echo 'setopt HIST_REDUCE_BLANKS' 9 | -------------------------------------------------------------------------------- /rc/zsh/oh-my-zsh/themes/custom.zsh-theme: -------------------------------------------------------------------------------- 1 | # On a mac with snow leopard, for nicer terminal colours: 2 | 3 | # - Install SIMBL: http://www.culater.net/software/SIMBL/SIMBL.php 4 | # - Download'Terminal-Colours': http://bwaht.net/code/TerminalColours.bundle.zip 5 | # - Place that bundle in ~/Library/Application\ Support/SIMBL/Plugins (create that folder if it doesn't exist) 6 | # - Open Terminal preferences. Go to Settings -> Text -> More 7 | # - Change default colours to your liking. 8 | # 9 | 10 | # RPROMPT='${time} %{$fg[magenta]%}$(git_prompt_info)%{$reset_color%}$(git_prompt_status)%{$reset_color%}$(git_prompt_ahead)%{$reset_color%}' 11 | # RPROMPT='${time}%{$reset_color%}' 12 | 13 | # Add this at the start of RPROMPT to include rvm info showing ruby-version@gemset-name 14 | # %{$fg[yellow]%}$(~/.rvm/bin/rvm-prompt)%{$reset_color%} 15 | 16 | # oh-my-zsh Bureau Theme 17 | 18 | # "%F{magenta}[${${PWD/#%$HOME/~}/#$HOME\//~/}] %f" 19 | 20 | ZSH_THEME_BRACKET_LEFT="[" 21 | ZSH_THEME_BRACKET_RIGHT="]" 22 | 23 | ZSH_THEME_PATH="%{$fg[magenta]%}${ZSH_THEME_BRACKET_LEFT}%~${ZSH_THEME_BRACKET_RIGHT}%{$reset_color%}" 24 | 25 | # local time, color coded by last return code 26 | # ZSH_THEME_TIME="%(?.%{$fg[cyan]%}.%{$fg[red]%})${ZSH_THEME_BRACKET_LEFT}%*${ZSH_THEME_BRACKET_RIGHT}%{$reset_color%}" 27 | ZSH_THEME_TIME="%{$fg[yellow]%}${ZSH_THEME_BRACKET_LEFT}%*${ZSH_THEME_BRACKET_RIGHT}%{$reset_color%}" 28 | 29 | ZSH_THEME_EXIT_CODE="%(?..%{$fg[red]%}${ZSH_THEME_BRACKET_LEFT}%?${ZSH_THEME_BRACKET_RIGHT}%{$reset_color%} )" 30 | 31 | 32 | if [ -n "$(battery_pct_prompt)" ]; then 33 | ZSH_THEME_BATTERY=" \$(battery_pct_prompt)%{\$reset_color%}" 34 | fi 35 | 36 | ### NVM 37 | 38 | # ZSH_THEME_NVM_PROMPT_PREFIX="%B⬡%b " 39 | # ZSH_THEME_NVM_PROMPT_SUFFIX="" 40 | 41 | ### Git 42 | 43 | ZSH_THEME_GIT_PROMPT_PREFIX="${ZSH_THEME_BRACKET_LEFT}%{$fg_bold[green]%}➦ %{$reset_color%}%{$fg_bold[white]%}" 44 | ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}${ZSH_THEME_BRACKET_RIGHT}" 45 | ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✓%{$reset_color%}" 46 | ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg[cyan]%}▴%{$reset_color%}" 47 | ZSH_THEME_GIT_PROMPT_BEHIND="%{$fg[magenta]%}▾%{$reset_color%}" 48 | ZSH_THEME_GIT_PROMPT_STAGED="%{$fg_bold[green]%}●%{$reset_color%}" 49 | ZSH_THEME_GIT_PROMPT_UNSTAGED="%{$fg_bold[yellow]%}●%{$reset_color%}" 50 | ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[red]%}●%{$reset_color%}" 51 | 52 | custom_git_branch () { 53 | if [ "$(command git config --bool --get zsh-prompt.branch)" != "false" ]; then 54 | ref=$(command git symbolic-ref HEAD 2> /dev/null) || \ 55 | ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 56 | echo "${ref#refs/heads/}" 57 | fi 58 | } 59 | 60 | custom_git_status() { 61 | _STATUS="" 62 | 63 | if [[ "$(command git config --bool --get zsh-prompt.status)" != "false" ]]; then 64 | # git config zsh-prompt.status-options "--ignore-submodules -uno" 65 | local git_options="$(command git config --get zsh-prompt.status-options)" 66 | _INDEX="$(command git status ${git_options} --porcelain 2> /dev/null)" 67 | 68 | # check status of files 69 | if [[ -n "${_INDEX}" ]]; then 70 | if $(echo "${_INDEX}" | command grep -q '^[AMRD]. '); then 71 | _STATUS="${_STATUS}${ZSH_THEME_GIT_PROMPT_STAGED}" 72 | fi 73 | if $(echo "${_INDEX}" | command grep -q '^.[MTD] '); then 74 | _STATUS="${_STATUS}${ZSH_THEME_GIT_PROMPT_UNSTAGED}" 75 | fi 76 | if $(echo "${_INDEX}" | command grep -q -E '^\?\? '); then 77 | _STATUS="${_STATUS}${ZSH_THEME_GIT_PROMPT_UNTRACKED}" 78 | fi 79 | if $(echo "${_INDEX}" | command grep -q '^UU '); then 80 | _STATUS="${_STATUS}${ZSH_THEME_GIT_PROMPT_UNMERGED}" 81 | fi 82 | else 83 | _STATUS="${_STATUS}${ZSH_THEME_GIT_PROMPT_CLEAN}" 84 | fi 85 | 86 | # check status of local repository 87 | if $(echo "${_INDEX}" | command grep -q '^## .*ahead'); then 88 | _STATUS="${_STATUS}${ZSH_THEME_GIT_PROMPT_AHEAD}" 89 | fi 90 | if $(echo "${_INDEX}" | command grep -q '^## .*behind'); then 91 | _STATUS="${_STATUS}${ZSH_THEME_GIT_PROMPT_BEHIND}" 92 | fi 93 | if $(echo "${_INDEX}" | command grep -q '^## .*diverged'); then 94 | _STATUS="${_STATUS}${ZSH_THEME_GIT_PROMPT_DIVERGED}" 95 | fi 96 | 97 | if $(command git rev-parse --verify refs/stash &> /dev/null); then 98 | _STATUS="${_STATUS}${ZSH_THEME_GIT_PROMPT_STASHED}" 99 | fi 100 | fi 101 | 102 | echo "${_STATUS}" 103 | } 104 | 105 | custom_git_prompt () { 106 | local _branch=$(custom_git_branch) 107 | local _status=$(custom_git_status) 108 | local _result="" 109 | if [[ "${_branch}x" != "x" ]]; then 110 | _result="${ZSH_THEME_GIT_PROMPT_PREFIX}${_branch}" 111 | if [[ "${_status}x" != "x" ]]; then 112 | _result="${_result} ${_status}" 113 | fi 114 | _result="${_result}${ZSH_THEME_GIT_PROMPT_SUFFIX}" 115 | fi 116 | # Pad 117 | if [[ "${_result}" != "" ]]; then 118 | _result="${_result} " 119 | fi 120 | echo "${_result}" 121 | } 122 | 123 | if [[ $EUID -eq 0 ]]; then 124 | _USERNAME="%{$fg_bold[red]%}%n" 125 | _ANCHOR="%{$fg[red]%}#" 126 | else 127 | _USERNAME="%{$fg_bold[white]%}%n" 128 | _ANCHOR="%{$fg[green]%}$" 129 | fi 130 | _USERNAME="${ZSH_THEME_BRACKET_LEFT}$_USERNAME%{$reset_color%}@%m${ZSH_THEME_BRACKET_RIGHT} " 131 | _ANCHOR="$_ANCHOR%{$reset_color%}" 132 | 133 | get_space () { 134 | # Use awk because macOS has BSD sed. 135 | # Use wc -m because macOS awk doesn't support multi-byte 136 | local LENGTH="$(echo -n "$1$2" | awk '{gsub(/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]/,""); print}' | wc -m)" 137 | local SPACES="" 138 | (( LENGTH = ${COLUMNS} - $LENGTH )) 139 | 140 | for i in {0..$LENGTH} 141 | do 142 | SPACES="$SPACES " 143 | done 144 | 145 | echo $SPACES 146 | } 147 | 148 | zsh_command_time() { 149 | # Nothing, we print our own in the theme bar 150 | } 151 | 152 | custom_command_time() { 153 | if [ -n "$ZSH_COMMAND_TIME" ]; then 154 | min=$(($ZSH_COMMAND_TIME/60)) 155 | sec=$(($ZSH_COMMAND_TIME%60)) 156 | if [ "$ZSH_COMMAND_TIME" -le 60 ]; then 157 | color="green" 158 | elif [ "$ZSH_COMMAND_TIME" -gt 60 ] && [ "$ZSH_COMMAND_TIME" -le 180 ]; then 159 | color="yellow" 160 | else 161 | color="red" 162 | fi 163 | 164 | printf "$fg[$color]<%d:%02d> " $min $sec 165 | fi 166 | } 167 | 168 | # _USERNAME not used 169 | # \$(nvm_prompt_info) not used 170 | _1LEFT="╭─${ZSH_THEME_PATH}" 171 | _1RIGHT="\$(custom_git_prompt)\$(custom_command_time)${ZSH_THEME_TIME}${ZSH_THEME_BATTERY}" 172 | 173 | 174 | custom_precmd () { 175 | # Do "right" before because it checks the last exit code 176 | local right_eval="$(print -rP ${_1RIGHT})" 177 | local left_eval="$(print -rP ${_1LEFT})" 178 | 179 | local spaces="$(get_space "${left_eval}" "${right_eval}")" 180 | echo "${left_eval}${spaces}${right_eval}" 181 | } 182 | 183 | setopt prompt_subst 184 | PROMPT='╰─${ZSH_THEME_EXIT_CODE}${_ANCHOR} ' 185 | 186 | autoload -U add-zsh-hook 187 | add-zsh-hook precmd custom_precmd 188 | 189 | -------------------------------------------------------------------------------- /variables/EDITOR.d/00_sublime.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if program_exists subl; then 4 | echo 'subl -w' 5 | fi -------------------------------------------------------------------------------- /variables/EDITOR.d/01_textmate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if program_exists mate; then 4 | echo 'mate -w' 5 | fi -------------------------------------------------------------------------------- /variables/EDITOR.d/80_vim.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if program_exists vim; then 4 | which vim 5 | fi 6 | -------------------------------------------------------------------------------- /variables/EDITOR.d/81_vi.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if program_exists vi; then 4 | which vi 5 | fi 6 | -------------------------------------------------------------------------------- /variables/EDITOR.d/99_nano.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if program_exists nano; then 4 | echo "nano" 5 | fi -------------------------------------------------------------------------------- /variables/GOPATH.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if program_exists go || [ -e "${HOME}/.dev/go" ]; then 4 | gopath="$(ensure_config_var "GOPATH" "GOPATH" "${HOME}")" 5 | echo "${gopath}" 6 | fi 7 | -------------------------------------------------------------------------------- /variables/HOMEBREW_TEMP.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if program_exists brew; then 4 | tmp_dir="$(brew --prefix)/tmp" 5 | [ -d "${tmp_dir}" ] || mkdir -p "${tmp_dir}" 6 | echo "${tmp_dir}" 7 | fi 8 | -------------------------------------------------------------------------------- /variables/JAVA_HOME.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | [ -x /usr/libexec/java_home ] && /usr/libexec/java_home 4 | -------------------------------------------------------------------------------- /variables/KUBECONFIG.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | kube_config_path="${DOTFILES_INSTALL_PATH}/.kube" 4 | 5 | if [[ -d "${kube_config_path}" ]]; then 6 | configs=$(find "${kube_config_path}" -type f -maxdepth 1 -name 'config*' | tr "\n" :) 7 | if [[ -n "${configs}" ]]; then 8 | echo "${KUBECONFIG:+$KUBECONFIG:}${configs}" | tr : "\n" | grep . | sort | uniq | tr "\n" ":" | sed 's/:$//' 9 | fi 10 | fi 11 | -------------------------------------------------------------------------------- /variables/LESS: -------------------------------------------------------------------------------- 1 | -FRSX 2 | -------------------------------------------------------------------------------- /variables/PAGER: -------------------------------------------------------------------------------- 1 | less 2 | --------------------------------------------------------------------------------