summaryrefslogtreecommitdiff
path: root/home
diff options
context:
space:
mode:
Diffstat (limited to 'home')
-rw-r--r--home/home-minimal.nix29
1 files changed, 27 insertions, 2 deletions
diff --git a/home/home-minimal.nix b/home/home-minimal.nix
index fa969a6..42f358d 100644
--- a/home/home-minimal.nix
+++ b/home/home-minimal.nix
@@ -65,7 +65,7 @@
body = "";
};
md = ''
- lowdown -tterm --term-columns=(tput cols) $argv[1] | less
+ lowdown -tterm --term-columns=(tput cols) $argv | less -F
'';
mds.body = ''
if [ "$argv[1]" = "" ]
@@ -83,7 +83,32 @@
echo (git -C $git -C .. rev-parse --show-toplevel) (git --git-dir $git remote get-url origin)
end
end | fzf --preview 'git -C {1} show --no-show-signature --color=always' | cut -f1 -d" "
- '';
+ '';
+ # Usage as with `git diff`: show-changelog <old-commit> <new-commit> -- <path/to/changelog>
+ # useful in git post-merge (or similar) hooks. default is to show changes in nixpkgs.
+ show-changelog.body = ''
+ if test (count $argv) = 0
+ set -a argv "HEAD@{1}" -- nixos/doc/manual/release-notes
+ end
+ git diff \
+ -U0 \
+ --word-diff=plain \
+ # format markdown links as atomic changes
+ --word-diff-regex='\[[^]]*\]\([^\)]*\)|[^[:space:]]' \
+ $argv |
+ sed -E '
+ # delete diff noise
+ /^(\+\+\+|diff|@@|index).*$/d
+ # make header per file
+ s|^---.*/([^/]*)$|\n# \1\n|g
+ # do not mark whole-line adds
+ s|^\{\+(.*)\+\}$|\1|g
+ # format word changes
+ s|\{\+(.*)\+\}|**\1**|g
+ s|\[-(.*)-\]|~~\1~~|g
+ ' |
+ md --term-nolinks
+ '';
};
};