Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(option): options to control when cmp-rg can be triggered #46

Open
gjeusel opened this issue Nov 11, 2022 · 2 comments
Open

feat(option): options to control when cmp-rg can be triggered #46

gjeusel opened this issue Nov 11, 2022 · 2 comments

Comments

@gjeusel
Copy link

gjeusel commented Nov 11, 2022

Hey there ! 馃憢

I noticed rg is launched while editing my ~/.zshrc and fires up all the procs as it's searching all my home files.
Would it be possible to add options to whitelist / blacklist some paths ?

Regards,

@coffebar
Copy link

This plugin has option to set additional arguments for rg.
Here is my config for example. I created a file in gitignore format and passed it to rg for ignore

cmp.setup({
 ...
sources = cmp.config.sources({
{
  name = "rg",
  keyword_length = 3,
  option = {
  additional_arguments = "--max-depth 6 --one-file-system --ignore-file ~/.config/nvim/ignore.rg",
  },
},
}),

ignore.rg

Pictures/
Videos/
Documents/
go/pkg/
.node_modules/
.config/google-chrome/
.cache/
.java/
.mozilla/
.rustup/
.encryptfs/
.local/
.npm/
.cargo/

This prevents RipGrep from RIP-crashing my system when I edit a file in my home directory. Thanks to the ignore list, the list of files to search is reduced hundreds of times.

@jemag
Copy link

jemag commented Dec 11, 2022

Just another idea for folks finding this issue, in my case I don't really want the RG source unless in specific use cases so I just trigger it manually like so :

vim.keymap.set("i", "<c-x><c-r>", function()
  require("cmp").complete({
    config = {
      sources = {
        {
          name = "rg",
        },
      },
    },
  })
end)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants