~kaction/config

b146c087aaabebfecf10ec340d39122f2f327aa1 — Dmitry Bogatov 2 years ago 652cc2e
tig: add binding to put tag _ on selected commit

It is convenient to interactively put _ tag on commit to refer to it with other
git commands or scripts taking commit reference as paramter.
2 files changed, 21 insertions(+), 0 deletions(-)

M .config/git/config
A bin/nix-edit
M .config/git/config => .config/git/config +1 -0
@@ 58,6 58,7 @@
	vertical-split = false
[tig "bind"]
	main = R !git revert %(commit)
	main = _ !git tag -f _ %(commit)
[tar "tar.xz"]
	command = xz -c
[tar "tar.gz"]

A bin/nix-edit => bin/nix-edit +20 -0
@@ 0,0 1,20 @@
#!/bin/sh -eu
# Nix provides convenient "nix edit" command that opens file containing
# definition of specified attribute (package). Unfortunately, it works very
# slow on "espero" box (probably due a i/o activity and hdd drive), so this
# script caches result and opens cached path in editor on subsequent calls.
#
# Cache invalidation is hard problem, and I don't even attempt to solve it.
# Luckily, stuff rarely moves around in nixpkgs.
readonly cachedir=~/.cache/nix-edit
name=$1
cache="${cachedir}/${name}"

if ! test -f "${cache}" ; then
	mkdir -p "${cachedir}"
	if ! EDITOR=echo nix edit ".#${name}" > "${cache}" ; then
		rm -f "${cache}"
		exit 1
	fi
fi
exec $EDITOR "$(cat "${cache}")"