Skip to content

Commit 1e06379

Browse files
committed
Add jj item
1 parent 44c521a commit 1e06379

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

functions/_tide_item_jj.fish

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
function _tide_item_jj
2+
if not command -sq jj; or not jj root --quiet &>/dev/null
3+
return 1
4+
end
5+
6+
set jj_status (jj log -r@ -n1 --ignore-working-copy --no-graph --color always -T '
7+
separate(" ",
8+
bookmarks.map(|x| if(
9+
x.name().substr(0, 10).starts_with(x.name()),
10+
x.name().substr(0, 10),
11+
x.name().substr(0, 9) ++ "…")
12+
).join(" "),
13+
tags.map(|x| if(
14+
x.name().substr(0, 10).starts_with(x.name()),
15+
x.name().substr(0, 10),
16+
x.name().substr(0, 9) ++ "…")
17+
).join(" "),
18+
surround("\"","\"",
19+
if(
20+
description.first_line().substr(0, 24).starts_with(description.first_line()),
21+
description.first_line().substr(0, 24),
22+
description.first_line().substr(0, 23) ++ "…"
23+
)
24+
),
25+
change_id.shortest(),
26+
commit_id.shortest(),
27+
if(conflict, "conflict"),
28+
if(divergent, "divergent"),
29+
if(hidden, "hidden"),
30+
)' | string trim)
31+
set jj_info $jj_status
32+
_tide_print_item jj $tide_jj_icon' ' "($(string join ', ' $jj_info))"
33+
end

0 commit comments

Comments
 (0)