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

Do your career a big favor. Join DEV. (The website you're on right now)

It takes one minute, it's free, and is worth it for your career.

Get started

Community matters

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

๐Ÿ‘‹ Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay