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

Integration with steelsojka/pears.nvim #34

Closed
gegoune opened this issue Aug 17, 2021 · 4 comments
Closed

Integration with steelsojka/pears.nvim #34

gegoune opened this issue Aug 17, 2021 · 4 comments

Comments

@gegoune
Copy link
Contributor

gegoune commented Aug 17, 2021

Hey @hrsh7th, hope you are doing well!

How should I go about mapping enter to work with cmp and pears? For compe I had:

require('pears').setup(function(conf)                                          
  -- Integrate with compe.                                                     
  conf.on_enter(function(pears_on_enter)                                       
    if vim.fn.pumvisible() == 1 and vim.fn.complete_info().selected ~= -1 then 
      return vim.fn['compe#confirm'] '<CR>'                                    
    else                                                                       
      pears_on_enter()                                                         
    end                                                                        
  end)                                                                         
                                                                               
  conf.pair('<', nil)                                                          
end)                                                                           

Now, with cmp I also have that CR mapping:

['<CR>'] = cmp.mapping.confirm {
  behavior = cmp.ConfirmBehavior.Replace,
  select = true,
},

:imap <CR> returns

i  <CR>        *@v:lua.cmp.utils.keymap.expr("i", "<CR>")

So I assume cmp gets loaded after cmp and overrides the mapping. How to marry the two together?

Thanks!

@saadparwaiz1
Copy link

saadparwaiz1 commented Aug 17, 2021

Pear works without any config for me

@hrsh7th
Copy link
Owner

hrsh7th commented Aug 18, 2021

@saadparwaiz1 is correct.
The feature is noted in https://github.com/hrsh7th/nvim-cmp#features

@hrsh7th hrsh7th closed this as completed Aug 18, 2021
@gegoune
Copy link
Contributor Author

gegoune commented Aug 18, 2021

Ah, thanks, missed that! Does it mean I still need both pieces of configs?

@hrsh7th
Copy link
Owner

hrsh7th commented Aug 18, 2021

I think on_enter setting can,be removed.

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