Skip to content

Latest commit

Β 

History

History
154 lines (106 loc) Β· 3.25 KB

README.md

File metadata and controls

154 lines (106 loc) Β· 3.25 KB

tafuta logo

tafuta.nvim

Lua GitHub release (latest by date)

Install β€’ Usage

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.

screenshot

Install

Warning

Requires Neovim 0.10.0+

Via lazy.nvim:

Configuration

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,
  },
})

Usage

You can either search for any text or search for the word under the cursor.

Search for text

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]"})

Example

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"})

Example without flags

Also with default options and without flags:

:Tf Neovim\ version

or via calling a lua function:

require('tafuta').run({"Neovim version"})

Search for word under cursor

You can also search for the word under the cursor via:

:Tfc

or via calling a lua function:

require('tafuta').cursor()

Live search

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