Skip to content

Instantly share code, notes, and snippets.

@mattboehm
mattboehm / gist:9977950
Created April 4, 2014 16:15
A mini-plugin to cycle through diffs of unstaged git changes by file (requires fugitive)
nnoremap <silent> <leader>gm :tab split<CR>:Glistmod<CR>
nnoremap <silent> <c-s-j> :call g:DiffNextLoc()<CR>
nnoremap <silent> <c-s-k> :call g:DiffPrevLoc()<CR>
command! Glistmod only | call g:ListModified() | Gdiff
function! g:ListModified()
let old_makeprg=&makeprg
let old_errorformat=&errorformat
let &makeprg = "git ls-files -m"
let &errorformat="%f"
@robmiller
robmiller / .gitconfig
Last active May 20, 2020 13:45
Want to find out what changes were introduced by a particular merge commit? Hey, so do I! ALL THE TIME. These aliases will do that.
# `git merge-log` shows the commits that were introduced in a given merge
# `git merge-diff` shows the actual changes that were introduced by a given merge
# Both commands accept an optional commitish; if ommitted, the last merge commit is used
merge-span = "!f() { echo $(git log -1 $2 --merges --pretty=format:%P | cut -d' ' -f1)$1$(git log -1 $2 --merges --pretty=format:%P | cut -d' ' -f2); }; f"
merge-log = "!git log `git merge-span .. $1`"
merge-diff = "!git diff `git merge-span ... $1`"
merge-difftool = "!git difftool `git merge-span ... $1`"
@jdp
jdp / Makefile
Created August 31, 2012 06:07
Use Makefiles for CoffeeScript, Handlebars, and Sass
COFFEEC = coffee
SASSC = sass
HANDLEBARSC = handlebars
# Build app package
APPSRC = static/scripts/main.coffee
APPOBJ = ${APPSRC:.coffee=.js}
APPOUT = static/scripts/app.js
@netmute
netmute / init.vim
Last active October 17, 2019 11:20
init.vim
" PLEASE NOTE: I'm assuming nvim defaults in this configuration.
" Regular vimmers might need to tweak here and there.
" Add autogenerated tags file to the lookup path.
set tags+=.git/tags
" Add fzf plugin.
set rtp+=/usr/local/opt/fzf
" Use a source for FZF that respects '.gitignore'.
@esperlu
esperlu / mysql2sqlite.sh
Created April 27, 2011 05:46
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@tobias
tobias / run_tags.rb
Created January 1, 2009 16:44
A script for generating TAGS from a git hook.
#!/usr/bin/ruby
#-*-ruby-*-
# A script to run ctags on all .rb files in a project. Can be run on
# the current dir, called from a git callback, or install itself as a
# git post-merge and post-commit callback.
CTAGS = '/opt/local/bin/ctags'
HOOKS = %w{ post-merge post-commit post-checkout }
HOOKS_DIR = '.git/hooks'