Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pkg-url = "{ repo }/releases/download/v{ version }/lazyjj-v{ version }-{ target
ansi-to-tui = { git = "https://github.com/Cretezy/ansi-to-tui.git", rev = "74bd97e" }
anyhow = "1.0.95"
chrono = "0.4.39"
crossterm = "0.29.0"
clap = { version = "4.5.31", features = ["derive", "env"] }
insta = { version = "1.42.1", features = ["filters"] }
itertools = "0.14.0"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ https://github.com/Cretezy/lazyjj/assets/2672503/b5e6b4f1-ebdb-448f-af9e-361e86f
- Set a bookmark to selected change with `b`
- Fetch/push with `f`/`p`
- Squash current changes to selected change with `s`/`S`
- Yank change ID/revision to the system clipboard with `y`/`Y`
- Files
- View files in current change and diff in side panel
- See a change's files from the log tab with `Enter`
Expand Down
2 changes: 2 additions & 0 deletions docs/keybindings.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ describe = "d"
edit-revset = "r"
set-bookmark = "b"
open-files = "enter"
copy-change-id = "y"
copy-rev = "shift+y"

push = "p"
push-new = "ctrl+p"
Expand Down
2 changes: 2 additions & 0 deletions src/keybinds/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ pub struct LogTabKeybindsConfig {
pub edit_revset: Option<Keybind>,
pub set_bookmark: Option<Keybind>,
pub open_files: Option<Keybind>,
pub copy_change_id: Option<Keybind>,
pub copy_rev: Option<Keybind>,
pub rebase: Option<Keybind>,

pub push: Option<Keybind>,
Expand Down
8 changes: 8 additions & 0 deletions src/keybinds/log_tab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ pub enum LogTabEvent {
EditRevset,
SetBookmark,
OpenFiles,
CopyChangeId,
CopyRev,

Push {
all_bookmarks: bool,
Expand Down Expand Up @@ -90,6 +92,8 @@ impl Default for LogTabKeybinds {
LogTabEvent::EditRevset => "r",
LogTabEvent::SetBookmark => "b",
LogTabEvent::OpenFiles => "enter",
LogTabEvent::CopyChangeId => "y",
LogTabEvent::CopyRev => "shift+y",
event_push(false, false) => "p",
event_push(false, true) => "ctrl+p",
event_push(true, false) => "shift+p",
Expand Down Expand Up @@ -136,6 +140,8 @@ impl LogTabKeybinds {
LogTabEvent::EditRevset => config.edit_revset,
LogTabEvent::SetBookmark => config.set_bookmark,
LogTabEvent::OpenFiles => config.open_files,
LogTabEvent::CopyChangeId => config.copy_change_id,
LogTabEvent::CopyRev => config.copy_rev,
LogTabEvent::Rebase => config.rebase,
event_push(false, false) => config.push,
event_push(false, true) => config.push_new,
Expand Down Expand Up @@ -166,6 +172,8 @@ impl LogTabKeybinds {
LogTabEvent::Squash { ignore_immutable: false } => "squash @ into the selected change",
LogTabEvent::Squash { ignore_immutable: true } => "squash @ into the selected change ignoring immutability",
LogTabEvent::SetBookmark => "set bookmark",
LogTabEvent::CopyChangeId => "yank change id to clipboard",
LogTabEvent::CopyRev => "yank revision to clipboard",
LogTabEvent::Fetch { all_remotes: false } => "git fetch",
LogTabEvent::Fetch { all_remotes: true } => "git fetch all remotes",
event_push(false, false) => "git push",
Expand Down
11 changes: 11 additions & 0 deletions src/ui/log_tab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use ansi_to_tui::IntoText;
use anyhow::Result;
use crossterm::{clipboard::CopyToClipboard, execute};
use ratatui::{
crossterm::event::{Event, KeyEventKind},
layout::Rect,
Expand Down Expand Up @@ -380,6 +381,16 @@ impl<'a> LogTab<'a> {
ComponentAction::ViewFiles(self.head.clone()),
));
}
LogTabEvent::CopyChangeId => {
// Copy change ID to clipboard using crossterm
let change_id = self.head.change_id.as_str();
let _ = execute!(std::io::stdout(), CopyToClipboard::to_clipboard_from(change_id));
}
LogTabEvent::CopyRev => {
// Copy revision (commit ID) to clipboard using crossterm
let commit_id = self.head.commit_id.as_str();
let _ = execute!(std::io::stdout(), CopyToClipboard::to_clipboard_from(commit_id));
}
LogTabEvent::Push {
all_bookmarks,
allow_new,
Expand Down
Loading