jj changes
All checks were successful
/ check (push) Successful in 3m6s

This commit is contained in:
iofq 2026-02-15 23:42:30 -06:00
parent 472d9b0b05
commit 8694c7d81f
3 changed files with 70 additions and 137 deletions

47
flake.lock generated
View file

@ -6,11 +6,11 @@
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1765140120,
"narHash": "sha256-lLY34wnbyzi21zE8i+VM0AoEt67r4aPn/EoaZ8o4NgU=",
"lastModified": 1771048667,
"narHash": "sha256-o1UvUGjq3kiiyv/jrVxIEsl3y3wFnBvgSJpyjXTOsMw=",
"owner": "iofq",
"repo": "dart.nvim",
"rev": "205f809fbb27d56aff22756a97b5ba6f0c7243c3",
"rev": "af7256291c8f692647004b9a9fc0e92b6084a691",
"type": "github"
},
"original": {
@ -210,11 +210,11 @@
]
},
"locked": {
"lastModified": 1767609335,
"narHash": "sha256-feveD98mQpptwrAEggBQKJTYbvwwglSbOv53uCfH9PY=",
"lastModified": 1769996383,
"narHash": "sha256-AnYjnFWgS49RlqX7LrC4uA+sCCDBj0Ry/WOJ5XWAsa0=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "250481aafeb741edfe23d29195671c19b36b6dca",
"rev": "57928607ea566b5db3ad13af0e57e921e6b12381",
"type": "github"
},
"original": {
@ -398,6 +398,22 @@
"type": "github"
}
},
"jj-nvim": {
"flake": false,
"locked": {
"lastModified": 1771004667,
"narHash": "sha256-G7ksxOJJmQeTbsdAYddSFWUs9kyW/nIL4mv0F3FiXAI=",
"owner": "NicolasGB",
"repo": "jj.nvim",
"rev": "3d78c28f7e26d5c87f53e66e05a1393e6ca9fec2",
"type": "github"
},
"original": {
"owner": "NicolasGB",
"repo": "jj.nvim",
"type": "github"
}
},
"luvit-meta": {
"flake": false,
"locked": {
@ -445,11 +461,11 @@
]
},
"locked": {
"lastModified": 1768003501,
"narHash": "sha256-pxxUR3VRDcDpMgF1qb9FnlHAEOGi24bk6pdB1QzL1II=",
"lastModified": 1771200309,
"narHash": "sha256-2UQHZ8BsRSwtzl2R1OqtYR80SQF+HG3kJdTxfiDZR9s=",
"owner": "nix-community",
"repo": "neovim-nightly-overlay",
"rev": "d31b28318affe5d58ef12e7f72a7adfa66930a7a",
"rev": "c3e52f66f877cddce4167041546524abb76c0a70",
"type": "github"
},
"original": {
@ -461,11 +477,11 @@
"neovim-src": {
"flake": false,
"locked": {
"lastModified": 1768000044,
"narHash": "sha256-hcdQHR8l8oZDIl0vXKNtbrN+32dTs9EYvlqppoHgG2k=",
"lastModified": 1771195863,
"narHash": "sha256-WB0xr61z2nHB3/u42xYilqDCA/x3tvVZ21/bx2pNmgc=",
"owner": "neovim",
"repo": "neovim",
"rev": "930817f1009d9d392103b5440e2503cb47fdacc0",
"rev": "7d8653575f2a1170f0c7651f271c45a15a185d5e",
"type": "github"
},
"original": {
@ -670,17 +686,18 @@
"dart": "dart",
"flake-utils": "flake-utils_2",
"gen-luarc": "gen-luarc",
"jj-nvim": "jj-nvim",
"neovim-nightly-overlay": "neovim-nightly-overlay",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1768202037,
"narHash": "sha256-vSRt6yIYj9/X89ZTKpGz71BiksoHPYYLsmclaJveg7s=",
"lastModified": 1771220173,
"narHash": "sha256-QWZPg+bTY7n0X21ehfx4gOEe8/RcjsWYPhKZOXzMpO8=",
"owner": "iofq",
"repo": "nvim.nix",
"rev": "3c5c3a6745fd93970e5bebfb5a75b5bca53557a3",
"rev": "e9d4373ddcce3f32ba1a36b9f566ab8dc4d2892c",
"type": "github"
},
"original": {

View file

@ -21,50 +21,4 @@
nix-hash --type sha256 --to-base64 (nix-prefetch-url $argv)
'';
};
fish_jj_prompt = {
body = ''
if not command -sq jj
return 1
end
if not command -sq timeout
return 1
end
if set -q FISH_JJ
return 0
end
if not jj workspace root --ignore-working-copy &>/dev/null
return 1
end
# Generate prompt
set -l info "$(
timeout 5 jj log --ignore-working-copy --no-graph --color=always --revisions=@ --template "
separate(
' ',
self.change_id().shortest(),
bookmarks.join(', '),
if(conflict, label('conflict', '×')),
if(empty, label('empty', '(empty)')),
if(divergent, label('divergent', '(divergent)')),
if(hidden, label('hidden', '(hidden)')),
)
"
)"
or return 1
if test -n $info
printf ' (jj: %s)' $info
else
return 1
end
'';
};
fish_vcs_prompt = {
body = ''
fish_jj_prompt $argv
or fish_git_prompt $argv
or fish_hg_prompt $argv
or fish_fossil_prompt $argv
'';
};
}

