1. 47
  1.  

  2. 8

    broot author here. There’s also a discussion on HN but I’d be quite happy to answer questions here.

    1. 4

      Looks good. Some UX concerns:

      • Behaviour of left and right arrow is completely unintuitive to me (I’d expect them to map to “go shallower” (parent dir) and “go deeper” (like Enter) respectively)
        • I see that you commented elsewhere: “problem in using left and right arrow keys is that most people use them (even if rarely) for navigation inside the input field and broot always keeps this input file for filtering and commands” Perhaps one solution is to use left and right arrow for navigation when the input field is empty, and use them for cursor control when the input has contents.
      • Esc in terminals often behaves such that the keystroke/keycode is not sent/executed until after a short delay (re: Alt, or Esc+key combos). Esc twice is often (always?) sent as one Esc keycode (in my experience)
      • Backspace seems to be a workaround/alternate to Esc
      • It’s surprising to me that Esc/Backspace from the original root(ish) dir causes broot to quit
      • Having a fuzzy file find would be great, especially if you could use / to delimit dirs. e.g. searching for f/b/baz.rb would highlight ./foo/bar/baz.rb and ./fee/bur/baz.rb
      1. 2

        It’s surprising to me that Esc/Backspace from the original root(ish) dir causes broot to quit

        I’ll probably change this. It’s mostly a remain of the initial version where I would very often just launch broot, stare at the tree, then quit having understood what the project looks like.

        1. 2

          Having a fuzzy file find would be great, especially if you could use / to delimit dirs. e.g. searching for f/b/baz.rb would highlight ./foo/bar/baz.rb and ./fee/bur/baz.rb

          That’s a concern I have too. Not really an actual problem I have but there’s at least theoretically a weak point in the search. Still thinking about it.

        2. 1

          Could you answer this question? https://lobste.rs/s/ttsozh/broot_new_way_see_navigate_directory#c_ob4efc

          Also, is there a way to make a no-color mode, and instead opt for just bold on matching text? My entire terminal setup is like this, where I don’t use colors anywhere, and opt for instead elegant spacing and bold text to achieve a clean, noise-free interface.

          1. 4

            You can configure your skin as you want, including colors, bold, italic: https://dystroy.org/broot/documentation/configuration/#colors

        3. 3

          This is a very cool tool. Thanks for building it, /u/denys_seguret. Here’s a mega-hacky way to get this into your ZSH command prompt so that you can just hit a key-chord to activate it at your location:

          # ZLE and broot don't play nicely so we launch `alacritty` and communicate with
          # it over a temp file to get broot's output
          addbr() {
            tmp_file=$(mktemp) # We'll use this file to communicate with the alacritty process
            cwd=$(pwd)
            /Applications/Alacritty.app/Contents/MacOS/alacritty -e /bin/sh -c "cd ${cwd} && broot -o ${tmp_file}"
            broot_out=$(< ${tmp_file} && rm ${tmp_file})
            RBUFFER=${broot_out}${RBUFFER}
          }
          zle -N addbr
          bindkey '^B' addbr # Bind functionality to Ctrl-B
          

          This will let you hit Ctrl-B anywhere in a CLI and pop up a little window for broot to select a file with.

          It’s probably leaking tmp_files all over the place and you can probably use anything that has the equivalent of xterm -e but iTerm and Terminal.app are lousy with that. Here’s a video to show you what it looks like, watch in 1080p.

          1. 3

            I use fzf for directory and files traversal and ncdu for interactive disk usage. Broot takes a fantastic middle ground here. It would be cool if disk usage traversal was done using left and right arrow keys as are in ncdu. +1 for NixOS package.

            1. 3

              problem in using left and right arrow keys is that most people use them (even if rarely) for navigation inside the input field and broot always keeps this input file for filtering and commands

            2. 2

              This solves a common issue I have on work machines, of deeply nested files and it being easy to lose context about file moves. The only thing I’m missing, is a way to drop the file path, relative to my current directory, of a file I select in broot. This may exist already, I just haven’t dug deep enough to find it yet.

              1. 2

                Do you mean something like z?

                1. 1

                  Similar yes, but combining the other capabilities of broot would be nice to utilize a single utility. Also, unlike z most of the time I don’t need to jump to the location of the file, but I need to do $something with it.

                2. 1

                  What do you mean “drop the file path” ?

                  1. 2

                    Once I select (or focus) a file in broot and exit, it’d be nice if my current command line was populated with the relative path to the file I selected. For example

                    $ pwd
                    /home/kevin
                    $ br
                      [ selects file in broot with absolute path of /home/kevin/foo/bar/baz.txt ]
                    $ foo/bar/baz.txt
                    
                    1. 2

                      There’s a verb, :pp which outputs the absolute path. Just like with all verbs, you can define a shorcut (for example ctrl-p).

                      Does that solve your problem?

                      more on verbs: https://dystroy.org/broot/documentation/configuration/#verbs-shortcuts-and-keys

                      1. 1

                        I can make that work! Thanks! In a perfect world it’d place that path on the command line rather than just printing to stdout, but with something like xargs I can still work with this. Thanks for your work on broot!

                        1. 3

                          If you’re on zsh you can pop the path in with zle.

                          1. 2

                            I am. This is exactly what I was looking for, thanks!

                        2. 1

                          He’s asking for a way to get at just the relative path. In the example given, just foo/bar/baz.txt, and not the full /home/kevin/foo/bar/baz.txt.

                          1. 2

                            I could very easily add a verb for that, just like today’s :print_path, a :print_relative_path.

                            Please kbknapp post an issue or answer here if that’s what you want.

                  2. 1

                    What I’ve done for a tree view better than tree until now is use this exa alias (“et” for “exa tree”). Unlike tree, this shows the file metadata you’d get with an ls -l, automatically pages (which lets you search using / in less), and so on. I have a few aliases, et1, et2, et3, for various levels of depth.

                    Unfortunately, exa doesn’t correctly respect git ignores so I need to add some common ignores in the alias.

                    1. 0

                      So this is just tree(1) on steroids?

                      1. 2

                        tree is just ls on steroids.