All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 *asyncomplete.vim.txt* Async autocompletion for Vim 8 and Neovim.
5 ===============================================================================
6 CONTENTS *asyncomplete-contents*
8 1. Introduction |asyncomplete-introduction|
9 2. Options |asyncomplete-options|
10 3. Functions |asyncomplete-functions|
11 4. Global vim configuration |asyncomplete-global-config|
12 5. Known Issues |asyncomplete-known-issues|
14 ===============================================================================
15 1. Introduction *asyncomplete-introduction*
17 Async autocompletion for Vim 8 and Neovim with |timers|.
19 This is inspired by https://github.com/roxma/nvim-complete-manager but written
22 ===============================================================================
23 2. Options *asyncomplete-options*
26 g:asyncomplete_enable_for_all *g:asyncomplete_enable_for_all*
31 Enable asyncomplete for all buffers. Can be overriden with
32 `b:asyncomplete_enable` on a per-buffer basis. Setting this to 0 prevents
33 asyncomplete from loading upon entering a buffer.
35 b:asyncomplete_enable *b:asyncomplete_enable*
40 Setting this variable to 0 disables asyncomplete for the current buffer
41 and overrides `g:asyncomplete_enable_for_all` .
43 g:asyncomplete_auto_popup *g:asyncomplete_auto_popup*
48 Automatically show the autocomplete popup menu as you start typing.
50 g:asyncomplete_log_file *g:asyncomplete_log_file*
57 g:asyncomplete_popup_delay *g:asyncomplete_popup_delay*
62 Milliseconds to wait before opening the popup menu
64 g:asyncomplete_auto_completeopt *g:asyncomplete_auto_completeopt*
69 Set default `completeopt` options. These are `menuone,noinsert,noselect`.
70 This effectively overwrites what ever the user has in their config file.
74 g:asyncomplete_preprocessor *g:asyncomplete_preprocessor*
76 Type: |Array| for zero or one |Function|
79 Set a function to allow custom filtering or sorting.
80 Below example implements removing duplicates.
82 function! s:my_asyncomplete_preprocessor(options, matches) abort
85 for [l:source_name, l:matches] in items(a:matches)
86 for l:item in l:matches['items']
87 if stridx(l:item['word'], a:options['base']) == 0
88 if !has_key(l:visited, l:item['word'])
89 call add(l:items, l:item)
90 let l:visited[l:item['word']] = 1
96 call asyncomplete#preprocess_complete(a:options, l:items)
99 let g:asyncomplete_preprocessor = [function('s:my_asyncomplete_preprocessor')]
102 asyncomplete#preprocess_complete() must be called synchronously.
103 Plans to support async preprocessing will be supported in the future.
105 context and matches in arguments in preprecessor function should be treated
108 g:asyncomplete_min_chars *g:asyncomplete_min_chars*
113 Minimum consecutive characters to trigger auto-popup. Overridden by buffer
114 variable if set (`b:asyncomplete_min_chars`)
116 g:asyncomplete_matchfuzzy *g:asyncomplete_matchfuzzy*
119 Default: `exists('*matchfuzzypos')`
121 Use |matchfuzzypos| to support fuzzy matching of 'word' when completing
122 items. Requires vim with `matchfuzzypos()` function to exists.
124 Set to `0` to disable fuzzy matching.
126 ===============================================================================
127 3. Functions *asyncomplete-functions*
129 asyncomplete#close_popup() *asyncomplete#close_popup()*
131 Insert selected candidate and close popup menu.
132 Following example prevents popup menu from re-opening after insertion.
134 inoremap <expr> <C-y> pumvisible() ? asyncomplete#close_popup() : "\<C-y>"
136 asyncomplete#cancel_popup() *asyncomplete#cancel_popup()*
138 Cancel completion and close popup menu.
139 Following example prevents popup menu from re-opening after cancellation.
141 inoremap <expr> <C-e> pumvisible() ? asyncomplete#cancel_popup() : "\<C-e>"
143 asyncomplete#get_source_info({source-name}) *asyncomplete#get_source_info()*
145 Get the source configuration info as dict.
146 Below example implements a priority sort function.
148 function! s:sort_by_priority_preprocessor(options, matches) abort
150 for [l:source_name, l:matches] in items(a:matches)
151 for l:item in l:matches['items']
152 if stridx(l:item['word'], a:options['base']) == 0
153 let l:item['priority'] =
154 \ get(asyncomplete#get_source_info(l:source_name),'priority',0)
155 call add(l:items, l:item)
160 let l:items = sort(l:items, {a, b -> b['priority'] - a['priority']})
162 call asyncomplete#preprocess_complete(a:options, l:items)
165 let g:asyncomplete_preprocessor = [function('s:sort_by_priority_preprocessor')]
167 asyncomplete#get_source_names() *asyncomplete#get_source_names()*
169 Get the registered source names list.
171 ===============================================================================
172 4. Global vim configuration *asyncomplete-global-config*
174 If you notice messages like 'Pattern not found' or 'Match 1 of <N>' printed in
175 red colour in vim command line and in `:messages` history and you are annoyed
176 with them, try setting `shortmess` vim option in your `.vimrc` like so:
180 See `:help shortmess` for details and description.
182 ===============================================================================
183 5. Known Issues *asyncomplete-known-issues*
185 Builtin complete such as omni func, file func flickers and closes.
186 You need vim with patch v8.1.1068.
187 https://github.com/vim/vim/commit/fd133323d4e1cc9c0e61c0ce357df4d36ea148e3
189 ===============================================================================
191 vim:tw=78:ts=4:sts=4:sw=4:ft=help:norl: