:heart: Slim, Fast and Hackable Completion Framework for Neovim
NCM2, formerly known as nvim-completion-manager, is a slim, fast and hackable completion framework for neovim.
Main features:
Read our wiki page for a list of extensions and programming languages support for NCM2.
:echo has("nvim-0.2.2")prints 1. Older versions has not been tested
:echo has("python3")prints 1. This is usually set by
python3 -m pip install pynvimin shell and
let g:python3_host_prog=/path/to/python/executable/in vimrc.
For vim8 user, read the nvim-yarp README. Note that vim8 support is simply a bonus. It's not the goal of NCM2.
" assuming you're using vim-plug: https://github.com/junegunn/vim-plug Plug 'ncm2/ncm2' Plug 'roxma/nvim-yarp'" enable ncm2 for all buffers autocmd BufEnter * call ncm2#enable_for_buffer() " IMPORTANT: :help Ncm2PopupOpen for more information set completeopt=noinsert,menuone,noselect " NOTE: you need to install completion sources to get completions. Check " our wiki page for a list of sources: https://github.com/ncm2/ncm2/wiki Plug 'ncm2/ncm2-bufword' Plug 'ncm2/ncm2-path'
" suppress the annoying 'match x of y', 'The only match' and 'Pattern not " found' messages set shortmess+=c" CTRL-C doesn't trigger the InsertLeave autocmd . map to <esc> instead. inoremap <c-c> <esc> " When the <enter> key is pressed while the popup menu is visible, it only " hides the menu. Use this mapping to close the menu and also start a new " line. inoremap <expr> <cr> (pumvisible() ? "\<c-y>\<cr>" : "\<cr>") " Use <tab> to select the popup menu: inoremap <expr> <tab> pumvisible() ? "\<c-n>" : "\<tab>" inoremap <expr> <s-tab> pumvisible() ? "\<c-p>" : "\<s-tab>" " wrap existing omnifunc " Note that omnifunc does not run in background and may probably block the " editor. If you don't want to be blocked by omnifunc too often, you could " add 180ms delay before the omni wrapper: " 'on_complete': ['ncm2#on_complete#delay', 180, " \ 'ncm2#on_complete#omni', 'csscomplete#CompleteCSS'], au User Ncm2Plugin call ncm2#register_source({ \ 'name' : 'css', \ 'priority': 9, \ 'subscope_enable': 1, \ 'scope': ['css','scss'], \ 'mark': 'css', \ 'word_pattern': '[\w\-]+', \ 'complete_pattern': ':\s*', \ 'on_complete': ['ncm2#on_complete#omni', 'csscomplete#CompleteCSS'], \ })
One important step is to understand how and when completion gets triggered. Read
:help ncm2#register_sourcecarefully, or
:help ncm2#register_source-examplefor quick start.
In case you don't know what tool you should use for async support. Here are some options available:
:help jobstart()
Refer to the debugging section of nvim-yarp