function fish_jj_prompt --description 'Write out the jj prompt' if not command -sq jj return 1 end if not jj root --quiet &>/dev/null return 1 end set parent_bmarks (jj log --no-graph -r 'bookmarks() & parents(@)' -T 'bookmarks.join(", ")') set template " surround( ' (', ')', separate( ' ', if(empty, '∅', '● ' ++ self.diff().files().len()), coalesce( surround( '\"', '\"', truncate_end(12, description.first_line(), '…') ), label('description placeholder', '?') ), change_id.shortest() ++ surround( '<', '>', bookmarks.join(', ') ), surround('~<', '>', \"$parent_bmarks\"), if(conflict, 'X'), if(divergent, '☇'), if(hidden, '⬚'), ) )" jj log --no-graph --color always -r @ -T $template end