bullets.vim icon indicating copy to clipboard operation
bullets.vim copied to clipboard

breaks completion if completeopt=noinsert

Open astier opened this issue 4 years ago • 2 comments

Minimal vimrc

cal plug#begin($XDG_DATA_HOME.'/nvim/plugins')
Plug 'dkarter/bullets.vim'
cal plug#end()
set completeopt=menu,noinsert

Steps to reproduce

  1. Start nvim
  2. Start insertmode and type /
  3. <c-x><c-f> should show a menu with suggested completions like /bin and /etc
  4. Press <cr> to accept first suggestion

Actual behavior

A new line is created instead accepting the first suggestion. This only happens when bullets is loaded.

Expected behavior

The first suggestion should be selected instead of creating a new line. This would also be vims default behavior with set completeopt=menu,noinsert.

Notes

This is probably the reason for issue #74. You said there that you select the completion manually with <c-p> and<c-n>. Many people just accept the first suggestion with .

astier avatar Jul 29 '20 20:07 astier

I would suggest that bullets should not modify <cr> if pumvisible is true.

astier avatar Jul 29 '20 20:07 astier

Thanks @astier, I'm happy to take PRs!

dkarter avatar Jul 29 '20 21:07 dkarter

For anyone using coc: https://github.com/neoclide/coc.nvim/wiki/Completion-with-sources#use-cr-to-confirm-completion

You have to replace <cr> with <Plug>(bullets-newline) e.g.

let g:bullets_set_mappings = 0
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm() : "<Plug>(bullets-newline)"

eight04 avatar Nov 10 '23 19:11 eight04