Use the Command Box to run jj commands
mainjj command directly within the lazyjj TUI by pressing : to open the command box. You do not need to include the jj prefix; for example, typing new main is equivalent to running jj new main.:repository·main·Indexed 22 days ago
https://github.com/cretezy/lazyjjA Terminal User Interface (TUI) for the Jujutsu (jj) version control system built with Ratatui. lazyjj provides interactive navigation for logs, change management, bookmark handling, and diff viewing. It includes a configurable keybinding system via TOML and a structured application state for managing views such as Log, Files, Bookmarks, and CommandLog.
jj command directly within the lazyjj TUI by pressing : to open the command box. You do not need to include the jj prefix; for example, typing new main is equivalent to running jj new main.:Keybindings are configured using TOML syntax. You can assign a single key combination, an array of multiple key combinations for the same action, or disable an action entirely by setting it to false.
# change keybinding
save = "ctrl+s"
# set multiple keybindings
save = ["ctrl+s", "ctrl+shift+g"]
# disable keybinding
save = false1/2/3 or h/l.?.j/k or arrow keys.J/K or arrow keys.Ctrl+e/Ctrl+y.Ctrl+d/Ctrl+u.Ctrl+f/Ctrl+b.You can install lazyjj using several methods depending on your preferred package manager or environment. Ensure you have jj installed before proceeding.
cargo binstall lazyjjcargo install lazyjj --lockedpacman -S lazyjjDownload them from the releases page.
cargo install lazyjj --lockedThe Log tab allows you to navigate the jj log and perform change management operations.
| Task | Key | Command Mapping |
|---|---|---|
| Select current change | @ | N/A |
| View change files in Files tab | Enter | N/A |
| Display different revset | r | jj log -r |
| Toggle diff format (color-words/git) | w | N/A |
| Toggle details panel wrapping | W | N/A |
| Create new change | n | jj new |
| Create new change + describe | N | jj new -m |
| Edit highlighted change | e | jj edit |
| Edit ignoring immutability | E | jj edit --ignore-immutable |
| Abandon a change | a | jj abandon |
| Describe highlighted change | d | jj describe |
| Set bookmark to selected change | b | jj bookmark set |
| Squash current to selected | s | jj squash |
| Squash ignoring immutability | S | jj squash --ignore-immutable |
| Git fetch | f | jj git fetch |
| Fetch all remotes | F | jj git fetch --all-remotes |
| Git push | p | jj git push |
| Push all bookmarks | P | jj git push --all |
| Push including new bookmarks | Ctrl+p / Ctrl+P | jj git push --allow-new |
nThe Bookmarks tab provides a dedicated interface for managing bookmarks across remotes.
| Task | Key | Command Mapping |
|---|---|---|
| Show all bookmarks (inc. remotes) | a | jj bookmark list --all |
| Create a bookmark | c | jj bookmark create |
| Rename a bookmark | r | jj bookmark rename |
| Delete a bookmark | d | jj bookmark delete |
| Forget a bookmark | f | jj bookmark forget |
| Track a bookmark | t | jj bookmark track |
| Untrack a bookmark | T | jj bookmark untrack |
| Create new change after bookmark | n | jj new |
| Create new change + describe | N | jj new -m |
| Edit bookmark's change | e | jj edit |
| Edit ignoring immutability | E | jj edit --ignore-immutable |
To start lazyjj in the current directory:
lazyjjTo target a specific repository path:
lazyjj --path ~/path/to/repoTo start with a specific default revset:
lazyjj -r '::@'lazyjj --path ~/path/to/repoThe Commander struct is the primary interface for executing jj commands from within lazyjj. It manages command execution, handles output, and maintains a history of executed commands.
Key capabilities include:
jj commands with specific color and quiet settings.command_history for logging or auditing.set_env.limit_width.jj version is compatible (minimum version 0.33.0).use crate::commander::Commander;
use crate::env::Env;
// Assuming env is already initialized
let mut commander = Commander::new(&env);
// Set an environment variable for the next command
commander.set_env("MY_VAR", "my_value");
// Execute a jj command and get the stdout as a String
let output = commander.execute_jj_command(vec!["status"], true, true)?;
// Execute a command where you don't need the output
commander.execute_void_jj_command(vec!["git", "init", "--colocate"])?;The LogPanel is a UI component used in the Log tab to display the output of the jj log command. It is typically rendered on the left side of the Log tab and serves as a selection mechanism: selecting a change in the LogPanel allows that change to be expanded and viewed on the right side of the tab.
Key behaviors:
Head) via keyboard or mouse clicks. The panel highlights the currently selected change using the configured highlight_color from the application settings.lazyjj can be configured using your existing jj configuration file (user or repo config). The following options are available:
| Key | Description | Default |
|---|---|---|
lazyjj.highlight-color | Changes the highlight color (supports named colors). | #323264 |
lazyjj.diff-format | Default diff format: color-words or git. | color_words |
lazyjj.diff-tool | Specifies the default diff tool. | Uses ui.diff.tool if not set |
lazyjj.bookmark-prefix | Prefix for generated bookmark names. | push- |
lazyjj.layout | Main and details panel layout: horizontal or vertical. | horizontal |
lazyjj.layout-percent | Split percentage between main and details (0-100). | 50 |
Note on fallbacks:
lazyjj.diff-format is unset, it uses ui.diff.format.lazyjj.diff-tool is unset, it uses ui.diff.tool.lazyjj.bookmark-prefix is unset, it uses git.push-bookmark-prefix.jj config set --user lazyjj.diff-format "color-words"The RebasePopup is a transient UI component used to select a rebase configuration before executing the command. It allows you to specify how the source revision is selected (the 'cut' part) and how the target revision is handled (the 'paste' part).
Source Mode (Cut Options):
-s: Include this change and all its descendants.-b: Include the whole branch.-r: Only move this single revision.Target Mode (Paste Options):
-d: Rebase onto the target as a new branch.-A: Rebase after the target.-B: Rebase before the target.s, b, r for source modes; d, Shift+A, Shift+B for target modes.Enter to execute the rebase, Esc or q to cancel the operation.// Visual representation of the popup:
// ~~~
// Source (zsztoxlv)
// ( ) -s this and descendants
// ( ) -b whole branch
// (*) -r only one change moves
// Target @ (umrpslui)
// (*) -d rebase onto @ as new branch
// ( ) -A rebase after @
// ( ) -B rebase before @
//
// Esc: Cancel Enter: Rebase
// ~~~If you encounter issues, you can enable debugging tools by setting environment variables before running lazyjj.
Set LAZYJJ_LOG=1 to generate a lazyjj.log file.
Set LAZYJJ_TRACE=1 to generate Chrome trace files (trace-*.json), which can be viewed in chrome://tracing or ui.perfetto.dev.
LAZYJJ_LOG=1 lazyjj