From 6d689ecef20cfb375b3e4c82b2bfdd059b997061 Mon Sep 17 00:00:00 2001 From: MLC Bloeiman Date: Sun, 30 Aug 2026 19:36:30 +0200 Subject: [PATCH] Adapt my jujutsu and zsh configs a bit to the new way of life you see Signed-off-by: MLC Bloeiman --- configs/zshrc-append | 81 ++++++++++++++++---------------- home/modules/development/vcs.nix | 29 ++++++++++++ 2 files changed, 70 insertions(+), 40 deletions(-) diff --git a/configs/zshrc-append b/configs/zshrc-append index 9f53ebc..328043e 100644 --- a/configs/zshrc-append +++ b/configs/zshrc-append @@ -1,9 +1,12 @@ -# Stole ollies idea of putting _part_ in a separate file and part inline :3 export EDITOR=nvim # Function: zap _zap() { if [[ -d .jj || -d .git ]]; then clear -x + if command rad . > /dev/null 2>&1 + then + rad sync + fi; local repo_type="" if [[ -d .git && -d .jj ]]; then @@ -19,10 +22,9 @@ _zap() { if [[ -d .git ]]; then git fetch else - jj git fetch + jj git fetch --tracked --all-remotes fi - # Show repository line counts (assuming 'kc' is another alias/function) kc if [[ -d .jj ]]; then @@ -36,6 +38,7 @@ _zap() { if [[ -f flake.nix ]] && command -v nix >/dev/null 2>&1 && [[ -z "$IN_NIX_SHELL" ]] && [[ ! -f .envrc ]]; then echo -e "\n\n❄️\tFound flake.nix, run 'create-envrc' to create a .envrc file here to load this flake automatically." fi + eza -a --icons else eza -a --icons fi @@ -52,43 +55,41 @@ add-zsh-hook chpwd _zap_on_cd # Function: create-envrc function create-envrc() { - if [ -e .envrc ] - then - echo "⚠️ .envrc already here, can't safely insert." - direnv reload - return 0 - fi - - if ! command -v nix > /dev/null 2>&1 - then - echo "󱄅 Nix is not installed!" - return 1 - fi - - if ! command -v direnv > /dev/null 2>&1 - then - echo "󱄅 Direnv is not installed!" - return 1 - fi - - if ! [ -e flake.nix ] - then - echo "❌ No flake.nix file in this directory" - return 1 - fi - - - if ! [ -e .gitignore ] || ! grep -q "^\.direnv/" .gitignore - then - echo "💨 Adding direnv cache to gitignore" - echo -e "\n# Ignore direnv cache\n.direnv/" >> .gitignore - fi - - echo "if nix flake show &> /dev/null; then - use flake -fi" >./.envrc - - direnv allow + if [ -e .envrc ] + then + echo "⚠️ .envrc already here, can't safely insert." + direnv reload + return 0 + fi + + if ! command -v nix > /dev/null 2>&1 + then + echo "󱄅 Nix is not installed!" + return 1 + fi + + if ! command -v direnv > /dev/null 2>&1 + then + echo "󱄅 Direnv is not installed!" + return 1 + fi + + if [ -e flake.nix ]; then + echo 'if nix flake show &> /dev/null; then\n\tuse flake\nfi' >./.envrc + elif [ -e default.nix -o -e shell.nix ]; then + echo 'if [ -e shell.nix -o -e default.nix ]; then\n\tuse nix\nfi' >./.envrc + + else + echo "❌ No usable nix file in this directory" + return 1 + fi && if ! [ -e .gitignore ] || ! grep -q "^\.direnv/" .gitignore + then + echo "💨 Adding direnv cache to gitignore" + echo -e "\n# Ignore direnv cache\n.direnv/" >> .gitignore + direnv allow + else + direnv allow + fi } diff --git a/home/modules/development/vcs.nix b/home/modules/development/vcs.nix index b8d1d16..e9ecf97 100644 --- a/home/modules/development/vcs.nix +++ b/home/modules/development/vcs.nix @@ -28,6 +28,7 @@ key = "/home/mar/.ssh/id_ed25519.pub"; gpg.key = "9FFA7AE8896DD236"; }; + git.write-change-id-header = true; ui.diff-formatter = [ "difft" "--color=always" @@ -41,6 +42,34 @@ default-command = "status"; show-cryptographic-signatures = true; }; + revset-aliases = { + "trunk()" = '' + latest( + remote_bookmarks(exact:"main", exact:"origin") | + remote_bookmarks(exact:"master", exact:"origin") | + remote_bookmarks(exact:"mistress", exact:"origin") | + remote_bookmarks(exact:"trunk", exact:"origin") | + + remote_bookmarks(exact:"main", exact:"upstream") | + remote_bookmarks(exact:"mistress", exact:"upstream") | + remote_bookmarks(exact:"master", exact:"upstream") | + remote_bookmarks(exact:"trunk", exact:"upstream") | + + remote_bookmarks(exact:"main", exact:"rad") | + remote_bookmarks(exact:"mistress", exact:"rad") | + remote_bookmarks(exact:"master", exact:"rad") | + remote_bookmarks(exact:"trunk", exact:"rad") | + + root() + ) + ''; + "immutable_heads()" = '' + present(trunk()) | tags() | ( + untracked_remote_bookmarks() ~ + untracked_remote_bookmarks(remote='rad') ~ + untracked_remote_bookmarks(regex:'^patch(es)/',remote='rad') + )''; + }; revsets.bookmark-advance-to = "coalesce(@ & ~empty(), @-)"; template-aliases.default_commit_description = '' concat( -- 2.51.2