SkillAgentSearch skills...

Livegrep.nvim

No description available

Install / Use

/learn @nathanmsmith/Livegrep.nvim
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

livegrep.nvim

Livegrep, directly inside of Neovim.

Installation

livegrep.nvim depends upon plenary.nvim and telescope.nvim. It also assumes that you have a recent version of curl installed.

Using packer.nvim:

use({
  "nathanmsmith/livegrep.nvim",
  requires = { { "nvim-lua/plenary.nvim", "nvim-telescope/telescope.nvim" } },
})

Then set up livegrep.nvim as a telescope extension.

require("telescope").setup({
  -- ...
})
require("telescope").load_extension("livegrep")

You'll also probably want to setup a keybinding to trigger livegrep. I use <leader>f (for "find").

vim.keymap.set("n", "<leader>f", function()
  require("telescope").extensions.livegrep.livegrep()
end, { silent = true })

Configuration

Configuration can either be set for the entire extension or individual calls. Examples:

-- Set default url for all calls
require("telescope").setup({
  extensions = {
    livegrep = {
      url = "https://my-custom-livegrep-instance.com/api/v1/search"
    }
  }
})

-- Set custom regex behavior for a single call
vim.keymap.set("n", "<leader>g", function()
  require("telescope").extensions.livegrep.livegrep({fold_case = "false"})
end, { silent = true })

All of the options are as follows:

  • url (default: "https://livegrep.com/api/v1/search/linux"): The url of the API to search against.
  • fold_case (default: "auto"): Should the query be case-sensitive? "true" means case-insensitive, "false" means case-sensitive, "auto" is case-insensitive unless an uppercase character is given (similar to Vim's smartcase)
  • regex (default: "true"): Should the query be parsed as a regex or literally? "true" parses as a regex, "false" performs a literal string search.
  • repo (default: nil): The repository to search. Defaults to nil which denotes all repos.
  • raw_curl_opts (default: nil): A table of extra arguments to pass to the curl call to the API.
View on GitHub
GitHub Stars6
CategoryDevelopment
Updated1y ago
Forks0

Languages

Lua

Security Score

50/100

Audited on Aug 28, 2024

No findings