Skip to content

v0.10.0

Latest

Choose a tag to compare

@nmfirdausw nmfirdausw released this 21 Oct 14:36
4d69f65

What's Changed

Features

Find

  • Add fuzzy :find over the cwd, with optional fff backend by @nmfirdausw in #11

Highlights

  • Fuzzy :find. :find now fuzzy searches every file under the current directory, instead of matching a path pattern. :find cfgld opens src/deep/config_loader.lua, and completion lists the fuzzy matches, best first.
  • fff as an option. Pass { fff = true } to search with fff. Batu installs it, downloads its binary and calls fff.file_search().
  • Outside the cwd. A path that leaves the cwd, such as :find ../other/cfg, searches that directory. /abs/path/ and ~/ work too.
  • Native by default. No new dependencies unless you choose fff.

Usage

require("batu").setup({
  find = true,                                  -- fuzzy :find (default)
  -- find = { fff = true },                     -- search with fff
  -- find = { fff = { max_threads = 8 } },      -- fff with its own options
  -- find = false,                              -- leave :find alone
})
Option Value Effect
find true (default) Fuzzy :find over the cwd
{ fff = true } Search with fff
{ fff = { ... } } fff with your options
false Leave :find alone

How it works

:find is powered by 'findfunc', so opening a file and its completion use the same search. The file list comes from rg, fd or git ls-files, so .git and ignored files are skipped. Without any of them it walks the directory and skips only .git. The list is built once per command line, so new files show up the next time.

With fff, Batu installs it with vim.pack, downloads its prebuilt binary (or builds it with cargo) on install and update, and calls file_search(). While fff is still indexing the cwd, or if it fails, the file list answers instead, so :find never blocks. A path that leaves the cwd always uses the file list, so fff keeps its index of the cwd.

Upgrading

find is on by default, so setup() now sets 'findfunc'. If you set your own, pass find = false, or remove yours and let Batu do it. fff is opt-in and adds nothing unless you set find = { fff = true }; building it needs cargo only when no prebuilt binary is available.

Full Changelog: v0.9.0...v0.10.0