From 5f988433ecf3f143a957188c578fe6a824390441 Mon Sep 17 00:00:00 2001 From: Mika Vilpas Date: Thu, 7 Nov 2024 18:39:58 +0200 Subject: [PATCH] docs: installation instructions are for lazy.nvim --- README.md | 59 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 7021aac..6fb5864 100644 --- a/README.md +++ b/README.md @@ -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, + }, }, }, }, }, -}) +} ```