Josh Medeski Memoji Josh Medeski

Menu

Popup history with tmux and fzf

Dotfiles
Popup history with tmux and fzf hero

Many times a minute I use the ctrl-r keyboard shortcut in my terminal to pull up my history. The 80/20 rule states that 80% of the input comes from 20% of the output. Applying that principle to my activity in the terminal means the majority of commands I want to run I

Thankfully fzf wrote a fzf-tmux script that makes it easy to integrate fzf with tmux.

Make sure you have installed the keybindings for your shell (you’ll run something like /usr/local/opt/fzf/install in macOS). After running that command your <ctrl-r> command will be bound to your history.

Going one step further, tmux has floating window support. To set your history to popup, add the following variables to your shell.

Here’s how to configure it depending on your shell:

Fish

set -U FZF_CTRL_R_OPTS "--reverse"
set -U FZF_TMUX_OPTS "-p"

Bash/Zsh

export FZF_CTRL_R_OPTS="--reverse"
export FZF_TMUX_OPTS="-p"

The -p flag will now change all fzf_tmux behavior to pop up instead of creating a separate pane.

I chose to use --reverse on the ctrl-r options because I like the way it looks. I also added an optional preview flag bound to ? as described in the fzf key binding wiki.

I hope you like it! fzf-tmux with popup support has been a game-changer. I had some hesitations moving away from Visual Studio Code, mostly that tmux and neovim felt outdated when it came to visuals. But now, I’m liking this setup MORE than vscode and am excited to continue to tweak the system to be even more stylish and functional than any other IDE out there.

This is a simple change, but having a polish balanced screen makes all the difference for me, here it is one more time:

Thanks for reading, I will continue to post tips and tricks for how to be more productive in the terminal and macOS.

Categories

These are a few of my favorite things.

Dotfiles

My developer environment

Development

How I build websites and apps

Desk Setup

The space that helps me create

Productivity

How I get things done

Personal Development

Creating a meaningful life

Stay up to date

Get updates on my latest content on web development, vim, macOS, working from home, productivity, and more.

Sign up to my newsletter