# Fzf but without fzf.kak

**URL:** <https://discuss.kakoune.com/t/fzf-but-without-fzf-kak/660>\
**Category:** Recipes & Guides\
**Tags:** fzf\
**Created:** [July 15, 2019, 3:54pm UTC](https://discuss.kakoune.com/t/fzf-but-without-fzf-kak/660 "2019-07-15T15:54:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![andreyorst](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/andreyorst/32/29_2.png) [@andreyorst](https://discuss.kakoune.com/u/andreyorst)\
**Post date:** [July 15, 2019, 3:54pm UTC](https://discuss.kakoune.com/t/fzf-but-without-fzf-kak/660/1 "2019-07-15T15:54:32Z")

</div>

There was an issue on fzf.kak, and there was [this comment](https://github.com/andreyorst/fzf.kak/issues/40#issuecomment-471271528). Just thought about this way of using fzf inside Kakoune:

```auto
define-command fzf %{ evaluate-commands %{
    edit -scratch *fzf*
    map buffer normal '<ret>' ': fzf-operate edit<ret>'
    execute-keys -draft -buffer '*fzf*' '%d'
    fzf-prompt
}}

define-command fzf-prompt %{
    prompt "fzf: " -on-change %{
        execute-keys -draft '%d'
        execute-keys -draft "! find . | fzf -f %val{text}<ret>"
    } nop
}

define-command fzf-operate -params 1 %{ evaluate-commands -save-regs 'a' %{
    execute-keys <a-h><a-l>"ay
    evaluate-commands %sh{
        candidate=$(printf "$kak_reg_a" | sed "s/&/&&/g")
        case $1 in
            (edit) printf "%s\n" "edit -existing %&$candidate&" ;;
            (*) printf "%s\n" "fail %{Wrong command}" ;;
        esac
    }
}}

```

`fzf` is used as a filter and invoked on every key press. This way there’s no need for TMUX or `terminal` command to handle `fzf`. Maybe there’s another apps that could be used this way, via `prompt` command.

---

<div class="post-metadata">

**Author:** ![danr](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/danr/32/700_2.png) [@danr](https://discuss.kakoune.com/u/danr)\
**Post date:** [July 18, 2019, 11:20am UTC](https://discuss.kakoune.com/t/fzf-but-without-fzf-kak/660/2 "2019-07-18T11:20:52Z")

</div>

Cool! 🕶 Inspired by [Turn Your fzf Into a Live REPL :: paweldu.dev — Pawel Duda's personal site](https://paweldu.dev/posts/fzf-live-repl/) and this one can make a live repl for for example python by changing `fzf-prompt` like so:

```
define-command fzf-prompt %{
    prompt "fzf: " -on-change %{
        reg c %val{text}
        execute-keys -draft '%d'
        execute-keys -draft '"cp'
        execute-keys -draft '%|python - 2>&1<ret>'
    } nop
}
```

edit: moved the errors from stderr to stdout instead of them ending up in \*debug\* buffer
