{"id":13395406,"url":"https://github.com/roxma/nvim-completion-manager","last_synced_at":"2025-10-02T23:35:30.276Z","repository":{"id":82181165,"uuid":"79793178","full_name":"roxma/nvim-completion-manager","owner":"roxma","description":":warning: PLEASE USE https://github.com/ncm2/ncm2 INSTEAD","archived":true,"fork":false,"pushed_at":"2018-07-27T09:13:49.000Z","size":558,"stargazers_count":917,"open_issues_count":32,"forks_count":49,"subscribers_count":33,"default_branch":"master","last_synced_at":"2024-09-29T06:06:08.819Z","etag":null,"topics":["auto-complete","completion","golang","javascript","markdown","neovim","nvim","python","vim8"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/roxma.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-01-23T10:13:28.000Z","updated_at":"2024-03-20T08:11:45.000Z","dependencies_parsed_at":"2023-03-08T12:00:28.277Z","dependency_job_id":null,"html_url":"https://github.com/roxma/nvim-completion-manager","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxma%2Fnvim-completion-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxma%2Fnvim-completion-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxma%2Fnvim-completion-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxma%2Fnvim-completion-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roxma","download_url":"https://codeload.github.com/roxma/nvim-completion-manager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235051520,"owners_count":18928177,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["auto-complete","completion","golang","javascript","markdown","neovim","nvim","python","vim8"],"created_at":"2024-07-30T17:01:57.128Z","updated_at":"2025-10-02T23:35:24.966Z","avatar_url":"https://github.com/roxma.png","language":"Python","readme":"# :warning: THIS REPO IS DEPRECATED. USE [NCM2](https://github.com/ncm2/ncm2) INSTEAD.\n\n---\n\n:heart: for my favorite editor\n\n# A Completion Framework for Neovim\n\nThis is a **fast, extensible, async completion framework** for\n[neovim](https://github.com/neovim/neovim).  For more information about plugin\nimplementation, please read the **[Why](#why) section**.\n\nFuture updates, announcements, screenshots will be posted\n**[here](https://github.com/roxma/nvim-completion-manager/issues/12).\nSubscribe it if you are interested.**\n\n![All in one screenshot](https://cloud.githubusercontent.com/assets/4538941/23752974/8fffbdda-0512-11e7-8466-8a30f480de21.gif)\n\n\n## Table of Contents\n\n\u003c!-- vim-markdown-toc GFM --\u003e\n\n* [Features](#features)\n* [Scoping Sources:](#scoping-sources)\n* [Completion Sources](#completion-sources)\n* [How to extend this framework?](#how-to-extend-this-framework)\n* [Requirements](#requirements)\n* [Installation](#installation)\n* [Optional Configuration Tips](#optional-configuration-tips)\n* [Why?](#why)\n    * [Async architecture](#async-architecture)\n    * [Scoping](#scoping)\n    * [Experimental hacking](#experimental-hacking)\n* [FAQ](#faq)\n    * [Why Python?](#why-python)\n* [Trouble-shooting](#trouble-shooting)\n* [Related Projects](#related-projects)\n\n\u003c!-- vim-markdown-toc --\u003e\n\n\n## Features\n\n1. Asynchronous completion support like deoplete.\n2. Faster, all completions should run in parallel.\n3. Smarter on files with different languages, for example, css/javascript\ncompletion in html style/script tag.\n4. Extensible async vimscript API and python3 API.\n5. Function parameter expansion via\n   [Ultisnips](https://github.com/SirVer/ultisnips),\n   [neosnippet.vim](https://github.com/Shougo/neosnippet.vim) or\n   [vim-snipmate](https://github.com/garbas/vim-snipmate).\n\n\n## Scoping Sources:\n\n- Language specific completion for markdown, reStructuredText\n- Javascript code completion in html script tag\n- Css code completion in html style tag\n\n## Completion Sources\n\n| Language / Description   | Repository                                                                             |\n|--------------------------|----------------------------------------------------------------------------------------|\n| Word from current buffer | builtin                                                                                |\n| Word from tmux session   | builtin                                                                                |\n| ctags completion         | builtin                                                                                |\n| Filepath completion      | builtin                                                                                |\n| Python                   | builtin, requires [jedi](https://github.com/davidhalter/jedi)                          |\n| Css                      | builtin, requires [csscomplete#CompleteCSS](https://github.com/othree/csscomplete.vim) |\n| Golang                   | builtin, requires [gocode](https://github.com/nsf/gocode)                              |\n| Ultisnips hint           | builtin, requires [Ultisnips](https://github.com/SirVer/ultisnips)                     |\n| Snipmate hint            | builtin, requires [vim-snipmate](https://github.com/garbas/vim-snipmate)               |\n| neosnippet hint          | builtin, requires [neosnippet.vim](https://github.com/Shougo/neosnippet.vim)           |\n| Language Server Protocol | [autozimu/LanguageClient-neovim](https://github.com/autozimu/LanguageClient-neovim)    |\n| C/C++                    | [clang_complete](https://github.com/roxma/clang_complete) [DEPRECATED]                 |\n| C/C++                    | [ncm-clang](https://github.com/roxma/ncm-clang)                                        |\n| Javascript               | [nvim-cm-tern](https://github.com/roxma/nvim-cm-tern)                                  |\n| Javascript               | [nvim-cm-flow](https://github.com/roxma/ncm-flow)                                      |\n| elm                      | [ncm-elm-oracle](https://github.com/roxma/ncm-elm-oracle)                              |\n| Clojure                  | [clojure-async-clj-omni](https://github.com/clojure-vim/async-clj-omni)                |\n| Rust                     | [nvim-cm-racer](https://github.com/roxma/nvim-cm-racer)                                |\n| Vimscript                | [Shougo/neco-vim](https://github.com/Shougo/neco-vim)                                  |\n| Ruby                     | [ncm-rct-complete](https://github.com/roxma/ncm-rct-complete)                          |\n| PHP                      | [LanguageServer-php-neovim](https://github.com/roxma/LanguageServer-php-neovim)        |\n| PHP                      | [ncm-phpactor](https://github.com/roxma/ncm-phpactor)                                  |\n| Swift                    | [dafufer/nvim-cm-swift-completer](https://github.com/dafufer/nvim-cm-swift-completer)  |\n| gtags completion         | [jsfaint/gen_tags.vim](https://github.com/jsfaint/gen_tags.vim)                        |\n| syntax completion        | [Shougo/neco-syntax](https://github.com/Shougo/neco-syntax)                            |\n| include completion       | [Shougo/neoinclude](https://github.com/Shougo/neoinclude.vim)                          |\n| github completion        | [ncm-github](https://github.com/roxma/ncm-github)                                      |\n| mutt mails               | [#97 mutt-aliases.vim](https://github.com/roxma/nvim-completion-manager/issues/97)     |\n| deoplete                 | [#50 deoplete](https://github.com/roxma/nvim-completion-manager/issues/50)             |\n| css                      | [calebeby/ncm-css](https://github.com/calebeby/ncm-css)                                |\n| lbdb (addressbook)       | [katsika/ncm-lbdb](https://github.com/katsika/ncm-lbdb)                                |\n| Java                     | [sassanh/nvim-cm-eclim](https://github.com/sassanh/nvim-cm-eclim)                      |\n| TypeScript               | [mhartington/nvim-typescript](https://github.com/mhartington/nvim-typescript)          |\n| Word from other buffers  | [fgrsnau/ncm-otherbuf](https://github.com/fgrsnau/ncm-otherbuf)\n| R                        | [gaalcaras/ncm-R](https://github.com/gaalcaras/ncm-R)\n\n\n## How to extend this framework?\n\n- `:help ncm-source-examples` for minimal examples\n- Some real, small examples:\n  [github-emoji](https://github.com/roxma/ncm-github/blob/master/pythonx/cm_sources/github_emoji.py),\n  [nvim-cm-racer](https://github.com/roxma/nvim-cm-racer)\n\nPlease announce your new plugin\n[here](https://github.com/roxma/nvim-completion-manager/issues/12) after\nyou've created the extension.\n\n\n## Requirements\n\n- For Neovim:\n  - `echo has(\"python3\")`\n- For Vim 8:\n  - [roxma/vim-hug-neovim-rpc](https://github.com/roxma/vim-hug-neovim-rpc)\n  - `g:python3_host_prog` pointed to your python3 executable, or `echo\n      exepath('python3')` is not empty.\n  - [neovim python client](https://github.com/neovim/python-client) (`pip3\n      install neovim`)\n\n## Installation\n\n- Assuming you're using [vim-plug](https://github.com/junegunn/vim-plug)\n\n```vim\n\" the framework\nPlug 'roxma/nvim-completion-manager'\n```\n\n- If you are **vim8 user**, you'll need\n  [vim-hug-neovim-rpc](https://github.com/roxma/vim-hug-neovim-rpc). The vim8\n  support layer is still experimental, please 'upgrade' to\n  [neovim](https://github.com/neovim/neovim) if it's possible.\n\n```vim\n\" Requires vim8 with has('python') or has('python3')\n\" Requires the installation of msgpack-python. (pip install msgpack-python)\nif !has('nvim')\n    Plug 'roxma/vim-hug-neovim-rpc'\nendif\n```\n\n- Install pip modules for your neovim python3:\n\n```sh\n# neovim is the required pip module\n# jedi for python completion\n# psutil (optional)\n# setproctitle (optional)\npip3 install --user neovim jedi psutil setproctitle\n```\n\n(Optional) It's easier to use\n[python-support.nvim](https://github.com/roxma/python-support.nvim) to help\nmanage your pip modules for neovim:\n\n## Optional Configuration Tips\n\n- Supress the annoying completion messages:\n\n```vim\n\" don't give |ins-completion-menu| messages.  For example,\n\" '-- XXX completion (YYY)', 'match 1 of 2', 'The only match',\nset shortmess+=c\n```\n\n- When the  `\u003cEnter\u003e` key is pressed while the popup menu is visible, it only\n  hides the menu. Use this mapping to hide the menu and also start a new line.\n\n```vim\ninoremap \u003cexpr\u003e \u003cCR\u003e (pumvisible() ? \"\\\u003cc-y\u003e\\\u003ccr\u003e\" : \"\\\u003cCR\u003e\")\n```\n\n- Here is an example for expanding snippet in the popup menu with `\u003cEnter\u003e`\n  key.  Suppose you use the `\u003cC-U\u003e` key for expanding snippet.\n\n```vim\nimap \u003cexpr\u003e \u003cCR\u003e  (pumvisible() ?  \"\\\u003cc-y\u003e\\\u003cPlug\u003e(expand_or_nl)\" : \"\\\u003cCR\u003e\")\nimap \u003cexpr\u003e \u003cPlug\u003e(expand_or_nl) (cm#completed_is_snippet() ? \"\\\u003cC-U\u003e\":\"\\\u003cCR\u003e\")\n```\n\n- When using `CTRL-C` key to leave insert mode, it does not trigger the\n  autocmd `InsertLeave`. You should use `CTRL-[`, or map the `\u003cc-c\u003e` to\n  `\u003cESC\u003e`.\n\n```vim\ninoremap \u003cc-c\u003e \u003cESC\u003e\n```\n\n- Use `\u003cTAB\u003e` to select the popup menu:\n\n```vim\ninoremap \u003cexpr\u003e \u003cTab\u003e pumvisible() ? \"\\\u003cC-n\u003e\" : \"\\\u003cTab\u003e\"\ninoremap \u003cexpr\u003e \u003cS-Tab\u003e pumvisible() ? \"\\\u003cC-p\u003e\" : \"\\\u003cS-Tab\u003e\"\n```\n\n- If 'omnifunc' is the only available option, you may register it as a source\n  for NCM.\n \n \n```vim\n\" css completion via `csscomplete#CompleteCSS`\n\" The `'cm_refresh_patterns'` is PCRE.\n\" Be careful with `'scoping': 1` here, not all sources, especially omnifunc,\n\" can handle this feature properly.\nau User CmSetup call cm#register_source({'name' : 'cm-css',\n        \\ 'priority': 9, \n        \\ 'scoping': 1,\n        \\ 'scopes': ['css','scss'],\n        \\ 'abbreviation': 'css',\n        \\ 'word_pattern': '[\\w\\-]+',\n        \\ 'cm_refresh_patterns':['[\\w\\-]+\\s*:\\s+'],\n        \\ 'cm_refresh': {'omnifunc': 'csscomplete#CompleteCSS'},\n        \\ })\n```\n\n**Warning:** `omnifunc` is implemented in a synchronouse style, and\nvim-vimscript is single threaded, it would potentially block the ui with the\nintroduction of a heavy weight `omnifunc`, for example the builtin\nphpcomplete. If you get some time, please try implementing a source for NCM as\na replacement for the old style omnifunc.\n\n\n- There's no guarantee that this plugin will be compatible with other\n  completion plugin in the same buffer. Use `let g:cm_smart_enable=0` and\n  `call cm#enable_for_buffer()` to use this plugin for specific buffer.\n\n- This example shows how to disable NCM's builtin tag completion. It's also\n  possible to use `g:cm_sources_override` to override other default options of\n  a completion source.\n\n```vim\nlet g:cm_sources_override = {\n    \\ 'cm-tags': {'enable':0}\n    \\ }\n```\n\n## Why?\n\nThis project was started just for fun, and it's working pleasingly for me now.\nHowever, it seems there's lots of differences between deoplete, YCM, and\nnvim-completion-manager, by implementation.\n\nI haven't read the source of YCM yet. So here I'm describing the basic\nimplementation of NCM (short for nvim-completion-manager) and some of the\ndifferences between deoplete and this plugin.\n\n### Async architecture\n\nEach completion source should be a thread or a standalone process, the manager\nnotifies the completion source for any text changing, even when popup menu is\nvisible.  The completion source notifies the manager if there's any complete\nmatches available. After some basic priority sorting between completion\nsources, and some simple filtering, the completion popup menu will be\ntriggered with the `complete()` function by the completion manager.\n\nIf some of the completion source is calculating matches for a long long time,\nthe popup menu will still be shown quickly if other completion sources work\nproperly. And if the user hasn't changed anything, the popup menu will be\nupdated after the slow completion source finishes the work.\n\nAs the time as of this plugin being created, the completion sources of\ndeoplete are gathered with `gather_candidates()` of the `Source` object,\ninside a for loop, in deoplete's process. A slow completion source may defer\nthe display of popup menu. Of course it will not block the ui.\n\nThe good news is that deoplete has supported async `gather_candidates` now.\nBut still, NCM is potentially faster because all completion sources run in\nparallel.\n\n### Scoping\n\nI write markdown files with code blocks quite often, so I've also implemented\nlanguage specific completion for markdown file. This is a framework feature,\nwhich is called scoping. It should work for any markdown code block whose\nlanguage completion source is avaible to NCM. I've also added support for\njavascript completion in script tag of html files, and css completion in style\ntag.\n\nThe idea was originated in\n[vim-syntax-compl-pop](https://github.com/roxma/vim-syntax-compl-pop). Since\nit's pure vimscript implementation, and there are some limitations currently\nwith neovim's syntax api. It's very likely that vim-syntax-compl-pop doesn't\nwork, for example, javascript completion in markdown or html script tag.  So I\nuse custom parser in NCM to implement the scoping features.\n\n### Experimental hacking\n\nNote that there's some hacking done in NCM. It uses a per 30ms timer to detect\nchanges even popup menu is visible, as well as using the `TextChangedI` event,\nwhich only triggers when no popup menu is visible. This is important for\nimplementing the async architecture. I'm hoping one day neovim will offer\nbetter option rather than a timer or the limited `TextChangedI`.\n\n## FAQ\n\n### Why Python?\n\nYouCompleteMe has [good\nexplanation](https://github.com/Valloric/YouCompleteMe#why-isnt-ycm-just-written-in-plain-vimscript-ffs).\n\n## Trouble-shooting\n\nMoved to [wiki](https://github.com/roxma/nvim-completion-manager/wiki/Trouble-shooting)\n\n## Related Projects\n\n[asyncomplete.vim](https://github.com/prabirshrestha/asyncomplete.vim)\n\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froxma%2Fnvim-completion-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froxma%2Fnvim-completion-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froxma%2Fnvim-completion-manager/lists"}