# ffind

Fuzzy search text files by **filename** — works in **any shell** (bash, zsh,
fish, sh) and on **any Linux distribution**.

`ffind` is a plain executable (`ffind` + the `ffind-preview` helper). Your shell
execs it as an external binary, so there is nothing shell-specific to load:
no functions, no plugins, no per-shell configuration.

## Features

- Fuzzy-matches file names (ripgrep feeds the list, fzf does the matching)
- Tokyo Night themed, preview of the selected file on the right
- `Enter` — open the file with the default application (`xdg-open`)
- `Ctrl-Y` — copy the file path to the clipboard
  (wl-clipboard on Wayland, xclip/xsel on X11, pbcopy on macOS)
- `--md` — restrict the search to markdown files

## Requirements

- Runtime: `fzf`, `ripgrep`
- `xdg-utils` for `Enter`-to-open
- One clipboard tool for `Ctrl-Y` (wl-clipboard, xclip, xsel, or pbcopy)

## Install

### From the OBS-built package (recommended on Linux)

`.deb` and `.rpm` packages are attached to every [release](https://gituwa.lan.theshelf.top/maciek/ffind/releases):

- openSUSE: `zypper install --no-gpg-checks --allow-unsigned-rpm ./ffind-*.noarch.rpm`
- Debian/Ubuntu: `apt install ./ffind_*_all.deb`
- Fedora: `dnf install --nogpgcheck ./ffind-*.noarch.rpm`

The packages pull in `fzf`, `ripgrep`, and `xdg-utils` automatically and install
the completion snippets for bash, zsh, and fish.

### Installer script

```sh
curl -fsSL -o /tmp/ffind-install.sh https://gituwa.lan.theshelf.top/maciek/ffind/raw/branch/main/install.sh
bash /tmp/ffind-install.sh
```

On Linux it downloads the matching OBS package from the latest release and
installs it via `apt`/`zypper`/`dnf`. On macOS (or when no native package
exists yet) it falls back to a script copy into `~/.local/bin` plus the
completion snippets.

### Manual (any OS)

Clone the repo and copy the files:

```sh
git clone https://gituwa.lan.theshelf.top/maciek/ffind.git
install -m 0755 ffind ffind-preview ~/.local/bin/
install -m 0644 completions/ffind.bash ~/.local/share/bash-completion/completions/ffind
install -m 0644 completions/_ffind.zsh  ~/.local/share/zsh/site-functions/_ffind
install -m 0644 completions/ffind.fish  ~/.config/fish/completions/ffind.fish
```

### Note for fish users

If you used the old function-based version of ffind, remove the stale
`~/.config/fish/functions/ffind.fish` — a fish *function* named `ffind`
shadows the new binary.

## Usage

```
ffind              # search the current directory
ffind ~/docs       # search a specific directory
ffind --md         # search markdown files only
ffind --version    # print version
ffind --help       # show help
```

Inside the fzf window: `Enter` opens the file, `Ctrl-Y` copies its path.

## Development

- `ffind` — main script (cross-shell, bash)
- `ffind-preview` — preview + clipboard helper
- `completions/` — bash (`ffind.bash`), zsh (`_ffind.zsh`), fish (`ffind.fish`)
- `install.sh` — distro-aware installer
- CI: `.forgejo/workflows/ci.yml` runs `shellcheck`
- Releases: push a tag `vX.Y.Z`; `.forgejo/workflows/release.yml` builds a
  source tarball, OBS (`home:Baalthasar:ffind`) builds noarch packages, and the
  workflow attaches them to the release.

## License

AGPL-3.0-or-later
