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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestions triggering when creating a new file in Neo-tree #2124

Open
benbpyle opened this issue Jan 7, 2025 · 1 comment
Open

Suggestions triggering when creating a new file in Neo-tree #2124

benbpyle opened this issue Jan 7, 2025 · 1 comment

Comments

@benbpyle
Copy link

benbpyle commented Jan 7, 2025

When adding a new file in Neo-tree, I get autocomplete suggestions. Is there something in nvim-cmp I can do to disable the suggestions when I'm a popup or non-editing buffer like Neo-tree?

@hallstrom91
Copy link

I had the same problem after removing cmp suggestions on comment lines, then i started getting suggestions i neo-tree actions instead. I solved it by adding this to my cmp config - hope it helps :)

-- This removed suggestions from neo-tree actions like add, remove etc.

    local buftype = vim.bo.buftype

    if buftype == 'prompt' then
      return false
    end
cmp.setup({

-- all your config settings here

 enabled = function()
    local context = require('cmp.config.context')
    local buftype = vim.bo.buftype
    
    if buftype == 'prompt' then
      return false
    end

    -- remove suggestions on comment lines
    return not context.in_treesitter_capture('comment') and not context.in_syntax_group('Comment')
  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

2 participants