From 5d86b2a1a903a0454a9af7d670912c5a9ef37b71 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 6 Mar 2021 22:31:37 -0500 Subject: [PATCH] Improve context in diff hunk headings Inspired by https://protesilaos.com/codelog/2021-01-26-git-diff-hunk-elisp-org/ --- config/git/attributes | 3 +++ config/git/config | 4 ++++ modules/shell/git.nix | 1 + 3 files changed, 8 insertions(+) create mode 100644 config/git/attributes diff --git a/config/git/attributes b/config/git/attributes new file mode 100644 index 00000000..a1bd92e5 --- /dev/null +++ b/config/git/attributes @@ -0,0 +1,3 @@ +*.lisp diff=lisp +*.el diff=lisp +*.org diff=org diff --git a/config/git/config b/config/git/config index 9fcfc1f8..067976a4 100644 --- a/config/git/config +++ b/config/git/config @@ -36,3 +36,7 @@ insteadOf = bb: [url "https://git.v0.com"] insteadOf = v0: +[diff "lisp"] + xfuncname = "^(((;;;+ )|\\(|([ \t]+\\(((cl-|el-patch-)?def(un|var|macro|method|custom)|gb/))).*)$" +[diff "org"] + xfuncname = "^(\\*+ +.*)$" diff --git a/modules/shell/git.nix b/modules/shell/git.nix index bce956fe..ba78cbe8 100644 --- a/modules/shell/git.nix +++ b/modules/shell/git.nix @@ -21,6 +21,7 @@ in { home.configFile = { "git/config".source = "${configDir}/git/config"; "git/ignore".source = "${configDir}/git/ignore"; + "git/attributes".source = "${configDir}/git/attributes"; }; modules.shell.zsh.rcFiles = [ "${configDir}/git/aliases.zsh" ];