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,
|
lib,
|
||||||
makeWrapper,
|
makeWrapper,
|
||||||
gitAndTools,
|
gitAndTools,
|
||||||
|
bc,
|
||||||
bat,
|
bat,
|
||||||
extraPackages ? [],
|
extraPackages ? [],
|
||||||
}: let
|
}: let
|
||||||
binPath = lib.makeBinPath ([gitAndTools.hub gitAndTools.delta bat] ++ extraPackages);
|
binPath = lib.makeBinPath ([gitAndTools.hub gitAndTools.delta bc bat] ++ extraPackages);
|
||||||
in
|
in
|
||||||
stdenvNoCC.mkDerivation rec {
|
stdenvNoCC.mkDerivation rec {
|
||||||
pname = "git-fuzzy";
|
pname = "git-fuzzy";
|
||||||
|
@ -24,12 +25,24 @@ in
|
||||||
];
|
];
|
||||||
|
|
||||||
postPatch = ''
|
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=''${GF_key#"GF_"}
|
||||||
|
key=''${key//_/-}
|
||||||
key=''${key,,}
|
key=''${key,,}
|
||||||
cat >> lib/load-configs-from-git.sh <<EOF
|
cat >> lib/load-configs-from-git.sh <<EOF
|
||||||
if val=\$(git config --get fuzzy.''${key@Q}); then
|
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
|
fi
|
||||||
EOF
|
EOF
|
||||||
done
|
done
|
||||||
|
@ -38,12 +51,11 @@ in
|
||||||
nativeBuildInputs = [makeWrapper];
|
nativeBuildInputs = [makeWrapper];
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
install -m755 -D ./bin/git-fuzzy $out/bin/git-fuzzy
|
install -m755 -D ./bin/git-fuzzy $out/bin/git-fuzzy
|
||||||
install -d "$out/lib"
|
cp -r lib "$out/lib"
|
||||||
cp -r lib "$out/lib/git-fuzzy"
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postFixup = ''
|
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}
|
wrapProgram "$out/bin/git-fuzzy" --prefix PATH : ${binPath}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,18 @@
|
||||||
syntax-theme = "TwoDark";
|
syntax-theme = "TwoDark";
|
||||||
tabs = 4;
|
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;
|
difftool.prompt = true;
|
||||||
init.defaultBranch = "main";
|
init.defaultBranch = "main";
|
||||||
merge.conflictstyle = "diff3";
|
merge.conflictstyle = "diff3";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue