• Stars
    star
    785
  • Rank 57,957 (Top 2 %)
  • Language
    Shell
  • License
    MIT License
  • Created almost 13 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

OS X dotfiles: bash, git, vim, etc.

Dotfiles (Nicolas Gallagher)

My OS X dotfiles.

How to install

The installation step requires the XCode Command Line Tools and may overwrite existing dotfiles in your HOME and .vim directories.

$ bash -c "$(curl -fsSL raw.github.com/necolas/dotfiles/master/bin/dotfiles)"

N.B. If you wish to fork this project and maintain your own dotfiles, you must substitute my username for your own in the above command and the 2 variables found at the top of the bin/dotfiles script.

How to update

You should run the update when:

  • You make a change to ~/.dotfiles/git/gitconfig (the only file that is copied rather than symlinked).
  • You want to pull changes from the remote repository.
  • You want to update Homebrew formulae and Node packages.

Run the dotfiles command:

$ dotfiles

Options:

-h, --help Help
-l, --list List of additional applications to install
--no-packages Suppress package updates
--no-sync Suppress pulling from the remote repository

Features

Automatic software installation

Homebrew formulae:

Node packages:

Vim plugins:

Custom OS X defaults

Custom OS X settings can be applied during the dotfiles process. They can also be applied independently by running the following command:

$ osxdefaults

Bootable backup-drive script

These dotfiles include a script that uses rsync to incrementally back up your data to an external, bootable clone of your computer's internal drive. First, make sure that the value of DST in the bin/backup script matches the name of your backup-drive. Then run the following command:

$ backup

For more information on how to setup your backup-drive, please read the preparatory steps in this post on creating a Mac OS X bootable backup drive.

Custom bash prompt

I use a custom bash prompt based on the Solarized color palette and influenced by @gf3's and @cowboy's custom prompts. For best results, you should install iTerm2 and import Solarized Dark.itermcolors.

When your current working directory is a Git repository, the prompt will display the checked-out branch's name (and failing that, the commit SHA that HEAD is pointing to). The state of the working tree is reflected in the following way:

+ Uncommitted changes in the index
! Unstaged changes
? Untracked files
$ Stashed files

Further details are in the bash_prompt file.

Screenshot:

Local/private Bash and Vim configuration

Any special-case Vim directives local to a machine should be stored in a ~/.vimrc.local file on that machine. The directives will then be automatically imported into your master .vimrc.

Any private and custom Bash commands and configuration should be placed in a ~/.bash_profile.local file. This file will not be under version control or committed to a public repository. If ~/.bash_profile.local exists, it will be sourced for inclusion in bash_profile.

Here is an example ~/.bash_profile.local:

# PATH exports
PATH=$PATH:~/.gem/ruby/1.8/bin
export PATH

# Git credentials
# Not under version control to prevent people from
# accidentally committing with your details
GIT_AUTHOR_NAME="Nicolas Gallagher"
GIT_AUTHOR_EMAIL="[email protected]"
GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
# Set the credentials (modifies ~/.gitconfig)
git config --global user.name "$GIT_AUTHOR_NAME"
git config --global user.email "$GIT_AUTHOR_EMAIL"

# Aliases
alias code="cd ~/Code"

N.B. Because the git/gitconfig file is copied to ~/.gitconfig, any private git configuration specified in ~/.bash_profile.local will not be committed to your dotfiles repository.

Custom location for Homebrew installation

If your Homebrew installation is not in /usr/local then you must prepend your custom installation's bin to the PATH in a file called ~/.dotfilesrc:

# Add `brew` command's custom location to PATH
PATH="/opt/acme/bin:$PATH"

Adding new git submodules

If you want to add more git submodules, e.g., Vim plugins to be managed by pathogen, then follow these steps while in the root of the superproject.

# Add the new submodule
git submodule add https://example.com/remote/path/to/repo.git vim/bundle/one-submodule
# Initialize and clone the submodule
git submodule update --init
# Stage the changes
git add vim/bundle/one-submodule
# Commit the changes
git commit -m "Add a new submodule: one-submodule"

