Skip to content

Interested in using kitty in the same way fzf-tmux works #2760

Answered by duganchen
megalithic asked this question in Q&A
Discussion options

You must be logged in to vote

This works on my Mac. It works both in a pipeline (>ls | fzf-kitty) and not (>fzf-kitty). It involves two scripts.

The first is _fzf-kitty-to, which is for the fzf-kitty script to call:

#!/bin/bash

# https://github.com/junegunn/fzf/issues/2481#issuecomment-839591602
tail_app="tail"
if [[ "$(uname)" == "Darwin" ]]; then
    tail_app=gtail
fi

if [[ -f "$INFILE" ]]; then
    $tail_app -f "$INFILE" | fzf "$@" >"$OUTPIPE"
else
    fzf "$@" >"$OUTPIPE"
fi

And the actual fzf-kitty script:

#!/bin/sh

outpipe=$(mktemp -u)
mkfifo -m 600 "$outpipe"

if [ ! -t 0 ]; then
    infile=$(mktemp /tmp/fzf-kitty.XXXXXX)
    while read -r line; do
        echo "$line" >>"$infile"
    done
fi

kitty @launch…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by megalithic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants