Skip to content

FR: Cycle through previewers #587

@niveK77pur

Description

@niveK77pur

Is your feature request related to a problem? Please describe.

I like to use delta as my diff formatter, because it simply looks nicer compared to the default diff formatter; it's syntax highlighting makes it much nicer to parse diffs.

At the same time, I also really like using difftastic for its syntax aware diffs, which other times makes parsing diffs even better compared to delta.

I use both quite equally in fact, that I have made jj show use delta, and I created an alias jj showd which uses difftastic!

Other times, I also like to use jj show -w or jj show -b, for example in cases where difftastic just simply fails.

Describe the solution you'd like

It would be great, if I can specify multiple preview commands in jjui that I can cycle through. That way, with a single keybind, I can quickly switch between - say - delta and difftastic, with or without -w and/or -b.

Describe alternatives you've considered

Currently, I am using the following config to achieve something that is close enough:

[preview]
file_command = [
    "--config",
    "ui.diff-formatter=difft",
    "diff",
    "--color",
    "always",
    "-r",
    "$change_id",
    "$file",
]
revision_command = [
    "--config",
    "ui.diff-formatter=delta",
    "show",
    "--color",
    "always",
    "-r",
    "$change_id",
]

Why current features fail to cover this request

While the above solution poses a valid workaround, it doesn't quite capture the experience of switching between previewers. As a matter of fact, I rarely look at diffs for individual files in jjui, so being able to cycle between multiple revision_commands would be a really neat QOL improvement. Same goes for file_command and all other kinds of [preview].

Furthermore, the above strictly limits me to 2 different previewers (with the added (yet small) overhead of having to navigate to the file based preview)

Additional context

None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions