Is there a way to combine paths if a directory has only a single file in ranger file manager?

35 Views Asked by At

Say, the directory structure is like:

  • main_dir
    • sub_dir1
      • single_dir
        • single_file
    • sub_dir2
      • some_file
      • another_file
      • more_files_and_dirs

In ranger file manager, considering there are three panes. The first pane shows contents at the level of main_dir. Given that main_dir is highlighted, the second pane then shows sub_dir1 and sub_dir2. If sub_dir1 is highlighted, single_dir is shown in third pane else if sub_dir2 is highlighted, then some_file, etc. are shown.

In cases where there are multiple directories like sub_dir1 which have just a single file nested deep, it is tedious to navigate to and again. Is it possible to shrink or combine the paths of different levels if only a single content is present in the next directory level? For example, second pane shows sub_dir1/single_dir/single_file instead of showing single_file in the third pane. This way, it would be easy to navigate single directory nested hierarchies.

In case, more files are present in single_dir. Then, second pane shows sub_dir1/single_dir and third pane shows single_file and more_files.

Is there a way to do this by changing the config? Dired in emacs supported these using dired-collapse. I am looking for a similar functionality in ranger.

I tried looking up the issues of the ranger repo and a quick google search to check if I can find something related. This did not yield any related results.

0

There are 0 best solutions below