View file

@ -55,7 +55,7 @@
default-command = [ "log" ];
conflict-marker-style = "git";
merge-editor = "vimdiff";
diff-editor = "diffview";
diff-editor = "difftool";
diff-instructions = false;
diff-formatter = ":git";
movement = {
@ -65,73 +65,30 @@
merge-tools.vimdiff = {
program = "nvim";
};
merge-tools.diffview = {
program = "sh";
edit-args = [
merge-tools.difftool =
let
cmd = [
"-c"
''
set -eu
rm -f "$right/JJ-INSTRUCTIONS"
ARGS="lua require('difftool').open('$left', '$right', {ignore = { '.git', '.jj' }})"
git -C "$left" init -q
git -C "$left" add -A
git -C "$left" commit -q -m baseline --allow-empty
mv "$left/.git" "$right"
git -C "$right" add --intent-to-add -A
(cd "$right"; nix run /home/e/dev/nvim.nix/ -- -c "lua require('difftool').open('$left', '$right', {ignore = { '.git', '.jj' }})")
git -C "$right" diff-index --quiet --cached HEAD && { echo "No changes done, aborting split."; exit 1; }
git -C "$right" commit -q -m split
git -C "$right" restore . # undo changes in modified files
git -C "$right" reset . # undo --intent-to-add
git -C "$right" clean -q -df # remove untracked files
''
];
diff-args = [
"-c"
''
set -eu
rm -f "$right/JJ-INSTRUCTIONS"
git -C "$left" init -q
git -C "$left" add -A
git -C "$left" commit -q -m baseline --allow-empty
mv "$left/.git" "$right"
git -C "$right" add --intent-to-add -A
(cd "$right"; nvim -c "lua vim.g.snacks_indent=false" -c "lua require('lazy').load({plugins = {'diffview.nvim'}})" -c DiffviewOpen)
git -C "$right" diff-index --quiet --cached HEAD && { echo "No changes done, aborting split."; exit 1; }
git -C "$right" commit -q -m split
git -C "$right" restore . # undo changes in modified files
git -C "$right" reset . # undo --intent-to-add
git -C "$right" clean -q -df # remove untracked files
''
];
};
merge-tools.diffview-new = {
program = "sh";
edit-args = [
"-c"
''
set -eux
nix run /home/e/dev/nvim.nix -- \
if [ -z "$NVIM" ]; then
vim -c "$ARGS"
else
vim \
--server $NVIM \
--remote-send "<cmd>lua require('difftool').open('$left', '$right', {ignore = { '.git', '.jj' }})<cr>"
until nix run /home/e/dev/nvim.nix -- \
--remote-send "<cmd>$ARGS<cr>"
until vim \
--headless \
--server "$NVIM" \
--remote-expr "v:lua.require'iofq.jj'.is_jj_diffedit_open()" 2>/dev/null | grep 0; do
sleep 1
done
''
];
diff-args = [
"-c"
''
set -eu
rm -f "$right/JJ-INSTRUCTIONS"
git -C "$left" init -q
git -C "$left" add -A
git -C "$left" commit -q -m baseline --allow-empty
mv "$left/.git" "$right"
git -C "$right" add --intent-to-add -A
(cd "$right"; nvim -c "lua vim.g.snacks_indent=false" -c "lua require('lazy').load({plugins = {'diffview.nvim'}})" -c DiffviewOpen)
fi
git -C "$right" diff-index --quiet --cached HEAD && { echo "No changes done, aborting split."; exit 1; }
git -C "$right" commit -q -m split
git -C "$right" restore . # undo changes in modified files
@ -139,6 +96,11 @@
git -C "$right" clean -q -df # remove untracked files
''
];
in
{
program = "sh";
edit-args = cmd;
diff-args = cmd;
};
snapshot = {
max-new-file-size = "10MiB";