Skip to content

Add an item for jj #530

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions functions/_tide_item_jj.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
function _tide_item_jj
if not command -sq jj; or not jj root --quiet &>/dev/null
return 1
end

set jj_status (jj log -r@ -n1 --no-graph --color always -T '
separate(" ",
bookmarks.map(|x| if(
x.name().substr(0, 10).starts_with(x.name()),
x.name().substr(0, 10),
x.name().substr(0, 9) ++ "…")
).join(" "),
tags.map(|x| if(
x.name().substr(0, 10).starts_with(x.name()),
x.name().substr(0, 10),
x.name().substr(0, 9) ++ "…")
).join(" "),
surround("\"","\"",
if(
description.first_line().substr(0, 24).starts_with(description.first_line()),
description.first_line().substr(0, 24),
description.first_line().substr(0, 23) ++ "…"
)
),
change_id.shortest(),
commit_id.shortest(),
diff.files().len() ++ "m",
diff.stat().total_added() ++ "+",
diff.stat().total_removed() ++ "-",
if(conflict, "conflict"),
if(divergent, "divergent"),
if(hidden, "hidden"),
)' | string trim)
_tide_print_item jj $tide_jj_icon' ' "($jj_status)"
end
2 changes: 1 addition & 1 deletion functions/_tide_remove_unusable_items.fish
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function _tide_remove_unusable_items
# Remove tool-specific items for tools the machine doesn't have installed
set -l removed_items
for item in aws bun crystal direnv distrobox docker elixir gcloud git go java kubectl nix_shell node php pulumi python ruby rustc terraform toolbox zig
for item in aws bun crystal direnv distrobox docker elixir jj gcloud git go java kubectl nix_shell node php pulumi python ruby rustc terraform toolbox zig
contains $item $tide_left_prompt_items $tide_right_prompt_items || continue

set -l cli_names $item
Expand Down
4 changes: 2 additions & 2 deletions functions/tide/configure/configs/classic.fish
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ tide_jobs_number_threshold 1000
tide_kubectl_bg_color 444444
tide_kubectl_color 326CE5
tide_left_prompt_frame_enabled true
tide_left_prompt_items pwd git newline
tide_left_prompt_items pwd git jj newline
tide_left_prompt_prefix ''
tide_left_prompt_separator_diff_color 
tide_left_prompt_separator_same_color 
Expand All @@ -79,7 +79,7 @@ tide_pwd_bg_color 444444
tide_pwd_color_anchors $_tide_color_light_blue
tide_pwd_color_dirs $_tide_color_dark_blue
tide_pwd_color_truncated_dirs 8787AF
tide_pwd_markers .bzr .citc .git .hg .node-version .python-version .ruby-version .shorten_folder_marker .svn .terraform bun.lockb Cargo.toml composer.json CVS go.mod package.json build.zig
tide_pwd_markers .bzr .citc .git .hg .jj .node-version .python-version .ruby-version .shorten_folder_marker .svn .terraform bun.lockb Cargo.toml composer.json CVS go.mod package.json build.zig
tide_python_bg_color 444444
tide_python_color 00AFAF
tide_right_prompt_frame_enabled true
Expand Down