Updating git submodules

Updating individual submodules within the superproject:

# Change to the submodule directory
cd vim/bundle/one-submodule
# Checkout the desired branch (of the submodule)
git checkout master
# Pull from the tip of master (of the submodule - could be any sha or pointer)
git pull origin master
# Go back to main dotfiles repo root
cd ../../..
# Stage the submodule changes
git add vim/bundle/one-submodule
# Commit the submodule changes
git commit -m "Update submodule 'one-submodule' to the latest version"
# Push to a remote repository
git push origin master

Now, if anyone updates their local repository from the remote repository, then using git submodule update will update the submodules (that have been initialized) in their local repository. N.B This will wipe away any local changes made to those submodules.

Acknowledgements

Inspiration and code was taken from many sources, including:

More Repositories

1

normalize.css

A modern alternative to CSS resets
CSS
52,285
star
2

react-native-web

Cross-platform React UI packages
JavaScript
21,553
star
3

idiomatic-css

Principles of writing consistent, idiomatic CSS.
6,641
star
4

css3-facebook-buttons

Simple CSS to recreate the appearance of Facebook's buttons and toolbars.
CSS
577
star
5

idiomatic-html

Principles of writing consistent, idiomatic HTML.
525
star
6

css3-social-signin-buttons

CSS3 Social Sign-in Buttons with icons. Small and large sizes.
CSS
475
star
7

issue-guidelines

A set of guidelines for submitting issues and pull requests on projects
426
star
8

griddle

A CSS grid constructor
CSS
367
star
9

styleq

styleQ is a quick, small JavaScript runtime for merging the HTML class names produced by CSS compilers.
JavaScript
185
star
10

icon-builder-example

JavaScript
148
star
11

xdm.js

JSON-RPC 2.0 cross-domain communication over postMessage
JavaScript
89
star
12

emitter.js

A simple JavaScript event-emitter
JavaScript
85
star
13

jekyll-boilerplate

A jekyll starting point.
HTML
73
star
14

generator-jsmodule

A Yeoman generator to scaffold out a simple JS module for Node.js or the browser
JavaScript
68
star
15

chrome-tab-limit

Chrome browser extension that limits you to 20 open tabs
JavaScript
53
star
16

suit-grid-layouts

DEPRECATED
HTML
45
star
17

delegate.js

DOM event delegation component
JavaScript
45
star
18

project-euler

JavaScript solutions to the Project Euler problems.
JavaScript
44
star
19

custom-tweet-button-for-wordpress

A fully customisable HTML and CSS Tweet Button for Wordpress. Built using PHP; no JavaScript requirement. Uses the bit.ly and Twitter APIs.
PHP
36
star
20

dom-shims

Complete and well-tested shims / polyfills for various DOM API's missing in not-so-modern browsers
JavaScript
34
star
21

eraser.css

CSS `!important`-fueled bulldozer
CSS
29
star
22

newsriver-ui

User interface for displaying a river of news generated by Dave Winer's River2 software.
JavaScript
27
star
23

dom-closest

For a given DOM element, find the first ancestor that matches a given CSS selector.
JavaScript
22
star
24

event-shim.js

A W3C DOM Event API shim for IE 8
JavaScript
20
star
25

dom-matches

Check if a DOM element matches a given selector.
JavaScript
19
star
26

dom-insert-html

HTML-string DOM insertion methods using 'insertAdjacentHTML'
JavaScript
13
star
27

matches.js

DEPRECATED
JavaScript
12
star
28

dom-siblings

Find a DOM element's siblings, optionally filtered by a CSS selector.
JavaScript
11
star
29

dom-insert

DOM insertion methods.
JavaScript
10
star
30

dom-responder-events

4
star
31

flight-mustache

A Flight component for rendering Mustache templates with mustache.js
JavaScript
2
star
32

webpack-bugs

JavaScript
1
star