- Notifications
You must be signed in to change notification settings - Fork43
❤️ Slim, Fast and Hackable Completion Framework for Neovim
License
NotificationsYou must be signed in to change notification settings
ncm2/ncm2
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Ncm2 is a slim, async and hackable completion framework for neovim.
Main features:
- Fast and asynchronous completion support, with vimscript friendly API.
- Smart on files with different languages, for example, css/javascriptcompletion in html style/script tag.
- Function parameter expansion support usingncm2-snippet plugins.
- Language server protocol pluginintegration.
Readour wiki page for a list ofextensions and programming languages support for NCM2.
Forlazy.nvim
return {-- requirements {"roxma/nvim-yarp"}, {"ncm2/ncm2",config=function()vim.opt.completeopt= {"noinsert","menuone","noselect"}vim.api.nvim_create_autocmd({'BufEnter'}, {pattern= {'*'},callback=function(ev)vim.call('ncm2#enable_for_buffer')end })end, },-- 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 {'ncm2/ncm2-bufword'}, {'ncm2/ncm2-path'},}
Forvim-plug
" assuming you're using vim-plug: https://github.com/junegunn/vim-plug Plug'ncm2/ncm2' Plug'roxma/nvim-yarp'" enable ncm2 for all buffersautocmdBufEnter*callncm2#enable_for_buffer()" IMPORTANT: :help Ncm2PopupOpen for more informationsetcompleteopt=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' messagessetshortmess+=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'],auUserNcm2Plugincallncm2#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_source carefully, or:help ncm2#register_source-example for quick start.
In case you don't know what tool you should use for async support. Here aresome options available:
:help jobstart()- python remote pluginexample
- I myself prefer to usenvim-yarp
- Readncm2/ncm2-bufword forexample
Refer to thedebugging section of nvim-yarp
About
❤️ Slim, Fast and Hackable Completion Framework for Neovim
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.
