GithubHelp home page GithubHelp logo

dotfiles's Introduction

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:

dotfiles's People

Contributors

alrra avatar necolas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dotfiles's Issues

Automate installation of software

When running sync.sh I'd like to also do this:

  • Install homebrew, if missing DONE
  • Update homebrew & formula DONE
  • Install or upgrade Git via homebrew DONE
  • Install or upgrade MacVim and "override" system Vim via homebrew DONE
  • Install Node, npm, grunt, bower, DONE
  • Install Sass WONTFIX

And maybe echo to the terminal a reminder of the list of Apps I should install (using a flag when running the script):

  • Alfred App
  • Chrome
  • Chrome Canary
  • Divvy
  • Dropbox
  • Firefox
  • iTerm 2
  • ImageOptim
  • LimeChat
  • Opera
  • VLC
  • VirtualBox
  • ... etc

Error on first install

You may be aware of this already but when you install these dotfiles for the first time it will output a couple of errors because of missing files/dirs. Basically you have to clone the project (to $HOME/.dotfiles) before running the install otherwise it won't find the .dotfiles/ directory and the libs.

DOTFILES_DIRECTORY="${HOME}/.dotfiles"

# Won't work if you haven't cloned the repo beforehand
cd ${DOTFILES_DIRECTORY}

source ./lib/help
source ./lib/utils
source ./lib/brew
source ./lib/npm

One possible fix would be to tell the script to clone the repo directly before cding into it. But that will render the git check kind off needless. Another possible solution would be to move the lib/help and lib/utils directly into the bin/dotfiles, kinda like what I've done in my fork.

Tab completion.

Sorry, I'm not sure if this is the proper forum to ask this, but when I moved over to this dotfile setup today (which is great, BTW), I've noticed that pressing tab doesn't show the contents of the folder I'm cding into when I'm moving around the file system. I tried to bring some of the settings from my old bash_profile that seem to have done this on my old setup, but they don't seem to work here. I've tried putting them in both the inputrc and the bashrc file to no avail.

These were the settings I was trying to use:

bind '"\ep": history-search-backward'
bind '"\en": history-search-forward'
bind '"\C-w": backward-kill-word'
bind 'set completion-ignore-case on'
bind 'set completion-prefix-display-legnth 2'
bind 'set menu-complete'
bind 'set menu-complete-backward'
bind 'set show-all-if-ambiguous on'
bind 'set show-all-if-unmodified on'
bind 'set completion-map-case on'

I'm not sure which one does what I've described, but any input here would be greatly appreciated, as I'm still pretty new to all this command line kung-fu.

Thanks in advance.

Bash prompt username coloring issues in iTerm 2

Been spending a few days putting together all the dotfiles I want to use and love your color scheme and setup for the bash prompt! I grabbed your .bash_prompt and it all works perfectly in Terminal (10.7.4), but in iTerm 2 (Build 1.0.0.20120203), the username and machine name aren't colored properly. I'm using Solarized Dark and everything else looks fine. Here are two screenshots:

Terminal (10.7.4)

terminal

iTerm 2

iTerm

Even if I set iTerm 2 to Dark Background, the username and machine name are still gray.

Any idea what might be causing the issues in iTerm 2?

Backup existing dotfiles

Modify the install/update script so that it moves existing dotfiles into a timestamped backup dir rather than overwriting them.

See @cowboy's dotfiles for an example of this approach.

bash_prompt not using all colors

I'm using mathiasbynens/dotfiles but swapped his bash_prompt with yours. But the result I am getting is this: http://d.pr/dd69

Which doesn't quite match your screenshot. What did I screw up?

NOTE:

  • I am on OS X 10.6.8
  • I am bravely trying this stuff for the first time, as I am completely new to it all.

can this scripts work?

Hi, is it possible to do script for this settings? i search hard bud cant find

"Finder: items in the sidebar"

show Mac
hide iCloud/recents
defaults write com.apple.finder ShowRecentTags -bool false

"Settings-general-RecentItems - NONE"

"set F13(printScr) for save-screenshot-as-file"

"set Alt+F13(printScr) for save-pic-of-area-as-file"

"Mojave Settings-Update -ALL disable"

Inconsistent use of "logger" in backup script

Suspect it's a triviality...

Line 39 of backup uses $LOGGER to invoke the utility whereas everywhere else calls logger directly. I assume whichever way is the "right" way all the calls should be one or the other.

Cheers.

rsync install from Github produces 404 error (deprecated repo).

The homebrew-dupes repo has been deprecated, and it's causing the line below to produce an error.

brew install https://raw.github.com/Homebrew/homebrew-dupes/master/rsync.rb

