Skip to main content

A TUI that can be used as a diff editor in the jujutsu vcs.

Project description

jjdiff

PyPI

A TUI that can be used as a diff editor in the jujutsu vcs.

jjdiff will show all changes and allow you to navigate through them and (partially) select them to be included.

jjdiff makes it easy to navigate the diff by having a 2 dimensional cursor that can 'grow' and 'shrink'.

This cursor can operate on 3 levels:

  • Change: select an entire change
  • Hunk: select a group of edited lines in a file
  • Line: select a single edited line in a file

Keybindings

Command Key Description
exit escape, ctrl+c or ctrl+d Exit the diff editor with status code 1, causing the diff to not be applied.
next_cursor j, down or tab Select the next entry.
prev_cursor k, up or shift+tab Select the previous entry.
shrink_cursor l or right Shrink the cursor. So go from change to hunk and from hunk to line. If the cursor is on an unopened change it will open it first.
grow_cursor h or left Grow the cursor. So go from line to hunk and from hunk to change. If the cursor is on an opened change it will close it.
select_cursor space Mark everything selected by the cursor to be included. If everything is already marked it will exclude it instead. This will also select the next entry.
select_all a Mark everything in the diff to be included. If everything is already marked it will exclude it instead.
confirm enter Confirm the selected changes.
undo u Undo the last command. Commands that only affect the UI state like changing the cursor and opening/closing changes are not included in this.
redo U Redo the last undone command. Commands that only affect the UI state like changing the cursor and opening/closing changes are not included in this.

Usage

jjdiff is available on pypi. You can use any way you are comfortable installing python applications.

You can then use it by adding the following settings to ~/.config/jj/config.toml:

[ui]
diff-editor = "jjdiff"
diff-instructions = false  # not required but recommended
diff-formatter = ["jjdiff", "--print", "$left", "$right"]  # to also format diffs using jjdiff

Configuration

jjdiff can be configured in ~/.config/jjdiff/config.toml with the following configuration options.

diff.deprioritize

This contains a list of gitignore style globs that can be used to deprioritize certain files in diffs. Deprioritizing has the following effects:

  • Deprioritized files are always at the end of the diff.
  • In jjdiff --print the changes in deprioritized files are not shown.

format.tab_width

Controls as how many spaces a tab is formatted in the diff. Default is 4.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jjdiff-0.4.0.tar.gz (647.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jjdiff-0.4.0-py3-none-any.whl (871.3 kB view details)

Uploaded Python 3

File details

Details for the file jjdiff-0.4.0.tar.gz.

File metadata

  • Download URL: jjdiff-0.4.0.tar.gz
  • Upload date:
  • Size: 647.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.13

File hashes

Hashes for jjdiff-0.4.0.tar.gz
Algorithm Hash digest
SHA256 7d8a936244937de717513e8f7c992c909520cd58a15f3a406ea03ffd40869833
MD5 19bcdc987cef611771ec34f74a112bad
BLAKE2b-256 5ed687726334f5221e6b9223cb1157db8e24486324b3d32f2b67039a78149b10

See more details on using hashes here.

File details

Details for the file jjdiff-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: jjdiff-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 871.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.13

File hashes

Hashes for jjdiff-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 33ec9f6da8ba29e5a3b5bfe3bd7d2570588587d6224358e6d7c5beee43a887b7
MD5 abfbc04750e73fc3a590fc1ffc33942a
BLAKE2b-256 bd486f3fe4a074bc9eb9586f985b5a22271c007db1803a6f9c52e564b821e2e9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page