This is a fast, extensible, async completion framework forneovim. For more information about pluginimplementation, please read the Why section.
Future updates, announcements, screenshots will be postedhere.Subscribe it if you are interested.
Language / Description | Repository |
---|---|
Word from current buffer | builtin |
Word from tmux session | builtin |
ctags completion | builtin |
Filepath completion | builtin |
Python | builtin, requires jedi |
Css | builtin, requires csscomplete#CompleteCSS |
Golang | builtin, requires gocode |
Ultisnips hint | builtin, requires Ultisnips |
Snipmate hint | builtin, requires vim-snipmate |
neosnippet hint | builtin, requires neosnippet.vim |
Language Server Protocol | autozimu/LanguageClient-neovim |
C/C++ | clang_complete [DEPRECATED] |
C/C++ | ncm-clang |
Javascript | nvim-cm-tern |
Javascript | nvim-cm-flow |
elm | ncm-elm-oracle |
Clojure | clojure-async-clj-omni |
Rust | nvim-cm-racer |
Vimscript | Shougo/neco-vim |
Ruby | ncm-rct-complete |
PHP | LanguageServer-php-neovim |
PHP | ncm-phpactor |
Swift | dafufer/nvim-cm-swift-completer |
gtags completion | jsfaint/gen_tags.vim |
syntax completion | Shougo/neco-syntax |
include completion | Shougo/neoinclude |
github completion | ncm-github |
mutt mails | #97 mutt-aliases.vim |
deoplete | #50 deoplete |
css | calebeby/ncm-css |
lbdb (addressbook) | katsika/ncm-lbdb |
Java | sassanh/nvim-cm-eclim |
TypeScript | mhartington/nvim-typescript |
Word from other buffers | fgrsnau/ncm-otherbuf |
R | gaalcaras/ncm-R |
:help ncm-source-examples
for minimal examplesPlease announce your new pluginhere afteryou've created the extension.
echo has("python3")
g:python3_host_prog
pointed to your python3 executable, or echo exepath('python3')
is not empty.pip3 install neovim
)" the framework
Plug 'roxma/nvim-completion-manager'
" Requires vim8 with has('python') or has('python3')
" Requires the installation of msgpack-python. (pip install msgpack-python)
if !has('nvim')
Plug 'roxma/vim-hug-neovim-rpc'
endif
# neovim is the required pip module
# jedi for python completion
# psutil (optional)
# setproctitle (optional)
pip3 install --user neovim jedi psutil setproctitle
(Optional) It's easier to usepython-support.nvim to helpmanage your pip modules for neovim:
" don't give |ins-completion-menu| messages. For example,
" '-- XXX completion (YYY)', 'match 1 of 2', 'The only match',
set shortmess+=c
<Enter>
key is pressed while the popup menu is visible, it onlyhides the menu. Use this mapping to hide the menu and also start a new line.inoremap <expr> <CR> (pumvisible() ? "\<c-y>\<cr>" : "\<CR>")
<Enter>
key. Suppose you use the <C-U>
key for expanding snippet.imap <expr> <CR> (pumvisible() ? "\<c-y>\<Plug>(expand_or_nl)" : "\<CR>")
imap <expr> <Plug>(expand_or_nl) (cm#completed_is_snippet() ? "\<C-U>":"\<CR>")
CTRL-C
key to leave insert mode, it does not trigger theautocmd InsertLeave
. You should use CTRL-[
, or map the <c-c>
to<ESC>
.inoremap <c-c> <ESC>
<TAB>
to select the popup menu:inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" css completion via `csscomplete#CompleteCSS`
" The `'cm_refresh_patterns'` is PCRE.
" Be careful with `'scoping': 1` here, not all sources, especially omnifunc,
" can handle this feature properly.
au User CmSetup call cm#register_source({'name' : 'cm-css',
\ 'priority': 9,
\ 'scoping': 1,
\ 'scopes': ['css','scss'],
\ 'abbreviation': 'css',
\ 'word_pattern': '[\w\-]+',
\ 'cm_refresh_patterns':['[\w\-]+\s*:\s+'],
\ 'cm_refresh': {'omnifunc': 'csscomplete#CompleteCSS'},
\ })
Warning: omnifunc
is implemented in a synchronouse style, andvim-vimscript is single threaded, it would potentially block the ui with theintroduction of a heavy weight omnifunc
, for example the builtinphpcomplete. If you get some time, please try implementing a source for NCM asa replacement for the old style omnifunc.
There's no guarantee that this plugin will be compatible with othercompletion plugin in the same buffer. Use let g:cm_smart_enable=0
andcall cm#enable_for_buffer()
to use this plugin for specific buffer.
This example shows how to disable NCM's builtin tag completion. It's alsopossible to use g:cm_sources_override
to override other default options ofa completion source.
let g:cm_sources_override = {
\ 'cm-tags': {'enable':0}
\ }
This project was started just for fun, and it's working pleasingly for me now.However, it seems there's lots of differences between deoplete, YCM, andnvim-completion-manager, by implementation.
I haven't read the source of YCM yet. So here I'm describing the basicimplementation of NCM (short for nvim-completion-manager) and some of thedifferences between deoplete and this plugin.
Each completion source should be a thread or a standalone process, the managernotifies the completion source for any text changing, even when popup menu isvisible. The completion source notifies the manager if there's any completematches available. After some basic priority sorting between completionsources, and some simple filtering, the completion popup menu will betriggered with the complete()
function by the completion manager.
If some of the completion source is calculating matches for a long long time,the popup menu will still be shown quickly if other completion sources workproperly. And if the user hasn't changed anything, the popup menu will beupdated after the slow completion source finishes the work.
As the time as of this plugin being created, the completion sources ofdeoplete are gathered with gather_candidates()
of the Source
object,inside a for loop, in deoplete's process. A slow completion source may deferthe display of popup menu. Of course it will not block the ui.
The good news is that deoplete has supported async gather_candidates
now.But still, NCM is potentially faster because all completion sources run inparallel.
I write markdown files with code blocks quite often, so I've also implementedlanguage specific completion for markdown file. This is a framework feature,which is called scoping. It should work for any markdown code block whoselanguage completion source is avaible to NCM. I've also added support forjavascript completion in script tag of html files, and css completion in styletag.
The idea was originated invim-syntax-compl-pop. Sinceit's pure vimscript implementation, and there are some limitations currentlywith neovim's syntax api. It's very likely that vim-syntax-compl-pop doesn'twork, for example, javascript completion in markdown or html script tag. So Iuse custom parser in NCM to implement the scoping features.
Note that there's some hacking done in NCM. It uses a per 30ms timer to detectchanges even popup menu is visible, as well as using the TextChangedI
event,which only triggers when no popup menu is visible. This is important forimplementing the async architecture. I'm hoping one day neovim will offerbetter option rather than a timer or the limited TextChangedI
.
YouCompleteMe has goodexplanation.
Moved to wiki
黑客对linux发展贡献是非常多的。Bash命令自动完成功能只不过是收集各种黑客指定参数是如何通过Readline使用内置完成来完成的。该功能在其他linux分支是启用的,如ubuntu、debian等等。然而,基于RHCE分支发布的linux版本却没有安装和启用,如CentOS。 如果你使用过ubuntu系统,bash命令自动补齐会觉得非常方便高效。再使用RHCE或CentOS的话,你肯定会吐槽
ansible-completion Provide a bash completion on host name, module name and options for ansible. Important As of Ansible 2.9, you can add shell completion of the Ansible command line utilities by insta
nvim-cmp 是一个用 Lua 编码的 Neovim 补全插件。 特性: 自动支持成对插件 通过 Lua 函数完全可定制 完全支持 LSP 的完成功能 Snippets 提交字符 触发字符 TextEdit 和 InsertReplaceTextEdit AdditionalTextEdits Markdown 文档 执行命令(某些 LSP 服务器需要它自动导入。例如sumneko_lua或p
这个插件给 coffeescripting (node.js) 提供了一个 rpc-plugin host,以及一组由 vimscript 启发的指令。 Lib Nvim = { # neovim-client API... # all functions can be called sync/async depending if you pass a callback }# Global
Nvim-R 是 R 工作在 Neovim 的插件。 安装 如果您使用插件管理器(例如vim-plug),请遵循其有关如何从github安装插件的说明。 要安装插件的稳定版本,如果使用vim-plug,请将其放在vimrc/中init.vim: Plug 'jalvesaq/Nvim-R', {'branch': 'stable'} 该stable分支是最新发行版本的副本,以及发行后最终发现的小错
nvim-hs 是 Neovim API 的 Haskell 插件的插件提供者。