tide icon indicating copy to clipboard operation
tide copied to clipboard

Add an item for jj

Open ETCaton opened this issue 1 year ago • 14 comments

Description

Adds an item for jj based on their fish and Starship prompts.

Screenshots (if appropriate)

cda4b1b1a10c3343c1b554b4a0052fb297837163324b6f5eb63653ec139fc36a

How Has This Been Tested

  • [x] I have tested using Linux.
  • [x] I have tested using MacOS.

Checklist

  • [x] I am ready to update the wiki accordingly.
  • [x] I have updated the tests accordingly.

ETCaton avatar Sep 14 '24 08:09 ETCaton

It seems to be working pretty well for me:

image

Thank you very much!

Btw, the image is from a colocated repo. I wonder if it would be useful (and doable) to hide the normal git item from the prompt when the jj item is active.

bbigras avatar Sep 29 '24 07:09 bbigras

I could see an argument for that, but jj is also niche and early days. If they were at 1.0/feature parity with things like submodules, etc. I might be more inclined to attempt excluding Git if jj appears to be configured for the repo as well.

For now my opinion is that people can just customize their prompt to exclude Git if they like. I don’t think Starship even allows disabling the Git repo status, so the existence of that jj prompt for it probably means that’s acceptable enough for the time being.

ETCaton avatar Sep 29 '24 08:09 ETCaton

For now my opinion is that people can just customize their prompt to exclude Git if they like.

Note that I still use git for some projects.

But yeah, it's fine like this for now.

Thanks again.

bbigras avatar Sep 29 '24 08:09 bbigras

❯ Warning: In template expression
 --> 3:9
  |
3 |         branches.map(|x| if(
  |         ^------^
  |
  = branches() is deprecated; use bookmarks() instead

https://github.com/martinvonz/jj/releases/tag/v0.22.0

bbigras avatar Oct 05 '24 07:10 bbigras

Thanks for noticing that! I'm using the version from https://github.com/martinvonz/jj/pull/3191 so I didn't get that warning (yet)

ETCaton avatar Oct 05 '24 08:10 ETCaton

It works, thanks!

bbigras avatar Oct 09 '24 02:10 bbigras

Any progress on getting this merged? It works great for me.

bbigras avatar Oct 23 '24 03:10 bbigras

I wanted to try out your jj prompt @ETCaton, but after uninstalling Tide and re-installing from a local clone of your repo, I'm still seeing the normal git prompt. Am I missing something?

I ran:

fisher remove IlanCosman/tide
git clone [email protected]:ETCaton/tide.git && cd tide
git checkout jj-item
fisher install . 
# <run configuration script>
# open a new terminal and cd to a colocated jj dir, don't see jj info

thor314 avatar Oct 26 '24 17:10 thor314

Any progress on getting this merged? It works great for me.

Looking at repo and author activity, it seems like they’re currently a little busy. I don’t see a particularly active fork to imply people are moving away from this, or merging in patches themselves in the meantime, so for now I think copying this file would suffice. Only changes I intend to make to this PR would be ones to accommodate jj changes upstream like the branch->bookmark renaming

I'm still seeing the normal git prompt

This doesn’t suppress the Git prompt, so that’s expected. If you mean you’re not seeing jj I’m not sure; have you customized your prompt/does explicitly adding this make it show up?

ETCaton avatar Oct 26 '24 18:10 ETCaton

@ETCaton I'm unsure what "explicitly adding this make it show up means".

on a terminal with tide removed:


thor@crow ~/tide ((no description set) n 45 (empty))>

I've set the can see the jj descriptors via the script borrowd from this gist: https://gist.github.com/hroi/d0dc0e95221af858ee129fd66251897e/

after fisher install . from your tide fork:


~/tide jj-item 
❯

that is, no jj info.

On running the function you added, issues elsewhere in tide are reported:

❯ _tide_item_jj
test: Missing argument at index 3
= left
       ^
~/.config/fish/functions/_tide_print_item.fish (line 9):
    else if test $_tide_side = left
            ^
in function '_tide_print_item' with arguments 'jj \(\e\[1m\e\[38\;5
\;5mq\e\[0m\ \e\[1m\e\[38\;5\;4mc\e\[0m\)'
        called on line 32 of file ~/.config/fish/functions/_tide_it
em_jj.fish
in function '_tide_item_jj'
 (q c)⏎

~/.files/fish @12a9aa2 !2 
❯

thor314 avatar Oct 26 '24 18:10 thor314

@thor314

Re: "explicitly adding this" Inserting jj into the tide_left_prompt_items universal variable seems to be sufficient.

I also inserted .jj into the tide_pwd_markers universal variable, for good measure.

dragonmaus avatar Oct 26 '24 19:10 dragonmaus

thanks dragon. I asked claude how to do what you told me to, and after running:

set -U tide_left_prompt_items $tide_left_prompt_items jj

# Add .jj to the pwd markers
set -U tide_pwd_markers $tide_pwd_markers .jj

I see in my prompt: ~/.files @be7533b ❯ (w 2)

this is a little out of order, so I adjusted things around, and now we've got the right order. Cheers, love the tool.

❯ echo $tide_left_prompt_items
pwd git newline character
❯ set -U tide_left_prompt_items pwd git jj newline character

additionally, if relevant, the initial PR was marked tested on OS X. I have tested on Linux.

thor314 avatar Oct 26 '24 19:10 thor314

Also tested on Linux and thanks to 0.26 we can get diff info without resorting to manual string parsing. Currently just mimicking the Starship prompt's modified addition removals <#>m <#>+ <#>-, though other data is available: https://github.com/jj-vcs/jj/blob/main/docs/templates.md#treediff-type

ETCaton avatar Feb 06 '25 03:02 ETCaton

Actually, I misread the m as "modified" but to replicate the prompt we should be counting files changed regardless of status

ETCaton avatar Feb 06 '25 03:02 ETCaton

@IlanCosman did you close this as "won't fix"? Or you just plan some alternative implementation?

indeyets avatar Aug 03 '25 07:08 indeyets

@IlanCosman did you close this as "won't fix"? Or you just plan some alternative implementation?

No, I just closed everything from before 2025 because it's easier to come back to a small number of PRs with people that want to actively drive them forward. Hopefully anything important will be resubmitted 😄

IlanCosman avatar Aug 03 '25 18:08 IlanCosman