Skip to content

Commit

Permalink
docs: installation instructions are for lazy.nvim
Browse files Browse the repository at this point in the history
  • Loading branch information
mikavilpas committed Nov 7, 2024
1 parent 7314e9a commit 5f98843
Showing 1 changed file with 37 additions and 22 deletions.
59 changes: 37 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,48 @@ Ripgrep source for [blink.cmp](https://github.com/Saghen/blink.cmp).
Forked here (mikavilpas/blink.cmp) for my own use from
[niuiic/blink-cmp-rg.nvim](https://github.com/niuiic/blink-cmp-rg.nvim).

## 📦 Installation

The configuration of blink-ripgrep needs to be embedded into the configuration
for blink. Example for [lazy.nvim](https://lazy.folke.io/):

```lua
-- NOTE: you can skip the type annotations if you don't want to use them
--
-- NOTE: you can leave out the type annotations if you don't want to use them

---@module "lazy"
---@module "blink-ripgrep"
---@type LazySpec
require("blink.cmp").setup({
sources = {
completion = {
enabled_providers = { "lsp", "path", "snippets", "buffer", "ripgrep" }, -- add "ripgrep" here
},
providers = {
-- other sources
ripgrep = {
module = "blink-ripgrep",
name = "Ripgrep",
-- options below are optional, these are the default values
---@type blink-ripgrep.Options
opts = {
-- blink.cmp get prefix in a different way,
-- thus use `prefix_min_len` instead of `min_keyword_length`
prefix_min_len = 3,
-- The number of lines to show around each match in the preview window
context_size = 3
return {
"saghen/blink.cmp",
---@module 'blink.cmp'
---@type blink.cmp.Config
opts = {
sources = {
completion = {
enabled_providers = {
"lsp",
"path",
"snippets",
"buffer",
"ripgrep", -- 👈🏻 add "ripgrep"
},
},
providers = {
-- 👇🏻👇🏻 add the ripgrep provider
ripgrep = {
module = "blink-ripgrep",
name = "Ripgrep",
-- the options below are optional, some default values are shown
---@module "blink-ripgrep"
---@type blink-ripgrep.Options
opts = {
-- the minimum length of the query to start searching
prefix_min_len = 3,
-- The number of lines to show around each match in the preview window
context_size = 3,
},
},
},
},
},
})
}
```

0 comments on commit 5f98843

Please sign in to comment.