jjui icon indicating copy to clipboard operation
jjui copied to clipboard

FR: bind `N` (new `N`ote commit) to `jj new --no-edit -A @`

Open gcr opened this issue 8 months ago • 4 comments

Is your feature request related to a problem? Please describe. i use empty commits as TODO notes for the next task to take, but it's hard making new commits inline. sometimes i go to the command line and say jj new --no-edit -A @ to get a batch of a few of them, then i hop back into jjui to edit.

Image

such disorganization may be my load-bearing coping mechanism, but it's mine! isn't it beautiful, in its own haunting "oh god why would anyone do it like that" beauty? bear witness to my ADHD and tremble, o ye git mortals!

Describe the solution you'd like it would be nicer if, in one keybind like N (currently unused), I can get a new commit going and instantly start typing a description for it.

think of it like one of those sticky notes apps where capturing a new idea is just a ⌘<Space> away.

  • the mnemonic: N for new Note commit!

Describe alternatives you've considered the command i want is equivalent to nrJa⏎⏎, but that's six keystrokes!

  • n to make a new commit;
  • rJa to rebase the new commit -After its parent, then to accept the rebase;
  • another to start an inline describe session

my poor dopamine brain can't take that

unfortunately this also moves @ to the new commit, which usually isn't what I want

Why current features fail to cover this request no no, they do, almost...

[custom_commands."new note commit"]
key = ["N"]
args = ["new", "--no-edit", "-A", "$change_id"]

i just like this way of working and think it could make a great default for the coveted N key!

Additional context Add any other context or screenshots about the feature request here.

gcr avatar Aug 22 '25 15:08 gcr

Hey, thanks for the feedback.

I agree that the feature you described is very unique to the way you use new commits. There have been many feature requests to cover individual use cases to be implemented in jjui as a feature, and historically we declined those. In my eyes, this is one of them as it would look very patchy and out of flow in comparison to the rest of the features. The core features of jjui are modelled after the core features of jj, mostly to make them easily invokable.

Having said that though, jjui should have sufficient primitives implemented to unlock individual use cases like the one you described above. I will take this as feedback and will try to cover this use case in the next iteration of custom commands and leader keys support.

Currently, custom commands support running custom jj commands but not UI commands, and leader key supports running UI commands but not custom commands (it actually supports running custom commands by invoking : but it doesn't wait for the refresh to complete so cannot do both properly).

I will get back to this FR to ask for feedback once I have something that covers your use case.

idursun avatar Aug 24 '25 09:08 idursun

I was going to put in a request that shift-N would be a good default keybind for "new after" but this is almost exactly the same request. I wouldn't use it for notes, but I am very often doing what @gcr described, nrJa<enter>. I do this to place new empty changes in the middle of a work-in-progress branch with a megamerged child. This is doable but causes a lot of fumbling around, and losing my place among large branches when the new change scrolls me to the top. --no-edit would be fine for me, if a little inconsistent with n, but better if the new change is immediately selected in the UI without editing. Either N, Ne, or Nke would be much better for usability than nrJa<enter> in my opinion.

ewired avatar Sep 01 '25 19:09 ewired

~~Was just looking for this, as I have the same workflow as @ewired, i.e. I regularly want to insert new empty commits between two other commits and do nrJa<enter>.~~

~~Perhaps it would be cool to have the ability to create arbitrary keybinds where we can refer to the selected or checked out revision and execute a JJ command on them.~~

~~For example I could define:~~ ~~N = new -A $selected~~

~~And then whenever I press N, jjui would execute new -A <SELECTED_REVISION>.~~

EDIT: Hold on, I just discovered the leader feature described in #179, nevermind what I said then! 😁 EDIT 2: Aaaand I just discovered the custom commands feature that does exactly what I wanted. Goes to show that RTFM is gold.

Mansarde avatar Sep 19 '25 19:09 Mansarde

I've also found myself needing this. I don't use it for note taking, rather I need it when I discover a new piece of work that needs to be done before or after a certain change in a given series of changes.

It's similar to the workflow I had in Git/lazygit before where during an interactive rebase I could edit a commit X, create a new commit Y on top, and then when I continue all the other commits will be rebased on top of Y.

Up until now I've done this using : then new -A @ or new -B @.

Edit: this article is another example of a workflow which uses new -B @.

OliverJAsh avatar Sep 20 '25 16:09 OliverJAsh

Hey, I think this is now possible with the lua script support for the custom commands; the following should work:

[custom_commands.new_then_describe]
  key_sequence = ["N"]
  lua = '''
  jj("new", "-A", revisions.current())
  revisions.refresh()

  local new_change_id = jj("log", "-r", "@", "-T", "change_id.shortest()", "--no-graph")
  revisions.navigate{to=new_change_id}
  revisions.start_inline_describe()
  '''

I am going to close this issue assuming the above works but feel free to reopen it if there's something missing.

idursun avatar Dec 13 '25 20:12 idursun