Broot 1.0

5 minute read Published: 2020-09-02

8 months ago, but it feels like years ago, somebody shared a link to broot on Hacker News. There was some very kind messages and broot gained a few users. But I had more in my TODO list.

A lot was done since.

At first sight, broot didn't change much: It looks the same and what could be done then can still be done the same way, 500 commits and 60 releases later.

You can still explore the same way

Broot still shows you an overview of directories, even huge ones, and lets you navigate and understand the structure.

old_broot-overview

You can search and open the same way

You search with a few keystrokes, navigate, hit enter on a directory to focus it, or altenter to cd to it.

old_broot-search

You hit enter on a file to ask the system to open it, or a space, a e then enter to edit it in your favorite editor.

You can manipulate files the same way

You do the standard manipulations like rm, mv, cp, chmod, etc. with just a space or a colon followed by the name of the verb and some arguments if necessary.

old_broot-cp

(here, after having selected my deploy.sh file with sh, I copy it into preview.sh)

But broot went way further in those directions

Exploration got buffed

New data are available, for example the last modified dates and sizes which are deeply computed on directories (in background) and can be used for sorting.

new_broot-explore

And there's a preview now.

preview-text

preview-image

preview-binary

Searching and opening got buffed too

You can search on paths (not just filenames); or on file contents by prefixing your pattern with c/:

content-search

If you hit ctrl, which opens the preview, you see the matches in the file:

content-search-with-preview

And from here you can navigate to the selected match, and maybe open the file on that line in your editor. A typical search process is described here.

Just like for filtering on file names, content search results are updated while you type. And the search syntax lets you combine searches, for example you may find files containing both "foo" and "bar", but not the txt files, with c/foo&c/bar&!/txt$/.

Regarding file opening, the most requested feature was the ability to be back in broot when quitting vi or another terminal editor. This is now available.

Operations on files got buffed too

The most visible change is the ability to open several panels, for example for operations involving two locations, like a move or copy:

cpp

Now I have to confess something: I expected probably too much from this feature. While it works and doesn't seem to have problems it turns out I don't use it much. It was probably less important for easier file operations than less visible features like tab completion. I don't know yet if I was blinded by my fond remembrance of Norton Commander (back in the days of Windows 3.1) or if there's something that should be improved. I'll probably have to think about this more and I'm curious of the opinion of experienced broot users.

Customization of verbs and their keyboard shortcuts was also improved, allowing richer actions, like opening sub terminals or launching non trivial external applications.

The changes inside

Most of the initial technical choices were probably right.

My enthusiam for Rust only grew during this time and I'm not sure I could have as easily done so many big refactorings with another language, especially as broot being a "side project" I didn't have it fully in head 100% of the time. Having whole categories of bugs prevented by the language is a huge relief.

The biggest internal change was the replacement of Termion with Crossterm.

Termion is obvious, concise, simple to use. It's still a good solution for a small linux utility. But it's limited and binding; its design makes features like skinning an application very difficult. And, at the time of the switch at least, it wasn't maintained and major bugs weren't handled. Crossterm on the other hand, while intrinsically more complex, was more powerful. Its main maintainers tackled the hard work of building a real cross-platform terminal IO library, which involves dealing with an incredible number of small discrepancies. This choice allowed me to distribute broot on Mac and Windows and not just Linux.

I also introduced more concurrency, to make computations parallel and not block the interface.

Rust makes concurrency harder. You have to go to some length to do that properly, you can't just share a pointer and hope everything will be fine. It also makes it safer. "Fearless concurrency" means you won't spend hours trying to guess all the ways your parallel computation could get unlucky. I found Crossbeam and rayon very useful basic bricks for building parallelism in broot.

Next

In the last 8 months, I probably didn't spend one hour on a computer without using broot, I'm convinced it's a very useful tool which has no equivalent.

Using broot all the time made my TODO list grow to more than 600 lines (down to about 400 lines now). But there's nothing major anymore on it, nothing I feel essential, broot feels complete for me.

Right now what I'd like for broot is to find users, and with some luck some of those users will tell me how they use it which would fuel my reflection.