Skip to content

feat: file tree folding, hierarchy navigation, and combined directory diffs - #33

Merged
Blankeos merged 12 commits into
Blankeos:mainfrom
felipecm-br:feat/file-tree-navigation
Oct 6, 2026
Merged

Blankeos merged 12 commits into
Blankeos:mainfrom
felipecm-br:feat/file-tree-navigation

Conversation

@felipecm-br

Copy link
Copy Markdown
Contributor

Summary

Hi @Blankeos and contributors! 👋

This PR enhances the file tree experience across lazygitrs by introducing explicit directory folding, rapid tree hierarchy traversal (parent/child/siblings), and direct combined folder diffs.

All new actions are fully customizable in config.yml and integrated with the Command Palette / Help popup and status bar.


What's Changed & Key Advantages

  1. Explicit Directory Folding (- by default):

    • Pressing - (customizable via keybinding.universal.foldDirectory) folds and unfolds the selected directory node, including the root node (/), without confusing it with selecting child files.
  2. Combined Directory Diff Inspection (Enter on directories):

    • Pressing Enter on any directory node (or root /) focuses the diff view and displays a unified combined diff of all modified child files under that folder. This provides a great high-level overview of what changed in an entire module or directory before diving into individual files.
  3. Fast Tree Hierarchy & Sibling Navigation (,, ., <, > by default):

    • , (parent - keybinding.universal.treeParent): Jumps straight up to the parent directory node.
    • . (first child - keybinding.universal.treeChild): Jumps into the first child node of the directory.
    • < (prev sibling - keybinding.universal.treePrevSibling): Jumps to the previous sibling node at the same tree depth.
    • > (next sibling - keybinding.universal.treeNextSibling): Jumps to the next sibling node at the same tree depth.
    • These keys also work seamlessly from within the focused diff view, allowing quick jumping between folder/file diffs without returning to the sidebar.
  4. 100% Configurable & Dynamic UI:

    • Added foldDirectory, treeParent, treeChild, treePrevSibling, and treeNextSibling to UniversalKeybinding.
    • Users on non-US or alternative keyboard layouts (such as ABNT2, Dvorak, Colemak, etc.) can customize these keys in ~/.config/lazygit/config.yml under universal:
      keybinding:
        universal:
          foldDirectory: "-"
          treeParent: ","
          treeChild: "."
          treePrevSibling: "<"
          treeNextSibling: ">"
    • Command Palette (?) and bottom status bar dynamically reflect the active user configuration.
    • Added a conflict guard to ensure . does not accidentally toggle commit details when navigating commit file trees.

Testing

  • Added unit tests for tree hierarchy navigation algorithms (test_tree_navigation).
  • Added unit tests for keybinding default values and YAML deserialization (test_tree_keybindings_defaults_and_deserialization).
  • Verified all 146 tests pass (cargo test).
  • Verified code formatting with cargo fmt.
  • Tested interactively on multi-level nested working tree and commit file changes.

Thank you for creating and maintaining lazygitrs! Feedback and reviews are warmly welcomed.

@Blankeos

Copy link
Copy Markdown
Owner

All great PRs btw! I'll review them tonight, thanks so much!

Blankeos and others added 11 commits September 29, 2026 22:31
… view

- pin current file separator to viewport top in multi-file unified and split diffs with sticky header helpers
- add preview_placeholder rows for unavailable previews including centered binary placeholder
- fix row-to-line mapping, fallback index, and selection/overlay hit-testing for reserved sticky row
- ignore mouse selection on sticky header rowsfeat(pager): add sticky file headers and preview placeholders to diff view

- pin current file separator to viewport top in multi-file unified and split diffs with sticky header helpers
- add preview_placeholder rows for unavailable previews including centered binary placeholder
- fix row-to-line mapping, fallback index, and selection/overlay hit-testing for reserved sticky row
- ignore mouse selection on sticky header rows
Show each worktree’s directory name instead of its full path, align branch names using Unicode display width, and label the main worktree. Render submodule lists consistently across screen modes and add coverage for both lists.
Show divergent commits between two refs with ahead/behind counts, side indicators, paging, and commit-file previews. Add commit-aware diff and grep behavior, panel focus/navigation, and revision validation.
- Shift + / shift - work
- Mouse resizing
- Responsive layout based on size
- shift-tab cycles backwards
* feat(pager): add inline image diff previews for raster files

- Render Before/After previews for PNG, JPEG, GIF, WebP, BMP, ICO, and TIFF in Kitty and Ghostty, with Added/Deleted full-width states backed by worktree, index, and revision blobs
- Add background decode with memory/dimension limits, 20 MiB cap, and striped binary fallback for unsupported terminals, oversized files, and corrupt images
- Support capped inline image sections in folder diffs across split/unified and wrapped views with viewport-driven loading and cache-aware unloading
- Add diff path parsing for quoted/renamed headers, terminal graphics protocol handling, `LAZYGITRS_IMAGE_PREVIEW` opt-out/experimental flags, and tmux/screen/Zellij fallback

* refactor(pager): isolate image preview capabilities and sources

* fix(input): preserve Alt shortcuts when filtering Kitty replies
…s and head (Blankeos#34)

Co-authored-by: Blankeos <carloantonioct@gmail.com>
Use '.' to select the first visible tree child and apostrophe to toggle Commit Details across commit contexts. Update contextual help and the panel's top-right toggle hint to match; explicit tree remappings retain precedence while a tree is active.

Show only the configured fold/unfold shortcut in active file-tree list footers, including compare mode. Hide it in flat lists and diff focus, omit disabled bindings, and keep hierarchy navigation in contextual '?' help rather than the footer. Remove Commit Details footer hints.

Document the final defaults and footer policy, and add regression coverage for keybinding defaults, remapping precedence, details contexts/help, both details-panel layouts, and contextual normal/compare footers.

@Blankeos Blankeos left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed and locally retested the integrated file-tree changes and follow-up fixes. All 302 tests pass with cargo test --locked; cargo fmt --check, cargo build --locked, and git diff --check pass. Confirmed defaults: '.' selects the first visible child; apostrophe toggles Commit Details. Footers show only configured fold/unfold in active tree lists, with hierarchy navigation in contextual help. Navigation preserves viewport/diff refresh behavior and Enter preserves screen layout. Approved for squash merge following user retest.

@Blankeos
Blankeos merged commit c6e1467 into Blankeos:main Oct 6, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants