DEV Community

Cover image for Integrating TLDR with FZF
Helder Burato Berto
Helder Burato Berto

Posted on • Originally published at helderberto.com

2

Integrating TLDR with FZF

In this post, we gonna dive into TLDR with fzf search.

Usage of TLDR

Go to your favorite terminal, with TLDR enabled, and execute the following command:

$ tldr brew
Enter fullscreen mode Exit fullscreen mode

Searching with FZF

$ fzf .
Enter fullscreen mode Exit fullscreen mode

It will execute a fuzzy search in the current directory.

Passing a TLDR list to FZF

$ tldr --list | fzf
Enter fullscreen mode Exit fullscreen mode

The first argument tldr --list will generate a list of available commands enabled in your command line.

And when passing with a pipe operator | it will send the results to fzf.

Selecting an Argument with FZF

$ tldr --list | fzf | xargs tldr
Enter fullscreen mode Exit fullscreen mode

As you did in the previous step, it will share the list to fzf, and when you select an option it will send the argument via xargs to execute with tldr.

Previewing Commands on Searching

It creates a preview window, showing the results from TLDR and passing to the new window via xargs.

Let's try with the following command:

$ tldr --list | fzf --preview "tldr {1}" --preview-window=right,60% | xargs tldr
Enter fullscreen mode Exit fullscreen mode

Bonus: Aliasing

Create an alias to avoid remembering all this stuff:

alias tldrf='tldr --list | fzf --preview "tldr {1}" --preview-window=right,60% | xargs tldr'
Enter fullscreen mode Exit fullscreen mode

Source your command line configuration file, in my case it is .zshrc, and voilá!

Try your new alias into the command line:

$ tldrf
Enter fullscreen mode Exit fullscreen mode

Image of Datadog

Master Mobile Monitoring for iOS Apps

Monitor your app’s health with real-time insights into crash-free rates, start times, and more. Optimize performance and prevent user churn by addressing critical issues like app hangs, and ANRs. Learn how to keep your iOS app running smoothly across all devices by downloading this eBook.

Get The eBook

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Retry later