├── gitignore_global ├── agignore ├── bin ├── bin ├── replace ├── tat └── git-churn ├── zsh ├── zsh ├── completion │ ├── _staging │ ├── _production │ ├── _rspec │ ├── _ag │ └── _bundler └── functions │ ├── mcd │ ├── cs │ ├── change-extension │ ├── g │ └── envup ├── gvimrc ├── gitmessage ├── .gitignore ├── zshenv ├── aliases ├── setup ├── setup.sh ├── vscode.sh ├── shell.sh ├── dotfiles.sh ├── functions.sh ├── atom.sh ├── pre-setup.sh ├── applications.sh └── osxsettings.sh ├── atom ├── styles.less ├── init.coffee ├── keymap.cson ├── config.cson └── snippets.cson ├── LICENSE ├── README.md ├── gitconfig ├── Code └── User │ ├── snippets │ ├── jsx.json │ └── javascript.json │ ├── keybindings.json │ └── settings.json ├── tmux-client-92091.log ├── zshrc ├── tmux.conf ├── vimrc ├── vimrc.bundles └── com.googlecode.iterm2.plist /gitignore_global: -------------------------------------------------------------------------------- 1 | *.tmp 2 | -------------------------------------------------------------------------------- /agignore: -------------------------------------------------------------------------------- 1 | log 2 | tags 3 | tmp 4 | -------------------------------------------------------------------------------- /bin/bin: -------------------------------------------------------------------------------- 1 | /Users/colby/dotfiles/bin -------------------------------------------------------------------------------- /zsh/zsh: -------------------------------------------------------------------------------- 1 | /Users/colby/dotfiles/zsh -------------------------------------------------------------------------------- /zsh/completion/_staging: -------------------------------------------------------------------------------- 1 | #compdef staging 2 | compdef staging=heroku 3 | -------------------------------------------------------------------------------- /zsh/completion/_production: -------------------------------------------------------------------------------- 1 | #compdef production 2 | compdef production=heroku 3 | -------------------------------------------------------------------------------- /zsh/completion/_rspec: -------------------------------------------------------------------------------- 1 | #compdef rspec 2 | 3 | compadd -P spec/ `ls spec/**/*_spec.rb | sed -E "s/spec\///g"` 4 | -------------------------------------------------------------------------------- /zsh/functions/mcd: -------------------------------------------------------------------------------- 1 | # Make directory and change into it. 2 | 3 | function mcd() { 4 | mkdir -p "$1" && cd "$1"; 5 | } 6 | -------------------------------------------------------------------------------- /zsh/functions/cs: -------------------------------------------------------------------------------- 1 | function cs() { 2 | if [ $# -eq 0 ]; then 3 | cd && ls; 4 | else 5 | cd "$*" && ls; 6 | fi 7 | } 8 | alias cd='cs' 9 | -------------------------------------------------------------------------------- /zsh/completion/_ag: -------------------------------------------------------------------------------- 1 | #compdef ag 2 | 3 | if (( CURRENT == 2 )); then 4 | compadd $(cut -f 1 tmp/tags .git/tags 2>/dev/null) 5 | else; 6 | _files 7 | fi 8 | -------------------------------------------------------------------------------- /zsh/functions/change-extension: -------------------------------------------------------------------------------- 1 | # Change file extensions recursively in current directory 2 | # 3 | # change-extension erb haml 4 | 5 | function change-extension() { 6 | foreach f (**/*.$1) 7 | mv $f $f:r.$2 8 | end 9 | } 10 | -------------------------------------------------------------------------------- /zsh/functions/g: -------------------------------------------------------------------------------- 1 | # No arguments: `git status` 2 | # With arguments: acts like `git` 3 | g() { 4 | if [[ $# > 0 ]]; then 5 | git $@ 6 | else 7 | git status 8 | fi 9 | } 10 | 11 | # Complete g like git 12 | compdef g=git 13 | -------------------------------------------------------------------------------- /zsh/functions/envup: -------------------------------------------------------------------------------- 1 | # Load .env file into shell session for environment variables 2 | 3 | function envup() { 4 | if [ -f .env ]; then 5 | export `cat .env` 6 | else 7 | echo 'No .env file found' 1>&2 8 | return 1 9 | fi 10 | } 11 | -------------------------------------------------------------------------------- /gvimrc: -------------------------------------------------------------------------------- 1 | " No audible bell 2 | set vb 3 | 4 | " No toolbar 5 | set guioptions-=T 6 | 7 | " Use console dialogs 8 | set guioptions+=c 9 | 10 | " Local config 11 | if filereadable($HOME . "/.gvimrc.local") 12 | source ~/.gvimrc.local 13 | endif 14 | 15 | -------------------------------------------------------------------------------- /bin/replace: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Find and replace by a given list of files. 4 | # 5 | # replace foo bar **/*.rb 6 | 7 | find_this=$1 8 | shift 9 | replace_with=$1 10 | shift 11 | 12 | ag -l $find_this $* | xargs sed -i '' "s/$find_this/$replace_with/g" 13 | -------------------------------------------------------------------------------- /gitmessage: -------------------------------------------------------------------------------- 1 | 2 | 3 | # 50-character subject line 4 | # 5 | # 72-character wrapped longer description. This should answer: 6 | # 7 | # * Why was this change necessary? 8 | # * How does it address the problem? 9 | # * Are there any side effects? 10 | # 11 | # Include a link to the ticket, if any. 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | !bin 2 | *.DS_store 3 | tmp/**/* 4 | !tmp/cache/.keep 5 | .env 6 | .bundle 7 | log/*.log 8 | 9 | atom/* 10 | !atom/config.cson 11 | !atom/init.coffee 12 | !atom/keymap.cson 13 | !atom/snippets.cson 14 | !atom/styles.less 15 | 16 | Code/User/workspaceStorage/* 17 | Code/User/globalStorage/* 18 | 19 | gitconfig.local 20 | -------------------------------------------------------------------------------- /zshenv: -------------------------------------------------------------------------------- 1 | # use vim as the visual editor 2 | export VISUAL=nvim 3 | export EDITOR=nvim 4 | 5 | # ensure dotfiles bin directory is loaded first 6 | export PATH="$HOME/.bin:/usr/local/sbin:$PATH" 7 | 8 | # load rbenv if available 9 | if which rbenv &>/dev/null ; then 10 | eval "$(rbenv init - --no-rehash)" 11 | fi 12 | 13 | # mkdir .git/safe in the root of repositories you trust 14 | export PATH=".git/safe/../../bin:$PATH" 15 | -------------------------------------------------------------------------------- /bin/tat: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Attach or create tmux session named the same as current directory. 4 | 5 | session_name="$(basename "$PWD" | tr . -)" 6 | 7 | not_in_tmux() { 8 | [ -z "$TMUX" ] 9 | } 10 | 11 | session_exists() { 12 | tmux list-sessions | sed -E 's/:.*$//' | grep -q "^$session_name$" 13 | } 14 | 15 | create_detached_session() { 16 | (TMUX='' tmux new-session -Ad -s "$session_name") 17 | } 18 | 19 | create_if_needed_and_attach() { 20 | if not_in_tmux; then 21 | tmux new-session -As "$session_name" 22 | else 23 | if ! session_exists; then 24 | create_detached_session 25 | fi 26 | tmux switch-client -t "$session_name" 27 | fi 28 | } 29 | 30 | create_if_needed_and_attach 31 | -------------------------------------------------------------------------------- /aliases: -------------------------------------------------------------------------------- 1 | # Unix 2 | alias tlf="tail -f" 3 | alias ln='ln -v' 4 | alias mkdir='mkdir -p' 5 | alias ...='../..' 6 | alias l='ls' 7 | alias ll='ls -al' 8 | alias lh='ls -Alh' 9 | alias -g G='| grep' 10 | alias -g M='| less' 11 | alias -g L='| wc -l' 12 | alias -g ONE="| awk '{ print \$1}'" 13 | alias e="$EDITOR" 14 | alias v="$VISUAL" 15 | 16 | # Pretty print the path 17 | alias path="echo $PATH | tr -s ':' '\n'" 18 | 19 | # Navigation 20 | alias cddot="cd ~/dotfiles" 21 | alias cdproj="cd ~/projects" 22 | 23 | # Go to the root of a project (git root) 24 | alias root='cd $(git rev-parse --show-cdup)' 25 | 26 | # kill a rogue process running on a specific port 27 | # usage: `killp 3000` 28 | killp() { lsof -n "-i4TCP:${1:-3002}" | grep LISTEN | tr -s ' ' | cut -f 2 -d ' ' | xargs kill -9} 29 | -------------------------------------------------------------------------------- /setup/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | source ~/dotfiles/setup/functions.sh 3 | 4 | fancy_echo "Setting up git user info for .gitconfig.local" 5 | echo "Enter your git name." 6 | read git_name 7 | echo "Enter your Github email." 8 | read git_email 9 | echo "Enter your Github username." 10 | read github_username 11 | 12 | touch ~/dotfiles/gitconfig.local 13 | echo "[user]" >> ~/dotfiles/gitconfig.local 14 | echo " name = $git_name" >> ~/dotfiles/gitconfig.local 15 | echo " email = $git_email" >> ~/dotfiles/gitconfig.local 16 | echo "[github]" >> ~/dotfiles/gitconfig.local 17 | echo " user = $github_username" >> ~/dotfiles/gitconfig.local 18 | 19 | source ~/dotfiles/setup/shell.sh 20 | source ~/dotfiles/setup/applications.sh 21 | source ~/dotfiles/setup/dotfiles.sh 22 | source ~/dotfiles/setup/atom.sh 23 | source ~/dotfiles/setup/vscode.sh 24 | source ~/dotfiles/setup/osxsettings.sh 25 | -------------------------------------------------------------------------------- /atom/styles.less: -------------------------------------------------------------------------------- 1 | /* 2 | * Your Stylesheet 3 | * 4 | * This stylesheet is loaded when Atom starts up and is reloaded automatically 5 | * when it is changed and saved. 6 | * 7 | * Add your own CSS or Less to fully customize Atom. 8 | * If you are unfamiliar with Less, you can read more about it here: 9 | * http://lesscss.org 10 | */ 11 | 12 | 13 | /* 14 | * Examples 15 | * (To see them, uncomment and save) 16 | */ 17 | 18 | // style the background color of the tree view 19 | .tree-view { 20 | // background-color: whitesmoke; 21 | } 22 | 23 | // style the background and foreground colors on the atom-text-editor-element itself 24 | atom-text-editor { 25 | // color: white; 26 | // background-color: hsl(180, 24%, 12%); 27 | } 28 | 29 | // To style other content in the text editor's shadow DOM, use the ::shadow expression 30 | atom-text-editor::shadow .cursor { 31 | // border-color: red; 32 | } 33 | -------------------------------------------------------------------------------- /setup/vscode.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | source ~/dotfiles/setup/functions.sh 3 | 4 | fancy_echo "Symlinking VSCode settings" 5 | ln -s ~/dotfiles/Code/User ~/Library/Application\ Support/Code/User 6 | 7 | fancy_echo "Installing Vscode" 8 | brew cask install visual-studio-code 9 | 10 | fancy_echo "Installing plugins" 11 | code --install-extension vscodevim.vim 12 | code --install-extension VisualStudioExptTeam.vscodeintellicode 13 | code --install-extension dbaeumer.vscode-eslint 14 | code --install-extension ryanolsonx.solarized 15 | code --install-extension PKief.material-icon-theme 16 | code --install-extension hoovercj.vscode-settings-cycler 17 | code --install-extension ionutvmi.path-autocomplete 18 | code --install-extension capaj.vscode-exports-autocomplete 19 | code --install-extension EditorConfig.EditorConfig 20 | code --install-extension mgmcdermott.vscode-language-babel 21 | code --install-extension jaspernorth.vscode-pigments 22 | code --install-extension stevencl.addDocComments 23 | -------------------------------------------------------------------------------- /atom/init.coffee: -------------------------------------------------------------------------------- 1 | # Your init script 2 | # 3 | # Atom will evaluate this file each time a new window is opened. It is run 4 | # after packages are loaded/activated and after the previous editor state 5 | # has been restored. 6 | # 7 | # An example hack to log to the console when each text editor is saved. 8 | # 9 | # atom.workspace.observeTextEditors (editor) -> 10 | # editor.onDidSave -> 11 | # console.log "Saved! #{editor.getPath()}" 12 | 13 | atom.commands.add atom.views.getView(atom.workspace), 'custom:insert-line-below', -> 14 | editor = atom.workspace.getActiveTextEditor() 15 | editor.newlineBelow() 16 | 17 | atom.commands.add atom.views.getView(atom.workspace), 'custom:insert-line-above', -> 18 | editor = atom.workspace.getActiveTextEditor() 19 | editor.newlineAbove() 20 | 21 | atom.commands.add atom.views.getView(atom.workspace), 'custom:semicolonize', -> 22 | editor = atom.workspace.getActiveTextEditor() 23 | position = editor.getCursorBufferPosition() 24 | editor.moveToEndOfLine() 25 | editor.insertText(";") 26 | editor.setCursorBufferPosition(position) 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | LICENSE 2 | 3 | The MIT License 4 | 5 | Copyright (c) 2015-2016 Colby Williams 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /setup/shell.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | source ~/dotfiles/setup/functions.sh 3 | 4 | # shellcheck disable=SC2154 5 | trap 'ret=$?; test $ret -ne 0 && printf "failed\n\n" >&2; exit $ret' EXIT 6 | 7 | set -e 8 | 9 | if [ ! -d "$HOME/.bin/" ]; then 10 | mkdir "$HOME/.bin" 11 | fi 12 | 13 | if [ ! -f "$HOME/.zshrc" ]; then 14 | touch "$HOME/.zshrc" 15 | fi 16 | 17 | # shellcheck disable=SC2016 18 | append_to_zshrc 'export PATH="$HOME/.bin:$PATH"' 19 | 20 | HOMEBREW_PREFIX="/usr/local" 21 | 22 | if [ -d "$HOMEBREW_PREFIX" ]; then 23 | if ! [ -r "$HOMEBREW_PREFIX" ]; then 24 | sudo chown -R "$LOGNAME:admin" /usr/local 25 | fi 26 | else 27 | sudo mkdir "$HOMEBREW_PREFIX" 28 | sudo chflags norestricted "$HOMEBREW_PREFIX" 29 | sudo chown -R "$LOGNAME:admin" "$HOMEBREW_PREFIX" 30 | fi 31 | 32 | brew uninstall zsh 33 | case "$SHELL" in 34 | */zsh) : ;; 35 | *) 36 | fancy_echo "Changing your shell to zsh ..." 37 | chsh -s "$(which zsh)" 38 | ;; 39 | esac 40 | 41 | curl -L https://iterm2.com/misc/install_shell_integration_and_utilities.sh | bash 42 | 43 | git clone git@github.com:powerline/fonts.git ~/fonts-delete && ~/fonts-delete/install.sh && rm -rf ~/fonts-delete 44 | 45 | -------------------------------------------------------------------------------- /setup/dotfiles.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | source ~/dotfiles/setup/functions.sh 3 | 4 | 5 | dotfiles=( 6 | zsh 7 | bin 8 | aliases 9 | agignore 10 | gitconfig 11 | gitconfig.local 12 | gitmessage 13 | gvimrc 14 | tmux.conf 15 | zshenv 16 | zshrc 17 | vimrc.bundles 18 | vimrc 19 | vim 20 | ) 21 | 22 | nvimrcpath="~/.config/nvim/init.vim" 23 | nvimpath="~/.config/nvimrc" 24 | 25 | fancy_echo "Backup current config" 26 | today=`date +%Y%m%d` 27 | for i in ${dotfiles[@]} ; do 28 | if [ "vimrc" == "$i" ]; then 29 | [ -e $nvimrcpath ] && [ ! -L $nvimrcpath ] && mv $nvimrcpath $nvimrcpath.bak.$today ; 30 | [ -L $nvimrcpath ] && unlink $nvimrcpath ; 31 | elif [ "vim" == "$i" ]; then 32 | [ -e ~$nvimpath ] && [ ! -L ~$nvimpath ] && mv ~$nvimpath ~$nvimpath.bak.$today ; 33 | [ -L ~$nvimpath ] && unlink ~$nvimpath ; 34 | else 35 | [ -e ~/.$i ] && [ ! -L ~/.$i ] && mv ~/.$i ~/.$i.bak.$today ; 36 | [ -L ~/.$i ] && unlink ~/.$i ; 37 | fi 38 | done 39 | 40 | fancy_echo "Symlinking dotfiles" 41 | for i in ${dotfiles[@]} ; do 42 | if [ "vimrc" == "$i" ]; then 43 | ln -s ~/dotfiles/vimrc $nvimrcpath 44 | elif [ "vim" == "$i" ]; then 45 | ln -s ~/.vim $nvimpath 46 | else 47 | ln -s ~/dotfiles/$i ~/.$i 48 | fi 49 | done 50 | -------------------------------------------------------------------------------- /setup/functions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | append_to_zshrc() { 4 | local text="$1" zshrc 5 | local skip_new_line="${2:-0}" 6 | 7 | if [ -w "$HOME/.zshrc.local" ]; then 8 | zshrc="$HOME/.zshrc.local" 9 | else 10 | zshrc="$HOME/.zshrc" 11 | fi 12 | 13 | if ! grep -Fqs "$text" "$zshrc"; then 14 | if [ "$skip_new_line" -eq 1 ]; then 15 | printf "%s\n" "$text" >> "$zshrc" 16 | else 17 | printf "\n%s\n" "$text" >> "$zshrc" 18 | fi 19 | fi 20 | } 21 | 22 | fancy_echo() { 23 | local fmt="$1"; shift 24 | 25 | # shellcheck disable=SC2059 26 | printf "\n$fmt\n" "$@" 27 | } 28 | 29 | fancy_echo_line() { 30 | local fmt="$1"; shift 31 | 32 | # shellcheck disable=SC2059 33 | printf "\n$fmt" "$@" 34 | } 35 | 36 | append_to_zshrc() { 37 | local text="$1" zshrc 38 | local skip_new_line="${2:-0}" 39 | 40 | if [ -w "$HOME/.zshrc.local" ]; then 41 | zshrc="$HOME/.zshrc.local" 42 | else 43 | zshrc="$HOME/.zshrc" 44 | fi 45 | 46 | if ! grep -Fqs "$text" "$zshrc"; then 47 | if [ "$skip_new_line" -eq 1 ]; then 48 | printf "%s\n" "$text" >> "$zshrc" 49 | else 50 | printf "\n%s\n" "$text" >> "$zshrc" 51 | fi 52 | fi 53 | } 54 | 55 | gem_install_or_update() { 56 | if gem list "$1" --installed > /dev/null; then 57 | gem update "$@" 58 | else 59 | gem install "$@" 60 | rbenv rehash 61 | fi 62 | } 63 | -------------------------------------------------------------------------------- /setup/atom.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | source ~/dotfiles/setup/functions.sh 3 | 4 | fancy_echo "Installing Atom" 5 | ln -s ~/dotfiles/atom ~/.atom 6 | brew cask install atom 7 | 8 | fancy_echo "Installing Atom packages" 9 | apm install autocomplete-modules 10 | apm install autocomplete-paths 11 | apm install color-picker 12 | apm install editorconfig 13 | apm install file-icons 14 | apm install fonts 15 | apm install language-babel 16 | apm install linter 17 | apm install linter-eslint 18 | apm install pigments 19 | apm install gist 20 | apm install language-hjson 21 | 22 | fancy_echo "Installing atom packages for vim mode" 23 | apm install relative-numbers 24 | apm install atom-keyboard-macros-vim 25 | apm install vim-mode-plus 26 | apm install vim-mode-plus-keymaps-for-surround 27 | 28 | fancy_echo "Installing atom packages for Amazon dev stuff" 29 | apm install autocomplete-jsp 30 | 31 | mkdir ~/tlds 32 | wget -P ~/tlds https://raw.githubusercontent.com/javaee/jstl-api/master/impl/src/main/resources/META-INF/c.tld 33 | wget -P ~/tlds https://raw.githubusercontent.com/javaee/jstl-api/master/impl/src/main/resources/META-INF/fmt.tld 34 | wget -P ~/tlds https://raw.githubusercontent.com/javaee/jstl-api/master/impl/src/main/resources/META-INF/fn.tld 35 | wget -P ~/tlds https://raw.githubusercontent.com/javaee/jstl-api/master/impl/src/main/resources/META-INF/sql.tld 36 | wget -P ~/tlds https://raw.githubusercontent.com/javaee/jstl-api/master/impl/src/main/resources/META-INF/x.tld 37 | -------------------------------------------------------------------------------- /setup/pre-setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | fancy_echo() { 4 | local fmt="$1"; shift 5 | 6 | # shellcheck disable=SC2059 7 | printf "\n$fmt\n" "$@" 8 | } 9 | 10 | if ! command -v brew >/dev/null; then 11 | fancy_echo "Installing Homebrew ..." 12 | curl -fsS \ 13 | 'https://raw.githubusercontent.com/Homebrew/install/master/install' | ruby 14 | 15 | append_to_zshrc '# recommended by brew doctor' 16 | 17 | # shellcheck disable=SC2016 18 | append_to_zshrc 'export PATH="/usr/local/bin:$PATH"' 1 19 | 20 | export PATH="/usr/local/bin:$PATH" 21 | fi 22 | 23 | if brew list | grep -Fq brew-cask; then 24 | fancy_echo "Uninstalling old Homebrew-Cask ..." 25 | brew uninstall --force brew-cask 26 | fi 27 | 28 | fancy_echo "Installing git with Homebrew ..." 29 | brew install git 30 | brew tap caskroom/cask 31 | brew cask install github-desktop 32 | 33 | fancy_echo "Setting up Github SSH key pairs." 34 | echo "Please enter your github email." 35 | read github_email 36 | ssh-keygen -t rsa -b 4096 -C $github_email 37 | 38 | fancy_echo "Starting ssh-agent in the background." 39 | eval "$(ssh-agent -s)" 40 | 41 | fancy_echo "Adding your SSH key to ssh-agent." 42 | ssh-add ~/.ssh/id_rsa 43 | 44 | fancy_echo "Copying SSH key to your clipboard." 45 | pbcopy < ~/.ssh/id_rsa.pub 46 | 47 | fancy_echo "Add key to github to finish setup." 48 | echo "Press enter to open instructions." 49 | read throwaway_input 50 | open https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/ 51 | open https://github.com/settings/keys 52 | -------------------------------------------------------------------------------- /bin/git-churn: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | # 3 | # Put this on your $PATH (~/bin is recommended). 4 | # 5 | # Show churn for the files changed in the branch: 6 | # 7 | # $ git-churn 8 | # 9 | 10 | class GitChurn 11 | attr_accessor :all_files_with_churn_count, :changed_files, :result 12 | 13 | def calculate 14 | get_all_files_with_churn_count 15 | get_changed_files 16 | filter_into_result 17 | print_result 18 | end 19 | 20 | private 21 | 22 | def get_all_files_with_churn_count 23 | self.all_files_with_churn_count = 24 | `git log --all #{format_logs} | #{remove_blank_lines} | #{sort_by_ascending_churn_count}`.split("\n") 25 | end 26 | 27 | def format_logs 28 | "--name-only --format='format:'" 29 | end 30 | 31 | def remove_blank_lines 32 | "grep -v '^$'" 33 | end 34 | 35 | def sort_by_ascending_churn_count 36 | 'sort | uniq -c | sort' 37 | end 38 | 39 | def get_changed_files 40 | self.changed_files = 41 | `git log origin/master..HEAD #{format_logs} | #{remove_blank_lines} | #{remove_duplicates}`.split("\n") 42 | end 43 | 44 | def remove_duplicates 45 | 'sort | uniq' 46 | end 47 | 48 | def filter_into_result 49 | self.result = all_files_with_churn_count.select { |file| file_changed?(file) }.join("\n") 50 | end 51 | 52 | def file_changed?(file) 53 | changed_files.any? { |changed_file| file.include?(changed_file) } 54 | end 55 | 56 | def print_result 57 | puts result 58 | end 59 | end 60 | 61 | git_churn = GitChurn.new 62 | git_churn.calculate 63 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # New Mac Web Dev Setup scripts 2 | 3 | ## Customizing 4 | I do NOT recommend installing all of my setup without looking through what is happening and customizing it for yourself. Fork this repo and update anything you like. 5 | 6 | Look through the shell scripts in `setup` folder to see what programs are being installed. You can add or remove everything from there. Most likely, if you are not a VIM power user you will want to modify some of the shell and atom plugins/config to suit yours preferences. 7 | 8 | ## Pre-Setup (If you don't have Homebrew and/or Github setup with SSH access) 9 | Install Homebrew and git, and set up SSH for Github 10 | ```bash 11 | curl --remote-name https://raw.githubusercontent.com/colbycheeze/dotfiles/master/setup/pre-setup.sh 12 | chmod a+x pre-setup.sh 13 | ./pre-setup.sh 14 | ``` 15 | Manually Install latest (non beta) Xcode from the [app store](https://developer.apple.com/xcode/downloads/) 16 | 17 | ## Setup 18 | `git clone git@github.com:colbycheeze/dotfiles.git ~/dotfiles && cd ~/dotfiles/setup && git checkout amazon && chmod a+x applications.sh && chmod a+x finishSetup.sh ./applications.sh` 19 | 20 | ## Finishing touches 21 | 1. open `tmux` and install plugins: `CTRL + A, I` 22 | 1. open `nvim` and run `:PlugInstall` and `:UpdateRemotePlugins` 23 | 1. Register Divvy and add any hotkeys for window management 24 | 1. Change key repeat rate / delay to fast/short in keyboard preferences 25 | 1. Swap ESC and CAPS key in keyboard preferences (OSX Sierra now supports this) 26 | 1. Connect iterm2 profile to dotfiles: [(instructions)](http://stackoverflow.com/a/25122646/4298624) 27 | -------------------------------------------------------------------------------- /atom/keymap.cson: -------------------------------------------------------------------------------- 1 | # You can find more information about keymaps in these guides: 2 | # * https://atom.io/docs/latest/using-atom-basic-customization#customizing-key-bindings 3 | # * https://atom.io/docs/latest/behind-atom-keymaps-in-depth 4 | 5 | 'atom-text-editor.vim-mode-plus:not(.insert-mode)': 6 | 'ctrl-h': 'window:focus-pane-on-left' 7 | 'ctrl-l': 'window:focus-pane-on-right' 8 | 'ctrl-k': 'window:focus-pane-on-top' 9 | 'ctrl-j': 'window:focus-pane-on-bottom' 10 | 'g c': 'editor:toggle-line-comments' 11 | 'space q': 'atom-keyboard-macros-vim:execute_macro_vim' 12 | # '%': 'bracket-matcher:go-to-matching-bracket' 13 | # '%': 'vim-mode:bracket-matching-motion' 14 | 15 | 'atom-text-editor.vim-mode-plus.insert-mode': 16 | 'ctrl-;': 'custom:semicolonize' 17 | 18 | 'atom-text-editor.vim-mode-plus.normal-mode': 19 | 'space s': 'window:save-all' 20 | 'space x': 'core:close' 21 | 'enter': 'editor:newline-below' 22 | 'shift-enter': 'editor:newline-above' 23 | 'space ;': 'custom:semicolonize' 24 | 'ctrl-;': 'custom:semicolonize' 25 | 26 | '.platform-darwin': 27 | 'cmd-n': 'tree-view:toggle' 28 | 'ctrl-n': 'tree-view:toggle-focus' 29 | 'cmd-p': 'fuzzy-finder:toggle-file-finder' 30 | 'ctrl-p': 'fuzzy-finder:toggle-file-finder' 31 | 32 | '.fuzzy-finder atom-text-editor[mini]': 33 | 'ctrl-v': 'pane:split-right' 34 | 'ctrl-s': 'pane:split-down' 35 | 36 | '.tree-view': 37 | 'o': 'tree-view:expand-directory' 38 | 'O': 'tree-view:recursive-expand-directory' 39 | 'x': 'tree-view:collapse-directory' 40 | 'X': 'tree-view:recursive-collapse-directory' 41 | 's': 'tree-view:open-selected-entry-down' 42 | 'v': 'tree-view:open-selected-entry-right' 43 | 't': 'tree-view:open-selected-entry' 44 | 'd': 'tree-view:remove' 45 | 'c': 'tree-view:duplicate' 46 | 47 | 'atom-workspace atom-text-editor.autocomplete-active': 48 | 'tab': 'snippets:next-tab-stop' 49 | 'shift-tab': 'snippets:previous-tab-stop' 50 | -------------------------------------------------------------------------------- /gitconfig: -------------------------------------------------------------------------------- 1 | [init] 2 | templatedir = ~/.git_template 3 | [push] 4 | default = current 5 | [color] 6 | ui = auto 7 | [alias] 8 | aa = add --all 9 | ci = commit -v 10 | 11 | # Commit all changes 12 | ca = !git add -A && git commit -av 13 | 14 | # Add all changes to last commit 15 | caa = !git add -A && git commit --amend -av 16 | 17 | # Switch to a branch, creating it if necessary 18 | co = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f" 19 | 20 | # Rename local branch 21 | rn = "!f() { git branch -m $1; }; f" 22 | 23 | # Sync current branch by rebasing on top 24 | scb = !git pull --rebase 25 | 26 | # Sync current branch with mainline 27 | up = "!f() { git branch --set-upstream-to origin/$1; }; f" 28 | 29 | # View all branches, upstreams, info etc 30 | vv = !git branch -vv 31 | 32 | # Show the diff between the latest commit and the current state 33 | d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat" 34 | 35 | # deploy a folder to gh-pages branch (public by default) 36 | ghp = "!f() { git subtree push --prefix ${1:-public} origin gh-pages; }; f" 37 | 38 | current-branch = !sh -c 'git rev-parse --abbrev-ref HEAD' - 39 | delete-branch = !sh -c 'git push origin :refs/heads/$1 && git branch -D $1' - 40 | dag = log --graph --format='format:%C(yellow)%h%C(reset) %C(blue)\"%an\" <%ae>%C(reset) %C(magenta)%cr%C(reset)%C(auto)%d%C(reset)%n%s' --date-order 41 | [core] 42 | excludesfile = /Users/willcolb/.gitignore_global 43 | autocrlf = input 44 | pager = less -FMRiX 45 | [commit] 46 | template = ~/.gitmessage 47 | [fetch] 48 | prune = true 49 | [include] 50 | path = ~/.gitconfig.local 51 | [filter "hawser"] 52 | clean = git hawser clean %f 53 | smudge = git hawser smudge %f 54 | required = true 55 | [filter "lfs"] 56 | clean = git-lfs clean -- %f 57 | smudge = git-lfs smudge -- %f 58 | process = git-lfs filter-process 59 | required = true 60 | -------------------------------------------------------------------------------- /setup/applications.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | source ~/dotfiles/setup/functions.sh 3 | 4 | if ! command -v brew >/dev/null; then 5 | fancy_echo "Installing Homebrew ..." 6 | curl -fsS \ 7 | 'https://raw.githubusercontent.com/Homebrew/install/master/install' | ruby 8 | 9 | append_to_zshrc '# recommended by brew doctor' 10 | 11 | # shellcheck disable=SC2016 12 | append_to_zshrc 'export PATH="/usr/local/bin:$PATH"' 1 13 | 14 | export PATH="/usr/local/bin:$PATH" 15 | fi 16 | 17 | if brew list | grep -Fq brew-cask; then 18 | fancy_echo "Uninstalling old Homebrew-Cask ..." 19 | brew uninstall --force brew-cask 20 | fi 21 | 22 | brew update && brew install `brew outdated` 23 | 24 | fancy_echo "Installing CLI tools" 25 | brew install openssl 26 | brew install zsh 27 | brew install zsh-completions 28 | brew install bash 29 | brew install bash-completion 30 | brew install fzf 31 | brew install the_silver_searcher 32 | brew install wget 33 | brew install watchman # needed for jest --watch 34 | 35 | fancy_echo "Installing python and setting up Neovim" 36 | brew install python 37 | brew install python3 38 | brew install neovim/neovim/neovim 39 | curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs \ 40 | https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim 41 | pip3 install neovim 42 | 43 | 44 | fancy_echo "Setting up tmux" 45 | brew install tmux 46 | brew install reattach-to-user-namespace 47 | brew install tree 48 | git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm 49 | 50 | fancy_echo "Setting up Node with NVM" 51 | mkdir ~/.nvm 52 | curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash 53 | export NVM_DIR="$HOME/.nvm" 54 | [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" 55 | nvm install node 56 | nvm alias default node 57 | 58 | fancy_echo "Installing global npm packages" 59 | npm install -g npm@latest 60 | npm install -g npm-check-updates browser-sync 61 | 62 | brew install chrome-cli 63 | brew install git 64 | 65 | brew tap caskroom/cask 66 | brew cask install google-chrome 67 | brew cask install iterm2 68 | brew cask install github-desktop 69 | brew cask install dropbox 70 | brew cask install divvy 71 | brew cask install caffeine 72 | brew cask install screenflow 73 | brew cask install macdown 74 | 75 | fancy_echo "Installing Misc Apps" 76 | brew cask install discord 77 | brew cask install disk-inventory-x 78 | brew cask install vlc 79 | -------------------------------------------------------------------------------- /atom/config.cson: -------------------------------------------------------------------------------- 1 | "*": 2 | "atom-ternjs": 3 | useSnippets: true 4 | "autocomplete-modules": 5 | vendors: [ 6 | "node_modules" 7 | "src" 8 | ] 9 | build: 10 | saveOnBuild: true 11 | core: 12 | disabledPackages: [ 13 | "linter-flow-plus" 14 | "autocomplete-flow" 15 | "linter-flow" 16 | "atom-ternjs" 17 | "linter-checkstyle" 18 | ] 19 | packagesWithKeymapsDisabled: [ 20 | "git-blame" 21 | ] 22 | projectHome: "/Users/colbywilliams/projects" 23 | telemetryConsent: "limited" 24 | themes: [ 25 | "one-light-ui" 26 | "solarized-light-syntax" 27 | ] 28 | editor: 29 | invisibles: {} 30 | preferredLineLength: 100 31 | scrollPastEnd: true 32 | "exception-reporting": 33 | userId: "a58af052-dcc6-4331-81cb-59b673e99ccc" 34 | fonts: {} 35 | gist: 36 | tokenFile: "~/.atom/gist-it.token" 37 | "gist-it": 38 | openAfterCreate: true 39 | "git-blame": 40 | columnWidth: 556 41 | showOnlyLastNames: false 42 | "git-diff": {} 43 | "language-babel": {} 44 | linter: {} 45 | "linter-eslint": 46 | disableEslintIgnore: true 47 | fixOnSave: true 48 | globalNodePath: "/usr/local" 49 | "linter-ui-default": 50 | panelHeight: 143 51 | tooltipFollows: "Keyboard" 52 | "merge-conflicts": 53 | gitPath: "/usr/local/bin/git" 54 | "one-dark-ui": {} 55 | "one-light-ui": {} 56 | pigments: 57 | autocompleteScopes: [ 58 | ".source.scss" 59 | ] 60 | extendAutocompleteToColorValue: true 61 | extendAutocompleteToVariables: true 62 | ignoreVcsIgnoredPaths: false 63 | ignoredNames: [ 64 | "src/node_modules/*" 65 | "node_modules/*" 66 | "public/*" 67 | "src/pre-atlas/**/*" 68 | ] 69 | sourceNames: [ 70 | "**/*.scss" 71 | ] 72 | "sync-settings": 73 | _analyticsUserId: "971b17cd-cd84-406f-aa72-4dd819000ce2" 74 | "tree-view": 75 | squashDirectoryNames: true 76 | "vim-mode": 77 | useSmartcaseForSearch: true 78 | "vim-mode-plus": {} 79 | "vim-surround": {} 80 | welcome: 81 | showOnStartup: false 82 | ".attribute-values.js.jsx.source": 83 | editor: 84 | preferredLineLength: 100 85 | ".babel.regexp.source": 86 | editor: 87 | preferredLineLength: 100 88 | ".dustjs.html.text": 89 | editor: 90 | preferredLineLength: 100 91 | ".ini.source": 92 | editor: 93 | scrollPastEnd: true 94 | showIndentGuide: true 95 | showInvisibles: true 96 | ".js.jsx.react.source": 97 | editor: 98 | preferredLineLength: 100 99 | ".js.jsx.source": 100 | editor: 101 | preferredLineLength: 100 102 | ".js.source.subtlegradient": 103 | editor: 104 | preferredLineLength: 100 105 | -------------------------------------------------------------------------------- /zsh/completion/_bundler: -------------------------------------------------------------------------------- 1 | #compdef bundle 2 | 3 | local curcontext="$curcontext" state line _gems _opts ret=1 4 | 5 | _arguments -C -A "-v" -A "--version" \ 6 | '(- 1 *)'{-v,--version}'[display version information]' \ 7 | '1: :->cmds' \ 8 | '*:: :->args' && ret=0 9 | 10 | case $state in 11 | cmds) 12 | _values "bundle command" \ 13 | "install[Install the gems specified by the Gemfile or Gemfile.lock]" \ 14 | "update[Update dependencies to their latest versions]" \ 15 | "package[Package the .gem files required by your application]" \ 16 | "exec[Execute a script in the context of the current bundle]" \ 17 | "config[Specify and read configuration options for bundler]" \ 18 | "check[Determine whether the requirements for your application are installed]" \ 19 | "list[Show all of the gems in the current bundle]" \ 20 | "show[Show the source location of a particular gem in the bundle]" \ 21 | "console[Start an IRB session in the context of the current bundle]" \ 22 | "open[Open an installed gem in the editor]" \ 23 | "viz[Generate a visual representation of your dependencies]" \ 24 | "init[Generate a simple Gemfile, placed in the current directory]" \ 25 | "gem[Create a simple gem, suitable for development with bundler]" \ 26 | "help[Describe available tasks or one specific task]" 27 | ret=0 28 | ;; 29 | args) 30 | case $line[1] in 31 | help) 32 | _values 'commands' 'install update package exec config check list show console open viz init gem help' && ret=0 33 | ;; 34 | install) 35 | _arguments \ 36 | '(--no-color)--no-color[disable colorization in output]' \ 37 | '(--local)--local[do not attempt to connect to rubygems.org]' \ 38 | '(--quiet)--quiet[only output warnings and errors]' \ 39 | '(--gemfile)--gemfile=-[use the specified gemfile instead of Gemfile]:gemfile' \ 40 | '(--system)--system[install to the system location]' \ 41 | '(--deployment)--deployment[install using defaults tuned for deployment environments]' \ 42 | '(--frozen)--frozen[do not allow the Gemfile.lock to be updated after this install]' \ 43 | '(--path)--path=-[specify a different path than the system default]:path:_files' \ 44 | '(--binstubs)--binstubs=-[generate bin stubs for bundled gems to ./bin]:directory:_files' \ 45 | '(--without)--without=-[exclude gems that are part of the specified named group]:groups' 46 | ret=0 47 | ;; 48 | exec) 49 | _normal && ret=0 50 | ;; 51 | (open|show) 52 | _gems=( $(bundle show 2> /dev/null | sed -e '/^ \*/!d; s/^ \* \([^ ]*\) .*/\1/') ) 53 | if [[ $_gems != "" ]]; then 54 | _values 'gems' $_gems && ret=0 55 | fi 56 | ;; 57 | *) 58 | _opts=( $(bundle help $line[1] | sed -e '/^ \[-/!d; s/^ \[\(-[^=]*\)=.*/\1/') ) 59 | _opts+=( $(bundle help $line[1] | sed -e '/^ -/!d; s/^ \(-.\), \[\(-[^=]*\)=.*/\1 \2/') ) 60 | if [[ $_opts != "" ]]; then 61 | _values 'options' $_opts && ret=0 62 | fi 63 | ;; 64 | esac 65 | ;; 66 | esac 67 | 68 | return ret 69 | 70 | -------------------------------------------------------------------------------- /Code/User/snippets/jsx.json: -------------------------------------------------------------------------------- 1 | { 2 | // Place your snippets for jsx here. Each snippet is defined under a snippet name and has a prefix, body and 3 | // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: 4 | // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the 5 | // same ids are connected. 6 | // Example: 7 | // "Print to console": { 8 | // "prefix": "log", 9 | // "body": [ 10 | // "console.log('$1');", 11 | // "$2" 12 | // ], 13 | // "description": "Log output to console" 14 | // } 15 | "React Class Starter": { 16 | "prefix": "rcc", 17 | "body": "import React, { PureComponent } from 'react';\nimport PT from 'prop-types';\n\nexport default class ${1:ComponentName} extends PureComponent {\n static propTypes = {\n name: PT.string,\n }\n\n static defaultProps = {\n name: 'Colby',\n }\n\n render() {\n const { name } = this.props;\n\n return (\n
tags like the block tags they are
78 | let g:html_indent_tags = 'li\|p'
79 |
80 | " ================ Scrolling ========================
81 |
82 | set scrolloff=8 "Start scrolling when we're 8 lines away from margins
83 | set sidescrolloff=15
84 | set sidescroll=1
85 |
86 | "Toggle relative numbering, and set to absolute on loss of focus or insert mode
87 | set rnu
88 | function! ToggleNumbersOn()
89 | set nu!
90 | set rnu
91 | endfunction
92 | function! ToggleRelativeOn()
93 | set rnu!
94 | set nu
95 | endfunction
96 | autocmd FocusLost * call ToggleRelativeOn()
97 | autocmd FocusGained * call ToggleRelativeOn()
98 | autocmd InsertEnter * call ToggleRelativeOn()
99 | autocmd InsertLeave * call ToggleRelativeOn()
100 |
101 | "Use enter to create new lines w/o entering insert mode
102 | nnoremap I decorate the story!
420 | {story()}
421 |