roxma / nvim-completion-manager

:warning: PLEASE USE https://github.com/ncm2/ncm2 INSTEAD
MIT License
917 stars 49 forks source link

Mapping keys to complete first match of omni complete function #187

Open dweidner opened 6 years ago

dweidner commented 6 years ago

I wanted to follow a tip to auto complete the name of the current HTML tag, whenever I start typing the closing tag from the Vim Tipps Wiki

" ftplugin/html.vim
inoremap <buffer> <lt>/ <lt>/<C-x><C-o><Esc>==gi

This works perfectly as long I am not using the nvim-completion-manager in my vimrc. For example typing…

<!-- test.html -->
<p>Hello World</

…completes to…

<!-- test.html -->
<p>Hello World</p>

When I enable nvim-completion-manager I can use the key combination <C-X><C-o> to open the popup menu and <C-o> to select the first match. Unfortunatly adjusting the previous keybinding to…

inoremap <buffer> <lt>/ <lt>/<C-x><C-o><C-o><Esc>==gi

…does not do the trick.

I think the problem is, that the tag suggestions loaded asynchronously are not available when the key mapping is executed and as a consequence no match can be selected from the popup menu.

Is there any workaround I could use?

Using neovim 0.2.2 on macOS 10.13.2 with the latest version of nvim-completion-manager.