Skip to content

Instantly share code, notes, and snippets.

@chussenot
Forked from changa/.gitconfig
Last active August 29, 2015 13:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chussenot/9625798 to your computer and use it in GitHub Desktop.
Save chussenot/9625798 to your computer and use it in GitHub Desktop.
My configuration
alias be="bundle exec"
alias ll="ls -la"
alias g='git'
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
PATH=$PATH:/usr/local/bin
PATH=$PATH:/usr/local/sbin # to load nginx
#### Git
GIT_PS1_SHOWDIRTYSTATE=1
GIT_PS1_SHOWUNTRACKEDFILES=1
GIT_PS1_SHOWSTASHSTATE=1
GIT_PS1_SHOWUPSTREAM="verbose"
__git_ps1(){
g=$(cat .git/HEAD 2>/dev/null) && {
# 4e06e218e230a86608637b613499984703a342cf
# ref: refs/heads/master
test ${#g} = 40 && g=${g:0:7} || g=${g##*/}
printf "($g)"
}
}
function __git_branch {
__git_ps1 " %s"
}
function __my_ruby_version {
local gemset=$(rbenv gemset active | cut -d ' ' -f 1)
[ "$gemset" != "" ] && gemset="@$gemset"
local version=$(rbenv version 2>/dev/null | cut -d ' ' -f 1)
[ "$version" == "1.8.7" ] && version=""
local full="$version$gemset"
[ "$full" != "" ] && echo "$full|"
}
bash_prompt() {
local NONE="\[\033[0m\]" # unsets color to term's fg color
# regular colors
local K="\[\033[0;30m\]" # black
local R="\[\033[0;31m\]" # red
local G="\[\033[0;32m\]" # green
local Y="\[\033[0;33m\]" # yellow
local B="\[\033[0;34m\]" # blue
local M="\[\033[0;35m\]" # magenta
local C="\[\033[0;36m\]" # cyan
local W="\[\033[0;37m\]" # white
# emphasized (bolded) colors
local EMK="\[\033[1;30m\]"
local EMR="\[\033[1;31m\]"
local EMG="\[\033[1;32m\]"
local EMY="\[\033[1;33m\]"
local EMB="\[\033[1;34m\]"
local EMM="\[\033[1;35m\]"
local EMC="\[\033[1;36m\]"
local EMW="\[\033[1;37m\]"
# background colors
local BGK="\[\033[40m\]"
local BGR="\[\033[41m\]"
local BGG="\[\033[42m\]"
local BGY="\[\033[43m\]"
local BGB="\[\033[44m\]"
local BGM="\[\033[45m\]"
local BGC="\[\033[46m\]"
local BGW="\[\033[47m\]"
local UC=$W # user's color
[ $UID -eq "0" ] && UC=$R # root's color
# Only show hostname when connected with SSH
if [ -z "${SSH_CONNECTION}" ] ; then
PS1="$B\$(__my_ruby_version)$Y\u$G:$EMY\w$EMG\$(__git_branch)${NONE} $ "
else
PS1="$B\$(__my_ruby_version)$Y\u@\h$G:$EMY\w$EMG\$(__git_branch)${NONE} $ "
fi
}
bash_prompt
unset bash_prompt
if [ -f ~/.bash_aliases ]; then
source ~/.bash_aliases
fi
[core]
excludesfile = /Users/chussenot/.gitignore_global
[diff]
color = true
[alias]
; shortcuts
st = status
a = add
ap = add -p
ci = commit
b = branch -vvv
br = branch
co = checkout
rso = remote show origin
ca = commit --reuse-message=HEAD
cia = commit --reedit-message=HEAD
rbc = rebase --continue
mt = mergetool
fa = fetch --all
pr = pull --rebase
pa = pull --all
cpk = cherry-pick
d = diff
ds = diff --staged
wd = diff --word-diff
; log aliases
logp = log -v --graph -p
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative --branches=*
lgs = log --stat --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative --branches=*
ll = log ORIG_HEAD..HEAD --pretty=oneline
;; my commits
mylogp = "!git logp --author=\"`git config --get user.name`\""
mylg = "!git lg --author=\"`git config --get user.name`\""
mylgs = "!git lgs --author=\"`git config --get user.name`\""
; all new commits after you fetched, with stats, but excluding merges
lc = log ORIG_HEAD.. --stat --no-merges
msg = commit --allow-empty -m
unstage = reset HEAD --
u = reset HEAD --
last = log -1 HEAD
visual = !qgit4
; Simple diff wrappers
changes = diff --name-status -r
diffstat = diff --stat -r
; Spelunking of the project's history
whois = "!sh -c 'git log -i -1 --pretty=\"format:%an <%ae>\n\" --author=\"$1\"' -"
whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short
; list aliases
aliases = !git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /' | sort
; Editing/adding conflicted files
edit-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; vim `f`"
add-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; git add `f`"
; List ignored files
ls-ignored = ls-files --exclude-standard --ignored --others
; List untracked files
ls-untracked = ls-files --others --exclude-standard
# List modified files
ls-modified = ls-files --modified
open-untracked = !git ls-untracked | xargs gvim --remote-tab
open-modified = !git ls-modified | xargs gvim --remote-tab
irb = rebase --interactive
undo = reset --soft HEAD^
;[apply]
;whitespace = nowarn
[color]
branch = auto
diff = auto
status = auto
interactive = auto
ui = auto
pager = true
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
[merge]
tool = meld
stat = true
[merge "bundleinstall"]
name = bundle install
driver = bundle install
[diff "zip"]
textconv = unzip -c -a
[diff "jpg"]
textconv = exiftool
cachetextconv = true
[core]
editor = vim
pager = less -FRSX
excludesfile = ~/.mydotfiles/gitexcludes
[push]
default = tracking
[branch]
; When a new branch is created with git branch or git checkout that tracks
; another branch, this variable tells git to set up pull to rebase instead of
; merge (see "branch.<name>.rebase"). When never, rebase is never automatically
; set to true. When local, rebase is set to true for tracked branches of other
; local branches. When remote, rebase is set to true for tracked branches of
; remote-tracking branches. When always, rebase will be set to true for all
; tracking branches.
autosetuprebase = remote
# See http://robots.thoughtbot.com/post/27695057156/clone-me-maybe
[url "git://github.com/"]
# Read-only
insteadOf = gh:
# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
# Logs and databases #
######################
*.log
*.sql
*.sqlite
# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
# Our .tmux.conf file
# Setting the prefix from C-b to C-a
# START:prefix
set -g prefix C-a
# END:prefix
# Free the original Ctrl-b prefix keybinding
# START:unbind
unbind C-b
# END:unbind
###########################################################################
# General options
# Default termtype. If the rcfile sets $TERM, that overrides this value.
set -g default-terminal screen-256color
# Ring the bell if any background window rang a bell
set -g bell-action any
# Watch for activity in background windows
setw -g monitor-activity on
# scrollback size
set -g history-limit 10000
# set first window to index 1 (not 0) to map more to the keyboard layout
set -g base-index 1
setw -g pane-base-index 1
# pass through xterm keys
set -g xterm-keys on
###########################################################################
# General keymap
# Keep your finger on ctrl, or don't, same result
bind-key ^D detach-client
bind-key ^C new-window
# Redraw the client (if interrupted by wall, etc)
bind R refresh-client
# reload tmux config
unbind r
bind r \
source-file ~/.tmux.conf \;\
display 'Reloaded tmux config.'
# Use vi keybindings for tmux commandline input.
# Note that to get command mode you need to hit ESC twice...
set -g status-keys emacs
# Use vi keybindings in copy and choice modes
setw -g mode-keys vi
###########################################################################
# Window management / navigation
# move between windows
bind-key ^N next-window
bind-key ^P previous-window
# ^\ (no prefix) to skip to last window we were in before this one
bind -n "^\\" last-window
###########################################################################
# Pane management / navigation
# Horizontal splits with s or ^S
unbind s
unbind ^S
bind-key s split-window
bind-key ^S split-window
# Vertical split with v or ^V
unbind v
unbind ^V
bind-key v split-window -h
bind-key ^V split-window -h
# navigation with ctrl-{h,j,k,l} -- NO PREFIX
# https://gist.github.com/mislav/5189704
bind -n ^K run-shell 'tmux-vim-select-pane -U'
bind -n ^J run-shell 'tmux-vim-select-pane -D'
bind -n ^H run-shell 'tmux-vim-select-pane -L'
bind -n ^L run-shell 'tmux-vim-select-pane -R'
# Pane resize in all four directions using vi bindings.
# Can use these raw but I map them to Cmd-Opt-<h,j,k,l> in iTerm2.
# http://tangledhelix.com/blog/2012/04/28/iterm2-keymaps-for-tmux/
# Note on a few prefix options: ^A = 0x01, ^B = 0x02, ^G = 0x06
bind-key J resize-pane -D
bind-key K resize-pane -U
bind-key H resize-pane -L
bind-key L resize-pane -R
# easily toggle synchronization (mnemonic: e is for echo)
# sends input to all panes in a given window.
bind e setw synchronize-panes on
bind E setw synchronize-panes off
###########################################################################
# Scrollback / pastebuffer
# Vim-style copy/paste
unbind [
bind y copy-mode
unbind p
bind p paste-buffer
bind -t vi-copy v begin-selection
bind -t vi-copy y copy-selection
bind -t vi-copy Escape cancel
###########################################################################
# Mouse mode
set -g mode-mouse on
set -g mouse-resize-pane on
set -g mouse-select-pane on
set -g mouse-select-window on
# Toggle mouse on
bind m \
set -g mode-mouse on \;\
set -g mouse-resize-pane on \;\
set -g mouse-select-pane on \;\
set -g mouse-select-window on \;\
display 'Mouse: ON'
# Toggle mouse off
bind M \
set -g mode-mouse off \;\
set -g mouse-resize-pane off \;\
set -g mouse-select-pane off \;\
set -g mouse-select-window off \;\
display 'Mouse: OFF'
###########################################################################
# Color scheme (Solarized light)
# default statusbar colors
set-option -g status-bg colour231 #base2
set-option -g status-fg colour130 #yellow
set-option -g status-attr default
# default window title colors
set-window-option -g window-status-fg colour180 #base00
set-window-option -g window-status-bg default
# active window title colors
set-window-option -g window-status-current-fg colour196 #orange
set-window-option -g window-status-current-bg default
# pane border
set-option -g pane-active-border-fg black
set-option -g pane-active-border-bg white
set-option -g pane-border-fg brightcyan
set-option -g pane-border-bg default
# message text
set-option -g message-bg colour231 #base2
set-option -g message-fg colour196 #orange
# pane number display
set-option -g display-panes-active-colour colour20 #blue
set-option -g display-panes-colour colour196 #orange
# clock
set-window-option -g clock-mode-colour colour40 #green
###########################################################################no active gemsets
# Install command-line tools using Homebrew
# Usage: `brew bundle Brewfile`
# Make sure we’re using the latest Homebrew
update
# Upgrade any already-installed formulae
upgrade
# Install GNU core utilities (those that come with OS X are outdated)
# Don’t forget to add `$(brew --prefix coreutils)/libexec/gnubin` to `$PATH`.
install coreutils
# Install some other useful utilities like `sponge`
install moreutils
# Install GNU `find`, `locate`, `updatedb`, and `xargs`, `g`-prefixed
install findutils
# Install GNU `sed`, overwriting the built-in `sed`
install gnu-sed --default-names
# Install Bash 4
# Note: don’t forget to add `/usr/local/bin/bash` to `/etc/shells` before running `chsh`.
install bash
install bash-completion
# Install wget with IRI support
install wget --enable-iri
# Install more recent versions of some OS X tools
install vim --override-system-vi
install homebrew/dupes/grep
install homebrew/dupes/screen
# Install other useful binaries
install ack
install bfg
#install exiv2
install foremost
install git
install hashpump
install imagemagick --with-webp
install lynx
install nmap
install node # This installs `npm` too using the recommended installation method
install p7zip
install pigz
install pv
install rename
install rhino
install sqlmap
install tree
install ucspi-tcp # `tcpserver` et al.
install webkit2png
install zopfli
install homebrew/versions/lua52
install tig
install tmux
install the_silver_searcher
install git-extras
install maven
install nginx
# Ruby
install rbenv
install ruby-build
install rbenv-gemset
# Remove outdated versions from the cellar
cleanup
# Install native apps
# Usage: `brew bundle Caskfile`
install caskroom/cask/brew-cask
tap caskroom/versions
cask install dropbox 2> /dev/null
cask install google-chrome 2> /dev/null
cask install google-chrome-canary 2> /dev/null
cask install imagealpha 2> /dev/null
cask install imageoptim 2> /dev/null
cask install iterm2 2> /dev/null
cask install macvim 2> /dev/null
cask install miro-video-converter 2> /dev/null
cask install opera 2> /dev/null
cask install opera-developer 2> /dev/null
cask install opera-next 2> /dev/null
cask install sublime-text 2> /dev/null
cask install the-unarchiver 2> /dev/null
cask install torbrowser 2> /dev/null
cask install transmission 2> /dev/null
cask install ukelele 2> /dev/null
cask install virtualbox 2> /dev/null
cask install vlc 2> /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment