lazygit icon indicating copy to clipboard operation
lazygit copied to clipboard

File tree pane folding utitities

Open sylph520 opened this issue 2 months ago • 4 comments

It seems not easy to navigate files in large git projects when there are a lots of folders (possibly nested), we can only use arrow keys to navigate? Currently, I know we can use -/+ to collapse or expand all file tree, and use / to search files. IMHO, it would be better if lazygit can support use shortcuts to fold the file tree in different levels, e.g., in tree command we can use -L to specify the levels or as in some editors, we can fold codes in different levels using shortcuts. Hope I made my suggestion clear.

sylph520 avatar Oct 23 '25 02:10 sylph520

Pressing Enter on a folder should collapse it, does that help?

mark2185 avatar Oct 23 '25 04:10 mark2185

Pressing Enter on a folder should collapse it, does that help?

Yes, I'm aware that press Enter does collapse a folder, but when the project have many folders I still need to navigate the file tree, I still need to navigate to a folder, collapse it, then go to the next folder, and repeat the process until navigate the folder I want to inspect.

Thus, in this scenario, when I can show and navigate in the level 1 folder, it would be much easier to navigate. e.g., say root_folder have sub_folder1, sub_folder2,..., sub_folder100, when i need to check the folder sub_folder12 and sub_folder25 (although searching the folder name should be an option to achieve the goal, but the folder name may not always be such easy to remember🤣), so if we can show the file tree in level 1, we can get a sense of sub_folders, then it will be easier to search or navigate through these level-1 folders.

sylph520 avatar Oct 23 '25 07:10 sylph520

Just out of curiosity, how many modified folders do you usually have at a given point in time?

lazygit also concatenates the names of the folders if something is several levels deep.

Image

mark2185 avatar Oct 23 '25 07:10 mark2185

Just out of curiosity, how many modified folders do you usually have at a given point in time?

lazygit also concatenates the names of the folders if something is several levels deep. Image

Yes, concatenating folder names is a good feature. But recently I forked a repo from others, their folders are nested (4~5 levels). Due to function calls among files, a lot of files needed to be modified among different folders to implement new logics. And I used to modified them all to test it is working, then git add and git commit, so the actual modified files involved sometimes are >10 files among different nested folders.

sylph520 avatar Oct 24 '25 08:10 sylph520