mirror of
https://github.com/oddlama/nix-config.git
synced 2025-10-11 07:10:39 +02:00
fix: more config options for git fuzzy
This commit is contained in:
parent
80a4544bee
commit
761adc3133
2 changed files with 30 additions and 6 deletions
|
@ -4,10 +4,11 @@
|
|||
lib,
|
||||
makeWrapper,
|
||||
gitAndTools,
|
||||
bc,
|
||||
bat,
|
||||
extraPackages ? [],
|
||||
}: let
|
||||
binPath = lib.makeBinPath ([gitAndTools.hub gitAndTools.delta bat] ++ extraPackages);
|
||||
binPath = lib.makeBinPath ([gitAndTools.hub gitAndTools.delta bc bat] ++ extraPackages);
|
||||
in
|
||||
stdenvNoCC.mkDerivation rec {
|
||||
pname = "git-fuzzy";
|
||||
|
@ -24,12 +25,24 @@ in
|
|||
];
|
||||
|
||||
postPatch = ''
|
||||
for GF_key in $(grep -o -- 'GF_[A-Z0-9_]*' lib/load-configs.sh | sort -u); do
|
||||
for GF_key in $(grep -ohr -- 'GF_[A-Z0-9_]*' lib | sort -u); do
|
||||
key=''${GF_key#"GF_"}
|
||||
key=''${key//_/-}
|
||||
key=''${key,,}
|
||||
cat >> lib/load-configs-from-git.sh <<EOF
|
||||
if val=\$(git config --get fuzzy.''${key@Q}); then
|
||||
$GF_key=\$val
|
||||
export $GF_key=\$val
|
||||
fi
|
||||
EOF
|
||||
done
|
||||
|
||||
for GIT_FUZZY_key in $(grep -ohr -- 'GIT_FUZZY_[A-Z0-9_]*' lib | sort -u); do
|
||||
key=''${GIT_FUZZY_key#"GIT_FUZZY_"}
|
||||
key=''${key//_/-}
|
||||
key=''${key,,}
|
||||
cat >> lib/load-configs-from-git.sh <<EOF
|
||||
if val=\$(git config --get fuzzy.''${key@Q}); then
|
||||
export $GIT_FUZZY_key=\$val
|
||||
fi
|
||||
EOF
|
||||
done
|
||||
|
@ -38,12 +51,11 @@ in
|
|||
nativeBuildInputs = [makeWrapper];
|
||||
installPhase = ''
|
||||
install -m755 -D ./bin/git-fuzzy $out/bin/git-fuzzy
|
||||
install -d "$out/lib"
|
||||
cp -r lib "$out/lib/git-fuzzy"
|
||||
cp -r lib "$out/lib"
|
||||
'';
|
||||
|
||||
postFixup = ''
|
||||
sed -i 's%lib_dir="$script_dir/../lib"%lib_dir='"$out"'/lib/git-fuzzy%' $out/bin/git-fuzzy
|
||||
sed -i 's%git_fuzzy_dir="$script_dir/.."%git_fuzzy_dir='"$out"'%' $out/bin/git-fuzzy
|
||||
wrapProgram "$out/bin/git-fuzzy" --prefix PATH : ${binPath}
|
||||
'';
|
||||
|
||||
|
|
|
@ -27,6 +27,18 @@
|
|||
syntax-theme = "TwoDark";
|
||||
tabs = 4;
|
||||
};
|
||||
fuzzy = {
|
||||
bat-theme = "TwoDark";
|
||||
# TODO fuzzy is bad, it hardcodes diff | pager exec style.
|
||||
# This needs to be patched so we can use difft. alternative:
|
||||
# don't use a pager in fuzzy and somehow make difft width available to the main git diff command
|
||||
#preferred-pager = let
|
||||
# wrapper = pkgs.writeShellScript "difft-for-fuzzy" ''
|
||||
# ${pkgs.difftastic}/bin/difft --color=always --width "$1"
|
||||
# '');
|
||||
#in "${wrapper} __WIDTH__";
|
||||
status-directory-preview-command = "ls -lahF --group-directories-first --show-control-chars --quoting-style=escape --color=always";
|
||||
};
|
||||
difftool.prompt = true;
|
||||
init.defaultBranch = "main";
|
||||
merge.conflictstyle = "diff3";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue