https://github.com/niuiic/blink-cmp-rg.nvim
Ripgrep source for blink.nvim
https://github.com/niuiic/blink-cmp-rg.nvim
Last synced: 7 months ago
JSON representation
Ripgrep source for blink.nvim
- Host: GitHub
- URL: https://github.com/niuiic/blink-cmp-rg.nvim
- Owner: niuiic
- License: mit
- Created: 2024-10-16T14:16:09.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-10-18T09:09:12.000Z (12 months ago)
- Last Synced: 2024-10-18T12:07:47.668Z (12 months ago)
- Language: Lua
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# blink-cmp-rg.nvim
Ripgrep source for [blink.cmp](https://github.com/Saghen/blink.cmp).
```lua
require("blink.cmp").setup({
sources = {
-- add "ripgrep" here
default = { "lsp", "path", "snippets", "buffer", "ripgrep" },
providers = {
-- other sources
ripgrep = {
module = "blink-cmp-rg",
name = "Ripgrep",
-- options below are optional, these are the default values
---@type blink-cmp-rg.Options
opts = {
-- `min_keyword_length` only determines whether to show completion items in the menu,
-- not whether to trigger a search. And we only has one chance to search.
prefix_min_len = 3,
get_command = function(context, prefix)
return {
"rg",
"--no-config",
"--json",
"--word-regexp",
"--ignore-case",
"--",
prefix .. "[\\w_-]+",
vim.fs.root(0, ".git") or vim.fn.getcwd(),
}
end,
get_prefix = function(context)
return context.line:sub(1, context.cursor[2]):match("[%w_-]+$") or ""
end,
},
},
},
},
})
```