Skip to content

Instantly share code, notes, and snippets.

@marcusandre
Forked from hroi/fish_jj_prompt.fish
Last active January 4, 2025 13:39
Show Gist options
  • Save marcusandre/85e8b455c66e7c2754b33ae6d07c6b5c to your computer and use it in GitHub Desktop.
Save marcusandre/85e8b455c66e7c2754b33ae6d07c6b5c to your computer and use it in GitHub Desktop.
Jujutsu (jj) prompt for fish-shell and custom tide item prompt integration
function _tide_item_jj
if not command -sq jj
return 1
end
if not jj root --quiet &>/dev/null
return 1
end
jj log --ignore-working-copy --no-graph --color always -r @ -T '
surround(
" (",
")",
separate(
" ",
bookmarks.join(", "),
coalesce(
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) ++ "…"
)
),
"(no description set)"
),
change_id.shortest(),
commit_id.shortest(),
if(conflict, "(conflict)"),
if(empty, "(empty)"),
if(divergent, "(divergent)"),
if(hidden, "(hidden)"),
)
)
'
end
@marcusandre
Copy link
Author

marcusandre commented Nov 18, 2024

To make this a tide item, just follow https://github.com/IlanCosman/tide/wiki/Custom-items-(prompt-segments). But here are the steps:

  • funcsave or move _tide_item_jj.fish into .config/fish/functions
  • Add the item to the prompt with set --append tide_right_prompt_items jj (tide_left_prompt_items to add it to the left side)

@cjones-vultr
Copy link

Thank you for sharing this!

@logistic-bot
Copy link

This works really well, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment