A tiny π€ wrapper around ripgrep for making search π blazingly fast β‘ and easy to use π in your favorite editor π₯°.
Tafuta is swahili for "search".
It allows you to search for text in your project.
Warning
Requires Neovim 0.10.0+
Via lazy.nvim:
require('lazy').setup({
-- blazingly fast β‘ search π
{
'mistweaverco/tafuta.nvim',
-- Make sure this matches the command you want to use and the command pass to setup
-- as user_command_prompt, user_command_cursor and user_command_live
-- e.g. if you want to use `:Rg` then the cmd should be `Rg`
-- If you don't want to use a command, you can omit this option completely
cmd = { "Tf", "Tfc", "Tfl" },
config = function()
-- Setup is required, even if you don't pass any options
require('tafuta').setup({
-- The user command to run the search e.g. `:Tf <flags> <query>`
-- Default: "Tf", but it can be anything you want.
-- If you don't want a command, you can set it to `nil`
user_command_prompt = "Tf",
user_command_cursor = "Tfc",
user_command_live = "Tfl",
-- rg options, a lua table of options to pass to rg as default,
-- e.g. { "--hidden", "--no-ignore" }
-- Default: nil
-- See `rg --help` for more options
rg_options = nil,
})
end,
},
})
You can either search for any text or search for the word under the cursor.
Search for text in your project via the command:
:Tf <rg-flags> <search-term>
or via calling a lua function:
require('tafuta').run({"[rg-flag1]", "[rg-flag2]", "[search_term]"})
Search for "Neovim version" in the project:
Note
You need to escape all spaces in the search term, when using the user command.
:Tf --hidden --no-ignore Neovim\ version
or via calling a lua function:
require('tafuta').run({"--hidden", "--no-ignore", "Neovim version"})
Also with default options and without flags:
:Tf Neovim\ version
or via calling a lua function:
require('tafuta').run({"Neovim version"})
You can also search for the word under the cursor via:
:Tfc
or via calling a lua function:
require('tafuta').cursor()
You can also search with live results via:
Note
You need to escape all spaces in the live search
:Tfl
or via calling a lua function:
require('tafuta').live()
Tip
You can also pass flags to the live search
Just prepend your flags to the command like so:
--hidden --no-ignore --smart-case Search\ for\ word