Skip to content

Instantly share code, notes, and snippets.

@amalloy
Created April 10, 2017 16:56
Show Gist options
  • Save amalloy/ea5eada8a5bffc722b9ba8e44b7d5e2c to your computer and use it in GitHub Desktop.
Save amalloy/ea5eada8a5bffc722b9ba8e44b7d5e2c to your computer and use it in GitHub Desktop.
Clojure-aware git-diff hunk headers
*.clj diff=clojure
*.cljs diff=clojure
*.cljx diff=clojure
git config --global core.attributesfile ~/.gitattributes
git config --global diff.clojure.xfuncname '(^\(.*|\s*\(defn.*)'
@agzam
Copy link

agzam commented Nov 3, 2018

That regex can be extended to be used for so many more forms 😄 defmacro, defmethod.deftest. etc.

@kawas44
Copy link

kawas44 commented Mar 1, 2022

Nowadays, you don't need to use a custom ~/.gitattributes file.
You can save this file in the default location ~/.config/git/attributes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment