Filter files by path in the Files panel#5329
Filter files by path in the Files panel#5329dufferzafar wants to merge 1 commit intojesseduffield:masterfrom
Conversation
…epos I work in a monorepo that can have a very large set of dirty/untracked files, and in flat view I often need to scroll a lot to find files in the area I’m currently touching. This change adds path filtering to the Files panel so I can narrow the list quickly without changing existing / search behavior. What’s included: - Added a Files-panel path filter (separate from status filter) - Added a new keybinding for opening path filter prompt: keybinding.files.openPathFilter (default: <c-g>) - Kept / search behavior unchanged - Path filter matching uses existing filter engine: respects gui.filterMode (substring/fuzzy), includes PreviousPath for renames - Combined filtering logic is now: status filter AND path filter - Added Files filter menu entries for discoverability: open path filter prompt, clear path filter when active - Added subtitle indicator: (path filter active) when a path filter is applied - Added config option gui.filterFilesByCwd (default false), which initializes Files path filter from launch directory relative to repo root - CWD initialization is robust to path normalization differences by preferring PWD with fallbacks - Filter state remains active across refreshes; no persistence across restarts Why: This makes lazygit much more usable in large monorepos by defaulting scope to where I launched from, while still letting me clear the filter to view all changes when needed. Change-Id: I9494fe76f3e140d34b35aafbf24cdeaa1a87e1bc
|
Well, this is a dupe of #5273 Should've looked at the open PRs before I let codex rip on the code. @jesseduffield Feel free to close this PR I guess? I'll wait for your feature to be merged. I see that you've re-used the / keybind to filter files instead of searching. Good idea IMO. The only thing that is "new" to my implementation is the idea of filtering files by relative path of the current working directory. So for eg. if my git repo is at This keeps the file list focussed. |
Not an exact one, though; this PR filter subdirs, whereas #5273 filters on any substring in the path, which is not the same. For example, if you want to see only the top-level |
PR Description
I work in a monorepo that can have a very large set of dirty/untracked files, and in flat view I often need to scroll a lot to find files in the area I’m currently touching.
This PR adds path filtering to the Files panel so I can narrow the list quickly without changing existing
/search behavior.Highlights:
keybinding.files.openPathFilter(default<c-g>)/search behavior unchangedgui.filterModeand includesPreviousPathfor renamesstatusFilter AND pathFilter(path filter active)in Files subtitle when activegui.filterFilesByCwd(defaultfalse)PWD+ path normalization/symlink fallbacks to correctly capture launch directoryPlease check if the PR fulfills these requirements
go generate ./...)pkg/gui/filetree/file_tree_test.go)ExitFilterMode; no new translatable strings added)UserConfig; no non-reloadable path added)docs-master/Config.md, keybinding docs, schema)