Alexey Samoshkin
Treating fuzzy search as an interactive Unix filter across shell tasks and buffer streams eliminates directory tree navigation, enabling legacy Vim to match modern graphical editors.
AI-assisted summary of Vim universe. fzf - command line fuzzy finder — original source. Check the original for full context.
Source published:
Key ideas
- fzf operates as a general-purpose Unix filter that accepts generic input via standard input and outputs selections interactively to standard output. (0:08)
- Beyond basic file searching, fzf integrates into shells for path completion, SSH host discovery, interactive process termination, and history browsing. (4:22)
- The companion plugin fzf.vim replaces visual tree navigation with instant fuzzy searching across project files, buffers, help tags, and live ripgrep code queries. (7:18)
- A notable limitation in Vim is the absence of out-of-the-box Most Recently Used (MRU) ranking, which requires alternative navigation habits or history workarounds. (10:04)
Detailed notes
## Background Published on YouTube by Alexey Samoshkin on April 17, 2019, this video introduces the command-line fuzzy finder fzf and its integration within shells and Vim. The accompanying description highlights fzf's versatility beyond simple file lookups—including SSH hostnames, process IDs, and directories—along with its companion plugin fzf.vim for navigating buffers, help tags, lines, and grep matches.
## TL;DR Alexey Samoshkin presents fzf as an interactive Unix filter that ingests standard input, enables instant fuzzy filtering, and outputs chosen selections directly to standard output. Across terminal shells, fzf streamlines tasks like changing directories, terminating processes, recalling command history, and connecting to SSH hosts, particularly when enhanced with previews from tools like bat. In Vim, the fzf.vim plugin replaces traditional file-tree browsing with high-speed file opening, buffer switching, line searches, and ripgrep queries. Although Samoshkin notes that fzf lacks native most-recently-used (MRU) sorting, he demonstrates how its speed and flexibility modernize the classic editor to match contemporary development environments.
## Atmosphere & style The presentation is instructional, pragmatic, and methodically paced, evoking the quiet focus of an experienced software engineer refining terminal workflows. Samoshkin delivers clear, deliberate commentary that demystifies abstract Unix paradigms while validating common friction points, such as mental fatigue caused by nested directory navigation. The overall experience feels clean and practical, emphasizing tangible efficiency gains and seamless muscle memory over flashiness.
## Bulletin - [00:08](https://www.youtube.com/watch?v=qgG5Jhi_Els&t=8s) fzf operates as a general-purpose Unix filter that accepts generic input via standard input and outputs selections interactively to standard output. - [04:22](https://www.youtube.com/watch?v=qgG5Jhi_Els&t=262s) Beyond basic file searching, fzf integrates into shells for path completion, SSH host discovery, interactive process termination, and history browsing. - [07:18](https://www.youtube.com/watch?v=qgG5Jhi_Els&t=438s) The companion plugin fzf.vim replaces visual tree navigation with instant fuzzy searching across project files, buffers, help tags, and live ripgrep code queries. - [10:04](https://www.youtube.com/watch?v=qgG5Jhi_Els&t=604s) A notable limitation in Vim is the absence of out-of-the-box Most Recently Used (MRU) ranking, which requires alternative navigation habits or history workarounds.
## Key takeaways - [00:08](https://www.youtube.com/watch?v=qgG5Jhi_Els&t=8s) fzf acts as an interactive Unix filter that transforms standard input into standard output in real time. - [01:17](https://www.youtube.com/watch?v=qgG5Jhi_Els&t=77s) Fuzzy matching ranks scattered character hits automatically, while a single quote prefix forces deterministic exact matching. - [01:17](https://www.youtube.com/watch?v=qgG5Jhi_Els&t=77s) Search queries support multiple space-delimited tokens, prefix/suffix anchoring, negation, and multi-item selection with Tab. - [02:47](https://www.youtube.com/watch?v=qgG5Jhi_Els&t=167s) The double-star (**) trigger sequence initiates contextual fuzzy completion directly within shell commands. - [02:47](https://www.youtube.com/watch?v=qgG5Jhi_Els&t=167s) Built-in shell shortcuts streamline common operations: Ctrl+T locates files and Alt+C jumps into subdirectories. - [04:22](https://www.youtube.com/watch?v=qgG5Jhi_Els&t=262s) SSH hostname completion automatically reads connection history and the user's ~/.ssh/config file. - [04:22](https://www.youtube.com/watch?v=qgG5Jhi_Els&t=262s) Interactive process filtering allows users to search process tables and pipe chosen PIDs directly to kill. - [04:22](https://www.youtube.com/watch?v=qgG5Jhi_Els&t=262s) Shell history search via Ctrl+R becomes a scrollable, fuzzy-filtered list pasting commands straight to the prompt. - [04:22](https://www.youtube.com/watch?v=qgG5Jhi_Els&t=262s) External tools like bat, fd, and ripgrep can be plugged in to provide syntax previews and faster search backends. - [07:18](https://www.youtube.com/watch?v=qgG5Jhi_Els&t=438s) Using fzf.vim with the :Files command eliminates the cognitive friction and context switching of visual filetrees like NERDTree. - [07:18](https://www.youtube.com/watch?v=qgG5Jhi_Els&t=438s) Files selected in Vim can be opened in the current window, horizontal or vertical splits, or fresh tabs. - [07:18](https://www.youtube.com/watch?v=qgG5Jhi_Els&t=438s) Adding a bang to Vim commands (such as :Files!) renders a full-screen layout with an expanded syntax preview. - [10:04](https://www.youtube.com/watch?v=qgG5Jhi_Els&t=604s) fzf does not maintain built-in MRU file sorting in Vim, necessitating workarounds like Ctrl+^ or jump lists. - [10:04](https://www.youtube.com/watch?v=qgG5Jhi_Els&t=604s) :Helptags allows users to discover Vim documentation without memorizing exact help keyword names. - [10:04](https://www.youtube.com/watch?v=qgG5Jhi_Els&t=604s) :Lines and :BLines enable fuzzy searching through lines across all open buffers or within the active buffer. - [10:04](https://www.youtube.com/watch?v=qgG5Jhi_Els&t=604s) :Rg leverages ripgrep for lightning-fast project-wide line searches accompanied by real-time previews.
## Detailed walkthrough ### [00:08](https://www.youtube.com/watch?v=qgG5Jhi_Els&t=8s) What is fzf? The Unix Filter Concept
Alexey Samoshkin introduces fzf, which stands for fuzzy finder, describing it as a general-purpose command-line fuzzy finder. While that official definition sounds succinct, Samoshkin notes that it fails to capture the true breadth and power of the tool, which had already accumulated over 20,000 stars on GitHub at the time. For people accustomed to working inside a terminal environment, the fundamental mental model to understand is the classic Unix filter: independent utilities linked in a pipeline that take input, transform it, and pass it onward to produce an end result.
```mermaid flowchart LR accTitle: fzf Unix Filter Pipeline Architecture accDescr: Diagram showing how fzf acts as an interactive Unix filter between standard input and standard output. subgraph Input ["Standard Input"] A["Input Stream (stdin)"] end subgraph Finder ["Interactive Filter"] B["fzf Dialog Window"] C["User Fuzzy Query"] A --> B C --> B end subgraph Output ["Standard Output"] D["Selected Item (stdout)"] B --> D end ```
In simple terms, fzf is just another Unix filter in that lineage. It ingests whatever stream arrives via standard input (`stdin`), launches an interactive finder dialogue for the user, and then writes the selected item directly to standard output (`stdout`). While a traditional command like `find` simply dumps results statically, fzf provides real-time responsiveness. As Alexey Samoshkin explains: “The real advantage of fzf of a regular find command is interactive search and instant feedback.”
[01:17](https://www.youtube.com/watch?v=qgG5Jhi_Els&t=77s) Basic Fuzzy Search Syntax and Mechanics
Searching for files is such a ubiquitous scenario that simply entering `fzf` in the terminal without arguments immediately launches the search interface over the current directory. Because it relies on fuzzy matching, typing a few characters in sequence matches lines where those characters are scattered across the path, with exact matches automatically receiving a higher ranking score and appearing at the top of the interface. For users who prefer non-fuzzy deterministic searching, prefixing a search term with a single quote or running fzf with the exact flag switches it to exact-match behavior.
Although fzf does not natively support standard shell glob patterns like `*.sh`, it provides flexible filtering through space-delimited terms. Users can chain multiple search tokens, anchor searches to the beginning or end of a string, and negate patterns to strip out unwanted lines. Because fzf sends selections straight to standard output, it truly shines when piped into downstream utilities—such as inspecting file metadata or opening a selection in an editor. In addition, users are not restricted to choosing a single item; hitting the Tab key allows multi-selection across the list.
- Type characters separated across a path to trigger fuzzy rank scoring, where exact matches float to the top. - Prefix tokens with `'` (or pass the exact flag) to bypass fuzzy matching in favor of literal matches. - Combine multiple space-separated search terms, match string prefixes/suffixes, or invert matches via negation. - Use the `Tab` key to mark multiple files simultaneously for batch processing downstream.
[02:47](https://www.youtube.com/watch?v=qgG5Jhi_Els&t=167s) Shell Integration: Fuzzy Completion and Directory Navigation
To eliminate friction in daily shell tasks, fzf features fuzzy completion triggered by a dedicated trigger sequence (`**`). Samoshkin demonstrates trying to locate a specific configuration file tucked away inside a dotfiles repository under a nested `system` path: rather than escaping to an external file manager like Midnight Commander or manually traversing subdirectories, typing a command followed by `**` and pressing Tab launches the fzf selector right in place.
Changing directories is another area radically streamlined by fzf. Traditional approaches in shells like Zsh rely on Tab completion or typing initial path segments, both of which require mental overhead when dealing with deep directory hierarchies. Samoshkin remarks: “Well for sure that's easier than typing a full path manually but still a bit painful with fzf changing directory is like a breeze.” While fzf indexes subdirectories in the background, users can immediately begin filtering by typing whichever directory names they recall best. For those who want to bypass the `**` trigger entirely, fzf ships with default keybindings: `Ctrl+T` to locate files and `Alt+C` (Option+C) to jump into directories.
[04:22](https://www.youtube.com/watch?v=qgG5Jhi_Els&t=262s) Beyond Files: SSH Hosts, Process Management, History, and Previews
Because fzf operates on generic input streams, its utility extends far beyond file systems. For backend engineers juggling multiple remote machines, fzf pairs seamlessly with SSH: typing `ssh **` inspects the user's `~/.ssh/config` along with recent connection history to present a fuzzy-searchable list of hostnames and IP addresses. Similarly, terminating errant processes usually requires running `pgrep` to track down a process ID followed by a separate `kill` command; fzf collapses this into a single fluid interaction where process names are interactively searched and piped directly to `kill`.
```mermaid flowchart TD accTitle: Versatile Input Sources for fzf accDescr: Breakdown of various system sources feeding into fzf and downstream actions. subgraph Sources ["Input Sources"] H["SSH Config / Known Hosts"] P["Process Table (ps / pgrep)"] Cmd["Shell History"] end subgraph FZF ["fzf Interface"] UI["Fuzzy Interactive Selector"] Prev["bat Syntax Preview"] UI --- Prev end subgraph Actions ["Resulting Actions"] Conn["ssh user@host"] Term["kill -9 PID"] Exec["Refine / Execute Command"] end H --> UI --> Conn P --> UI --> Term Cmd --> UI --> Exec ```
The tool also modernizes command-line history. While traditional shells provide reverse incremental search via `Ctrl+R`, supercharging this with fzf opens a scrollable, fuzzy-filtered list that pastes the selected command directly onto the prompt for immediate editing. Samoshkin highlights several advanced flags, including attaching `bat` as a preview command for syntax highlighting and colored output, using Tab for multi-item selection, and binding custom actions like copying paths directly to the system clipboard. The underlying search backend can also be replaced—swapping GNU `find` for faster modern alternatives like `fd` or `ripgrep` (`rg`), and customizing default dialogue behavior via the `FZF_DEFAULT_OPTS` environment variable. Samoshkin emphasizes the cumulative impact: “It's a really prominent tool and has changed my common line habits making my development experience even more pleasant.”
[07:18](https://www.youtube.com/watch?v=qgG5Jhi_Els&t=438s) Integrating fzf into Vim: Files, Splits, and Layouts
In the second half of the walkthrough, Samoshkin transitions to the Vim plugin wrapper (`fzf.vim`), which can be installed via package managers such as vim-plug. Historically, navigating project filetrees in Vim meant relying on sidebar plugins like NERDTree. However, hunting through deep folder trees visually creates friction. As Samoshkin observes: “Plus it makes an extra contact switch in my mind and finally when I open file I forgot why I need it so ner tree is a good solution to explore an unfamiliar project but to quickly open file in a timely fashion I use fzf.”
```mermaid flowchart LR accTitle: Vim fzf File Opening Workflow accDescr: Options for opening files located with fzf inside Vim. F["fzf:Files Prompt"] --> Sel["Select File"] Sel -->|"Enter"| Win["Current Window"] Sel -->|"Ctrl+V / Ctrl+S"| Spl["Split View (H/V)"] Sel -->|"Ctrl+T"| Tab["New Vim Tab"] ```
Running the `:Files` command brings up the familiar interactive finder inside the Vim viewport. Files can be opened into the current window, into horizontal or vertical splits, or into fresh tabs using standard fzf key modifiers. Common editor conventions can be mirrored by binding file discovery to shortcuts like `Ctrl+P`, `Ctrl+T`, or `<Leader>o` (where "o" stands for open file). Samoshkin configures his finder to occupy a clean 40% split at the bottom of the editor, with syntax-highlighted previews powered by `bat`. For larger screens or extensive directory structures, appending a bang (`:Files!`) launches the picker in a full-screen layout with preview text displayed prominently at the top.
[10:04](https://www.youtube.com/watch?v=qgG5Jhi_Els&t=604s) MRU Limitations and Advanced Vim Workflows (Buffers, Tags, and Lines)
Samoshkin candidly highlights the main shortcoming of fzf in Vim: it does not maintain an out-of-the-box Most Recently Used (MRU) ranking. When switching rapidly between a small set of files, fzf does not automatically bubble the latest opened files to the top, requiring users to type their search terms repeatedly. Workarounds include relying on fzf's internal search history, cycling alternate files with `Ctrl+^`, or jumping back through cursor jump lists.
Beyond file navigation, `fzf.vim` exposes numerous specialized commands that leverage fuzzy finding across other Vim data:
- **Help Tags (`:Helptags`)**: Quickly discover Vim documentation topics when exact help keywords are unknown. - **Buffers (`:Buffers`)**: Restrict fuzzy selection specifically to loaded files rather than scanning the entire filesystem. - **Filepath Insertion**: Use completion bindings inside insert mode to complete and paste relative filepaths straight into code. - **Buffer Line Search (`:Lines` / `:BLines`)**: Search for strings across lines in open buffers without manually scrolling back and forth. - **Project-wide Ripgrep Search (`:Rg`)**: Execute line-level searches across an entire code repository and filter matches interactively with instant preview. - **Metadata and Navigation**: Search available Vim commands, snippets, filetypes, command histories, and color schemes on the fly.
Samoshkin concludes by encouraging users to feed arbitrary lists into fzf, arguing that this level of speed and ergonomics modernizes the classic editor: “With fzf wiim can now compete with other popular text editors out there like autum or Visual Studio code and become more attractive option for those willing to give it a try.”
## Notable quotes > [00:08](https://www.youtube.com/watch?v=qgG5Jhi_Els&t=8s) The real advantage of fzf of a regular find command is interactive search and instant feedback. — Alexey Samoshkin
## Mentioned fzf, Alexey Samoshkin, junegunn, fzf.vim, Unix, Vim, Zsh, Midnight Commander, SSH, bat, find, fd, ripgrep, NERDTree, vim-plug, Atom, Visual Studio Code
## Video description Check out how to search for files with command line fuzzy finder, https://github.com/junegunn/fzf, within a shell and in a Vim. fzf is not limited to file search only, and can be used with any - ssh host names, process IDs, directories. With accompanying Vim plugin, https://github.com/junegunn/fzf.vim, we can use it to search for help tags, available commands, buffers, lines in a file, grep matches, and more.
[Source](https://www.youtube.com/watch?v=qgG5Jhi_Els)