hrsh7th / nvim-cmp

A completion plugin for neovim coded in Lua.
MIT License
7.71k stars 383 forks source link

Hide the auto complete window completely #1013

Open nparthas opened 2 years ago

nparthas commented 2 years ago

Hi,

I was wondering if it was possible currently to completely hide the autocompletion window. I'd like to have something like this, which I saw was from this post.

I've tried changing some of the completeopts but taking a brief look through the code it seems like there are parts that are dependent of having menu,menuone,noselect as changing them in the plugin+nvim config led to some weird behaviour.

image

I saw the option for ghost_text which is what I'd like to use along with a hidden window, so that I can cycle through suggestions without having the popup take up space on the screen.

Not asking for a new feature, just if it's currently doable.

Edit:

If that's not possible, I can shrink the menu size down to just one entry with pumheight=1, but is there a way to disable the LSP documentation info window?

jonatan-branting commented 2 years ago

I would love this feature.

Given this was actually a thing, it would also be nice if it was possible to bring the completion menu up on demand, so that you aren't completely locked into just one line.

Shougo commented 2 years ago

Hm. If search mode or command line mode, statusline can be used for completion menu. Please see.

https://github.com/hrsh7th/nvim-cmp/commit/124f1611f1b7cd9fb2892f0597881e007c99b652

Shougo commented 2 years ago

https://github.com/hrsh7th/nvim-cmp/issues/406

ghost_text does not support hide the completion window.

Shougo commented 2 years ago

Given this was actually a thing, it would also be nice if it was possible to bring the completion menu up on demand, so that you aren't completely locked into just one line.

You can disable the completion menu by autocomplete = false. For manual completion, you can use cmp.mapping.complete().

oeyoews commented 2 years ago

autocomplete = true is not support toggle, must comment this option in personal config file

hrsh7th commented 2 years ago

The implementation should have been able to do this, but the current nvim-cmp is badly designed and difficult to implement. Sorry...

ghost commented 12 months ago

this would be really nice to have

xiantang commented 10 months ago

really good feature

bfedie518 commented 1 month ago

@hrsh7th Could an option be added to view.entries? view = { entries = 'wildmenu' } } puts the menu on the bottom of the page. Could that be configured to not display anything? Or could it still technically be displaying but with a height of 0 so you don't actually see it?

I use the setup below to switch between wildmenu and custom. It could easily be adapted to switch between custom and hidden or whatever the new view.entries option gets called.

local toggle_view = function()
    local current = cmp.get_config().view.entries.name
    if current == nil or current == 'wildmenu' then
        cmp.setup({ view = { entries = { name = 'custom', selection_order = 'near_cursor' } } })
    else
        cmp.setup({ view = { entries = { name = 'wildmenu', separator = ' | ' } } })
    end
end

cmp.setup({
    experimental = { ghost_text = true },
    view = { entries = { name = 'wildmenu', separator = ' | ' } },
    --other setup
    mapping = cmp.mapping.preset.insert({
        --other mappings    
        ['<C-Space>'] = cmp.mapping(function()
            if not cmp.visible() then
                cmp.complete()
            else
                cmp.abort()
                toggle_view()
                cmp.complete()
            end
        end),
    }),
})