forked from necolas/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4084e6f
Showing
21 changed files
with
573 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
vim/.netrwhist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[submodule "vim/bundle/vim-pathogen"] | ||
path = vim/bundle/vim-pathogen | ||
url = git://github.com/tpope/vim-pathogen.git | ||
|
||
[submodule "vim/bundle/vim-colors-solarized"] | ||
path = vim/bundle/vim-colors-solarized | ||
url = git://github.com/altercation/vim-colors-solarized.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
# Dotfiles | ||
|
||
My OS X dotfiles. | ||
|
||
## Getting started | ||
|
||
### Prerequisites | ||
|
||
* Git (1.7+) | ||
* Vim (7.3+ - I use MacVim installed with Homebrew) | ||
|
||
### Installation | ||
|
||
This will create symlinks for most of the files and the `vim` directory. | ||
The `.gitconfig` file is copied to the HOME directory so that any private git | ||
configuration taking place in `~/.extra` is not accidentally committed. | ||
|
||
``` | ||
git clone git://github.com/necolas/dotfiles.git ~/.dotfiles | ||
cd ~/.dotfiles | ||
bash boostrap.sh | ||
``` | ||
|
||
N.B. This will overwrite any existing dotfiles in your HOME and .vim | ||
directories that have the same names as those found in this repository. | ||
|
||
### Updating | ||
|
||
This must be done whenever you make a change to `.gitconfig` or pull | ||
from the remote repo. | ||
|
||
``` | ||
cd ~/.dotfiles | ||
bash boostrap.sh | ||
``` | ||
|
||
|
||
## Adding custom commands | ||
|
||
You can use a `~/.extra` file to add custom commands without the need to fork | ||
this repository, or to add commands that you don’t want to commit to a public | ||
repository. If `~/.extra` exists, it will be sourced for inclusion in | ||
`bash_profile`. | ||
|
||
Here is an example `~/.extra`: | ||
|
||
``` | ||
# 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 these credentials in ~/.gitconfig | ||
git config --global user.name "$GIT_AUTHOR_NAME" | ||
git config --global user.email "$GIT_AUTHOR_EMAIL" | ||
``` | ||
|
||
|
||
## Custom OS X defaults | ||
|
||
When setting up a new Mac, you may want to customise your OS X defaults after | ||
installing the dotfiles. | ||
|
||
``` | ||
bash .osx | ||
``` | ||
|
||
|
||
## 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 git://example.com/remote/path/to/repo.git vim/bundle/one-submodule | ||
# Initialize the submodule | ||
git submodule init | ||
# Clone the submodule | ||
git submodule update | ||
# 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: | ||
|
||
[@mathiasbynens](https://github.com/mathiasbynens) (Mathias Bynens) [https://github.com/mathiasbynens/dotfiles](https://github.com/mathiasbynens/dotfiles) | ||
[@tejr](https://github.com/tejr) (Tom Ryder) [https://github.com/tejr/dotfiles](https://github.com/tejr/dotfiles) | ||
[@gf3](https://github.com/gf3) (Gianni Chiappetta) [https://github.com/gf3/dotfiles](https://github.com/gf3/dotfiles) | ||
[@cowboy](https://github.com/cowboy) (Ben Alman) [https://github.com/cowboy/dotfiles](https://github.com/cowboy/dotfiles) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# aliases | ||
|
||
# Easier navigation: .., ..., ~ and - | ||
alias ..="cd .." | ||
alias ...="cd ../.." | ||
alias ~="cd ~" | ||
alias -- -="cd -" | ||
|
||
# List dir contents aliases | ||
# ref: http://ss64.com/osx/ls.html | ||
# Long form no user group, color | ||
alias l="ls -oG" | ||
# Order by last modified, long form no user group, color | ||
alias lt="ls -toG" | ||
# List all except . and ..., color, mark file types, long form no user group, file size | ||
alias la="ls -AGFoh" | ||
# List all except . and ..., color, mark file types, long form no use group, order by last modified, file size | ||
alias lat="ls -AGFoth" | ||
|
||
# Concatenate and print content of files (add line numbers) | ||
alias catn="cat -n" | ||
|
||
# IP addresses | ||
alias ip="dig +short myip.opendns.com @resolver1.opendns.com" | ||
alias localip="ipconfig getifaddr en1" | ||
|
||
# Flush DNS cache | ||
alias flushdns="dscacheutil -flushcache" | ||
|
||
# Empty the Trash on all mounted volumes and the main HDD | ||
# Also, clear Apple’s System Logs to improve shell startup speed | ||
alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl" | ||
|
||
# Recursively delete `.DS_Store` files | ||
alias cleanup="find . -type f -name '*.DS_Store' -ls -delete" | ||
|
||
# Show/hide hidden files in Finder | ||
alias showdotfiles="defaults write com.apple.Finder AppleShowAllFiles -bool true && killall Finder" | ||
alias hidedotfiles="defaults write com.apple.Finder AppleShowAllFiles -bool false && killall Finder" | ||
|
||
# Hide/show all desktop icons (useful when presenting) | ||
alias showdeskicons="defaults write com.apple.finder CreateDesktop -bool true && killall Finder" | ||
alias hidedeskicons="defaults write com.apple.finder CreateDesktop -bool false && killall Finder" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# .bash_profile | ||
|
||
# Custom and private settings (e.g. git credentials) | ||
[ -r "$HOME/.extra" ] && source "$HOME/.extra" | ||
# Exports | ||
[ -r "$HOME/.dotfiles/exports" ] && source "$HOME/.dotfiles/exports" | ||
# Aliases | ||
[ -r "$HOME/.dotfiles/aliases" ] && source "$HOME/.dotfiles/aliases" | ||
# Custom bash prompt | ||
[ -r "$HOME/.dotfiles/bash_prompt" ] && source "$HOME/.dotfiles/bash_prompt" | ||
|
||
# Append to the bash history file, rather than overwriting it | ||
shopt -s histappend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# bash_prompt | ||
|
||
# Based on @gf3’s Sexy Bash Prompt: https://github.com/gf3/dotfiles | ||
# iTerm2 prefs: import Solarized theme (disable bright colors for bold text) | ||
# Screenshot: http://i.imgur.com/1e2cE.png | ||
# Color ref: http://vim.wikia.com/wiki/Xterm256_color_names_for_console_Vim | ||
|
||
# Check that terminfo exists before changing TERM var to xterm-256color | ||
# Prevents prompt flashing in Mac OS X 10.6 Terminal.app | ||
if [ -e /usr/share/terminfo/x/xterm-256color ]; then | ||
export TERM='xterm-256color' | ||
fi | ||
|
||
tput sgr 0 0 | ||
|
||
# Solarized colors | ||
# https://github.com/altercation/solarized/tree/master/iterm2-colors-solarized | ||
SOLAR_YELLOW=$(tput setaf 136) | ||
SOLAR_ORANGE=$(tput setaf 166) | ||
SOLAR_RED=$(tput setaf 124) | ||
SOLAR_MAGENTA=$(tput setaf 125) | ||
SOLAR_VIOLET=$(tput setaf 61) | ||
SOLAR_BLUE=$(tput setaf 33) | ||
SOLAR_CYAN=$(tput setaf 37) | ||
SOLAR_GREEN=$(tput setaf 64) | ||
SOLAR_WHITE=$(tput setaf 254) | ||
|
||
BOLD=$(tput bold) | ||
RESET=$(tput sgr0) | ||
|
||
function parse_git_dirty() { | ||
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | ||
} | ||
|
||
function parse_git_branch() { | ||
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/" | ||
} | ||
|
||
# More tips: http://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html | ||
PS1="\n\[${BOLD}${SOLAR_ORANGE}\]\u\[$SOLAR_WHITE\]@\[$SOLAR_YELLOW\]\h\[$SOLAR_WHITE\]: \[$SOLAR_GREEN\]\w\[$SOLAR_WHITE\]\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on \")\[$SOLAR_CYAN\]\$(parse_git_branch)\[$SOLAR_WHITE\]\n\$ \[$RESET\]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# .bashrc | ||
|
||
[ -n "$PS1" ] && source ~/.bash_profile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
cd "${HOME}/.dotfiles" | ||
|
||
# Pull down the latest changes | ||
#git pull | ||
# Check out submodules | ||
git submodule --quiet update --init | ||
|
||
cd "${OLDPWD}" | ||
|
||
function mirrorfiles() { | ||
# Copy .gitconfig | ||
# Any global git commands in ~/.extra will be written to .gitconfig | ||
# This prevents them being committed to the repository | ||
rsync -avz --quiet ${HOME}/.dotfiles/gitconfig ${HOME}/.gitconfig | ||
|
||
# Symlink everything else | ||
# bash_profile sources other files from the repository | ||
# Force remove the vim directory if it is already there | ||
if [ -e "${HOME}/.vim" ]; then | ||
rm -rf "${HOME}/.vim" | ||
fi | ||
ln -fs ".dotfiles/vim" "${HOME}/.vim" | ||
ln -fs ".dotfiles/bashrc" "${HOME}/.bashrc" | ||
ln -fs ".dotfiles/bash_profile" "${HOME}/.bash_profile" | ||
ln -fs ".dotfiles/inputrc" "${HOME}/.inputrc" | ||
ln -fs ".dotfiles/osx" "${HOME}/.osx" | ||
ln -fs ".dotfiles/gitattributes" "${HOME}/.gitattributes" | ||
ln -fs ".dotfiles/gitignore" "${HOME}/.gitignore" | ||
ln -fs ".dotfiles/gvimrc" "${HOME}/.gvimrc" | ||
ln -fs ".dotfiles/vimrc" "${HOME}/.vimrc" | ||
|
||
echo "Dotfiles update complete" | ||
} | ||
|
||
read -p "This will overwrite some existing files in your home directory. Are you sure? (y/n) " -n 1 | ||
echo | ||
if [[ $REPLY =~ ^[Yy]$ ]]; then | ||
mirrorfiles | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Exports | ||
|
||
# Make vim the default editor | ||
export EDITOR="vim" | ||
# Don't clear the screen after quitting a manual page | ||
export MANPAGER="less -X" | ||
# Larger bash history (allow 32³ entries; default is 500) | ||
export HISTSIZE=32768 | ||
export HISTFILESIZE=$HISTSIZE | ||
export HISTCONTROL=ignoredups | ||
# Make some commands not show up in history | ||
export HISTIGNORE="ls:ls *:cd:cd -:pwd;exit:date:* --help" | ||
|
||
# if these bins exist, then add them to the PATH | ||
[ -d "/usr/bin" ] && PATH="$PATH:/usr/bin"; | ||
[ -d "/usr/local/bin" ] && PATH="$PATH:/usr/local/bin"; | ||
# if the current user has a ~/bin, then add it to the PATH | ||
[ -d "$HOME/bin" ] && PATH="$PATH:$HOME/bin"; | ||
|
||
export PATH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Automatically normalize line endings for all text-based files | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[alias] | ||
# https://git.wiki.kernel.org/articles/a/l/i/Aliases.html | ||
# Diff what is staged for the next commit | ||
diffc = diff --cached | ||
# Diff overview | ||
diffst = diff --stat | ||
# tut: http://gitimmersion.com/lab_10.html | ||
# ref: http://linux.die.net/man/1/git-log | ||
# Custom graph log | ||
graph = log --pretty=format:'%C(yellow)%h%C(reset) %ar | %s%C(green)%d%C(reset) [%an]' --all --graph --date-order | ||
# Custom pretty log | ||
logp = log --pretty=format:'%C(yellow)%h%C(reset) %ar | %s%C(green)%d%C(reset) [%an]' --all --date-order | ||
# Diffstat log | ||
logst = log --stat | ||
# Short format diffstat log | ||
logsf = log --stat --format=oneline --abbrev-commit | ||
|
||
[color] | ||
# color opts: normal, black, red, green, yellow, blue, magenta, cyan, or white | ||
ui = auto | ||
interactive = auto | ||
|
||
[core] | ||
# Use custom `.gitignore` and `.gitattributes` | ||
excludesfile = ~/.gitignore | ||
attributesfile = ~/.gitattributes | ||
|
||
[diff] | ||
tool = mvimdiff | ||
|
||
[difftool] | ||
prompt = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# OS or Editor files | ||
.DS_Store | ||
._* | ||
Thumbs.db | ||
|
||
# Files that might appear on external disks | ||
.Spotlight-V100 | ||
.Trashes | ||
|
||
# Always-ignore extensions | ||
*.diff | ||
*.err | ||
*.orig | ||
*.log | ||
*.rej | ||
*.swo | ||
*.swp | ||
*.vi | ||
*~ | ||
*.sass-cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
" .gvimrc | ||
|
||
" Hide the MacVIm toolbar | ||
set go-=T | ||
" Always display the tab bar | ||
set showtabline | ||
" Turn off the blinking cursor in normal mode | ||
set gcr=n:blinkon0 | ||
" Set 6px space between lines | ||
set linespace=5 | ||
" Set GUI font | ||
set guifont=Consolas:h14 |
Empty file.
Oops, something went wrong.