Anders's dotfiles

These are my dotfiles, which may or may not be helpful to you.

Tools

There are a number of tools I always seem to end up using. Some of these change over time. Some seem to more or less stay the same. For a while, I preferred MacPorts. These days I prefer Homebrew. Mostly, things stay more or less the same.

You probably want to install these manually before proceeding:

TL;DR

To set up your local computer just the way I like it, run:
bash <(curl -s https://cyborch.com/dotfiles/getall.sh)

On to the dotfiles

The easiest way to use any one of these is with curl:

cd;curl -O https://cyborch.com/dotfiles/{.whatever}

.bash_profile

Why?

There are several things going on here:

#!/bin/bash

# Load bash completions
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion

# Locally installed fastlane
export PATH="$HOME/.fastlane/bin:$PATH"

# TextMate is still my favorite general purpose editor
export EDITOR="mate -w"

Raw .bash_profile

.gitconfig

Why?

There are a lot of things git can do from the command line which to a large degree render UI tools irellevant. Formatting log output to add color and tree view goes a long way towards that. Also included in this is a set of shortcuts that I have committed to muscle memory since the days when I was using SVN. Added them as aliases in git just made sense.

[user]
  name = YOUR_NAME
  email = YOUR_CENTRAL_REPO_USER_EMAIL
[core]
  excludesfile = ABSOLUTE_PATH_TO_HOME/.gitignore_global
[alias]
  # Make rebase safe on osx https://www.git-tower.com/blog/make-git-rebase-safe-on-osx/
  rebase = -c core.trustctime=false rebase

  # A couple of shortcuts because I used to use svn
  ci = commit
  co = checkout
  st = status

  # Log, but with tree, colors, and changed files list
  lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --name-status

  # Log, just with tree
  tree = log --graph --oneline --all --color --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit

  # Pull HEAD of master in all submodules
  sp = submodule foreach --recursive git fetch origin --tags && git checkout master && git pull
  
  # Initialize all submodules
  su = submodule update --init --recursive

  # Clone submodules when cloning a repository
  clone = clone --recurse

  # Words that are too long for me to bother with them
  br = branch
  ch = cherry-pick

  # Rebase local changes on top of anything you pull without nagging about local uncommitted changes
  pr = !git stash && git pull --rebase && git stash pop

  # Fast forward pull - should be the default imho
  pf = pull --ff-only

  # Set upstream when pushing - should be default imho
  pu = push -u

  # Merge without implicitly creating merge commits
  mf = merge --ff-only
  
  # Delete a remote branch
  bd = push origin --delete

[credential]
  # Use OSX keychain to remember passwords
  helper = osxkeychain

[push]
  # Assume that local branch name matches remote branch name
  default = current

[hub]
  # Use https for github (obviously)
  protocol = https

Raw .gitconfig

.gitignore_global

Why?

Because we specified it in .gitconfig and because everyone on OSX should ignore .DS_Store files.

# emacs backup file should always be ignored
*~

# OSX folder metadata is everywhere and should always be ignored
.DS_Store

# Xcode stores its state in this subfolder, and too many people forget to ignore it
*xcuserdata*

Raw .gitignore_global

.screenrc

Why?

Because telnet to a serial device by default doesn't provice the capabilities we are used to in a terminal. This allows us to scroll normally.

termcapinfo xterm* ti@:te@

Raw .screenrc

.ssh/config

Why?

# Keep connections alive by sending a null packet every 30 seconds
ServerAliveInterval 30
Host wedding
  User wedding
  HostName borch-andersen.dk
  # Allow editing remote files with rmate
  RemoteForward 52698 localhost:52698
Host magellanic
  User cyborch
  HostName magellanic.cyborch.com
  # Allow editing remote files with rmate
  RemoteForward 52698 localhost:52698

Raw .ssh/config