{"slug": "using-fzf-with-ai-coding-agents", "title": "Using fzf with AI coding agents", "summary": "Junegunn Choi released tmux-fzf-complete, a tmux plugin that restores fzf's CTRL-T file completion inside AI coding agent prompts such as Claude Code and Codex, where shell key bindings no longer reach the program reading keystrokes. The plugin requires fzf 0.74.0 or later, Ruby, and tmux 3.7 or later for its floating pane (older tmux versions fall back to a popup), and adds providers bound to ALT-F for files, ALT-D for directories, ALT-U for URLs on screen, ALT-P for paths on screen, and ALT-S for sentences on screen. A companion plugin, fzf-git.sh, bound to PREFIX g, completes git objects such as commit hashes.", "body_md": "# Using fzf with AI coding agents\n[#](#using-fzf-with-ai-coding-agents)\n\n## The problem\n[#](#the-problem)\n\nWith AI coding agents such as Claude Code and Codex, you spend more of your\ntime typing into the prompt of the agent than on the command line of your\nshell. You still need to type in file paths, commit hashes, and branch names,\nbut the fzf-powered key bindings for your shell, such as\n[`CTRL-T`](https://junegunn.github.io/fzf/shell-integration/) for files and\n[`CTRL-G` `CTRL-H`](https://junegunn.github.io/fzf/examples/git/) for commit hashes,\nare no longer there to help you. They are handled by the shell, and the shell\nis not the program reading your keys anymore.\n\n## tmux to the rescue\n[#](#tmux-to-the-rescue)\n\nIf you run the agents inside tmux, as many people do, tmux key bindings still work. tmux sees the keys before the program in the pane does, so a key bound in tmux works whatever the pane is running. It can start fzf in a floating pane, and send the selection back to the original pane as key strokes, as if you typed it.\n\nThere are two plugins built this way.\n\n| Plugin | Key | Completes | \n|---|---|---|\n| [tmux-fzf-complete](https://github.com/junegunn/tmux-fzf-complete) | `PREFIX`` CTRL-T` | Files, directories, and URLs, paths, and sentences on the screen | \n| [fzf-git.sh](https://github.com/junegunn/fzf-git.sh) | `PREFIX`` g` | Git objects | \n\nThe floating pane requires tmux 3.7 or later. On older versions, fzf starts in a popup instead.\n\nWhat happens in the screencast (the responses of Claude Code are sped up):\n\n- 0:05: Type “Summarize changes since \" into the prompt of Claude Code.\n- 0:09: `PREFIX`` g``h` to list commit hashes. Press`CTRL-/` to change the layout of the preview window, and look for\nthe commit to start from.\n- 0:16: Select the commit. Its hash is inserted into the prompt.\n- 0:25: `PREFIX`` CTRL-T` to start tmux-fzf-complete.`CTRL-T` to go through files, directories, and paths, to the\nsentences on the screen.\n- 0:28: Type “mouse” to find a sentence in the response, and select it.\n- 0:31: Type “Elaborate” below the sentence, and send it.\n- 0:35: While Claude Code is working, `PREFIX`` CTRL-T` again,\nand`CTRL-T` to go to the paths on the screen.\n- 0:40: `CTRL-O` to open`src/tui/light.go` in Vim, in the floating\npane.\n- 0:42: `PREFIX`` z` to zoom the pane, and search for “mouse”\nin the file.\n- 0:46: `PREFIX`` z` to unzoom. Quit Vim to go back to fzf,\nand close it.\n\n## tmux-fzf-complete\n[#](#tmux-fzf-complete)\n\n[tmux-fzf-complete](https://github.com/junegunn/tmux-fzf-complete) makes `CTRL-T` of fzf available in every\ntmux pane. It requires fzf 0.74.0 or later, and Ruby. Install it with\n[TPM](https://github.com/tmux-plugins/tpm),\n\n```\n# ~/.tmux.conf\nset -g @plugin 'junegunn/tmux-fzf-complete'\n```\n\nor clone the repository and run `fzf-complete.tmux` from your .tmux.conf.\n\n```\n# ~/.tmux.conf\nrun-shell /path/to/tmux-fzf-complete/fzf-complete.tmux\n```\n\nPress `PREFIX` `CTRL-T` in the prompt of an agent. The word in\nfront of the cursor becomes the query, and the selection replaces it.\n\n``` php\n~/github/fzf-g      ->      ~/github/fzf-git.sh/README.md\n```\n\nIt completes more than files. Inside fzf, `CTRL-T` goes to the next\nprovider, and these keys switch to one directly.\n\n| Key | Provider | \n|---|---|\n| `ALT-F` | Files | \n| `ALT-D` | Directories | \n| `ALT-U` | URLs on the screen | \n| `ALT-P` | Paths on the screen | \n| `ALT-S` | Sentences on the screen | \n\nThe last three are especially useful with an agent. An agent prints a lot of paths and URLs, and you often want to refer to one of them in your next message. A sentence is put back together from the rows the agent wrapped it into, with its indentation removed, so you can quote a part of the answer of the agent without copying it with the mouse.\n\nSome other keys inside fzf:\n\n- `CTRL-O` opens the item under the cursor, a URL in the browser and\nanything else in`$EDITOR` , and comes back to fzf after. The editor opens in\nthe floating pane, so press`PREFIX`` z` to zoom the pane\nif you need more room.\n- `CTRL-Y` copies the selection to the clipboard.\n- `CTRL-R` reloads the list, so you can pick up the latest output of\nthe agent.\n\n### Keep the output of the agent in the scrollback\n[#](#keep-the-output-of-the-agent-in-the-scrollback)\n\nAn agent that draws a full screen keeps no scrollback in tmux, so only what is currently on the screen can be completed from. Claude Code and Codex can draw on the main screen instead, which leaves their output in the scrollback.\n\n- Claude Code: `/tui default` in a session, or`\"tui\": \"default\"` in`~/.claude/settings.json`\n- Codex: `alternate_screen = \"never\"` under`[tui]` in`~/.codex/config.toml` , or`codex --no-alt-screen`\n\n## fzf-git.sh\n[#](#fzf-gitsh)\n\n[fzf-git.sh](https://github.com/junegunn/fzf-git.sh) provides key bindings for [Git\nobjects](https://junegunn.github.io/fzf/examples/git/). In addition to the shell bindings, it now\ncomes with tmux bindings in `fzf-git.tmux`. Keep it in the same directory as\n`fzf-git.sh`.\n\n```\n# ~/.tmux.conf\nrun-shell /path/to/fzf-git.tmux\n```\n\nThe keys are the same as the shell bindings, with `PREFIX`\n`g` in place of `CTRL-G`.\n\n- `PREFIX`` g``?` to show the list\n- `PREFIX`` g``f` for**F** iles\n- `PREFIX`` g``b` for**B** ranches\n- `PREFIX`` g``t` for**T** ags\n- `PREFIX`` g``r` for**R** emotes\n- `PREFIX`` g``h` for commit**H** ashes\n- `PREFIX`` g``s` for**S** tashes\n- `PREFIX`` g``l` for ref**l** ogs\n- `PREFIX`` g``w` for**W** orktrees\n- `PREFIX`` g``e` for**E** ach ref (`git for-each-ref` )\n- `PREFIX`` g``p` for GitHub**P** ull requests\n(only if[pr.fzf](https://github.com/junegunn/everything.fzf/blob/main/pr.fzf) is in`$PATH` )\n\nSo you can ask the agent to “review the changes in” a commit, and fill in the\nhash with `PREFIX` `g` `h` after looking at the\ndiff of each commit in the preview window. Likewise, `PREFIX`\n`g` `p` fills in the numbers of the pull requests you want\nthe agent to review.", "url": "https://wpnews.pro/news/using-fzf-with-ai-coding-agents", "canonical_source": "https://junegunn.github.io/fzf/tips/using-fzf-with-ai-agents/", "published_at": "2026-10-17 01:19:22+00:00", "updated_at": "2026-10-17 01:56:56.422617+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "ai-agents"], "entities": ["Junegunn Choi", "tmux-fzf-complete", "fzf", "tmux", "Claude Code", "Codex", "Ruby"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/using-fzf-with-ai-coding-agents", "markdown": "https://wpnews.pro/news/using-fzf-with-ai-coding-agents.md", "text": "https://wpnews.pro/news/using-fzf-with-ai-coding-agents.txt", "jsonld": "https://wpnews.pro/news/using-fzf-with-ai-coding-agents.jsonld"}}