curl: (22) The requested URL returned error: 404 Not Found
Error: Failure while executing; `/usr/bin/curl -q --show-error --user-agent Homebrew/1.9.2\ \(Macintosh\;\ Intel\ Mac\ OS\ X\ 10.14.2\)\ curl/7.54.0 --fail --progress-bar --location --remote-time --continue-at 0 --output /Users/USERNAME/Library/Caches/Homebrew/Formula/rsync.rb https://raw.github.com/Homebrew/homebrew-dupes/master/rsync.rb` exited with 22. Here's the output:

curl: (22) The requested URL returned error: 404 Not Found

The fix is to point to the homebrew-core repo. PR incoming.

Fix buggy console vim

The set lines setting is messing up the rendering in console vim:

Move the setting into .gvimrc

Bash Prompt doesn't break long commands into newlines.

I'm noticing that when I enter commands longer than one line, rather than breaking into a second line, it'll overwrite the existing line and wig everything out.

It happens on both OS X Lion with Terminal, and Snow Leopard using iTerm.

Remove some global node modules

Remove bower, grunt-cli, and karma.

I haven't used grunt for ages, but I prefer local installations and not having modules ask users to globally installed CLI tools that could just be mapped to a Makefile or npm-script

Did I just nuke my dotfiles?

Hadn't updated the dotfiles in a while. So I ran a git pull and I noticed that a lot of paths had changed from bash/ to shell/.

When I restarted Terminal, I lost all the nice colors. But remembered that some of the .dotfiles in my home directory weren't properly symlinked now that the paths had changed.

So I—mistakenly—thought the safest way to have all that stuff re-symlinked was to re-run the script bash -c "$(curl -fsSL raw.github.com/necolas/dotfiles/master/bin/dotfiles)"

I quit Terminal, and when I restarted, I was met with

-bash: $'\r': command not found
-bash: $'\r': command not found
-bash: /Users/rruiz/.bash_profile: line 8: syntax error near unexpected token `elif'
-bash: /Users/rruiz/.bash_profile: line 8: `elif infocmp xterm-256color >/dev/nu'l 2>&1; then

And to add insult to injury, nothing I enter in the command-line works. When I hit enter on anything, it gives me that Terminal error sound.

So I commented out everything in the .bash_profile, .bashrc, .inputrc files. And now when I restart Terminal I get

-bash: $'\r': command not found
-bash: $'\r': command not found
-bash: $'\r': command not found
-bash: $'\r': command not found
-bash: $'\r': command not found
-bash: $'\r': command not found

Again, nothing I enter in the command-line will work.

I'm able to run zsh if I change the shell in Terminal preferences, but I really want to fix this problem and I've run out of ideas.

Errors on fresh Yosemite beta?

I forked your dot files, changed the 2 URLs in /bin/dotfiles to point to my fork, then tried your installation instructions on a fresh install of Yosemite, with only Xcode command line tools, brew, and git pre-installed, but I get the errors:

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

Initializing git repository...
Initialized empty Git repository in /Users/ChristopherA/.dotfiles/.git/
The authenticity of host 'github.com (192.30.252.130)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added 'github.com,192.30.252.130' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: ambiguous argument 'FETCH_HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

From this point on the install continues with the installation of brew updates, etc., but eventually the script aborted at/with:

==> ./prepare-source
==> ./configure --prefix=/usr/local/Cellar/rsync/3.1.1 --with-rsyncd-conf=/usr/l
==> make
==> make install
🍺  /usr/local/Cellar/rsync/3.1.1: 8 files, 764K, built in 71 seconds

x Error: npm not found.
Aborting...
$

Any ideas on what I can do to fix this?

-- Christopher Allen

You could also show outstanding commits

Not a issue, maybe a "feature request", but I modified your .bash_prompt like so:

# Check for unstaged changes.
if ! $(git diff-files --quiet --ignore-submodules --); then
	s+="${red}!";
fi;
# Check for untracked files.
if [ -n "$(git ls-files --others --exclude-standard)" ]; then
	s+="${orange}?";
fi;
# Check for uncommitted changes in the index.
if ! $(git diff --quiet --ignore-submodules --cached); then
	s+="${green}+";
fi;
# Check for outstanding commits
if [ -n "$(git log --quiet --oneline origin/master..HEAD 2>/dev/null)" ]; then
	s+="${cyan}^";
fi;

I am a starter in bash scripting, but damn do I love that cyan ^ when I got unpushed commits.

Fix error during homebrew formula check

Due to using a URL here instead of a name.

Error: No such keg: /opt/twitter/Cellar/https://raw.github.com/Homebrew/homebrew-dupes/master/rsync.rb
! Missing formula: https://raw.github.com/Homebrew/homebrew-dupes/master/rsync.rb

Update install script to install xCode Command Line Tools automatically

Incase you were curious, xcode-select in Mac OS X 10.9 (Mavericks) comes with an --install flag that will prompt the user if xCode Command Line Tools is not installed. I had created a recursive script to check installation and continually attempt an install, but then realized that the latest version of Homebrew does this so much better. So you could attempt to install brew first and then have Homebrew install gcc via xCode. Just a thought.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.