Skip to content

Commit 9a9c02e

Browse files
committed
configure asyncomplete for conjure
1 parent e912035 commit 9a9c02e

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

config/local.plugins.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,13 +218,21 @@
218218
# Completion and code analysis
219219
# ----------
220220

221+
- repo: prabirshrestha/asyncomplete.vim
222+
on_source: asyncomplete-lsp.vim
223+
hook_add: let g:asyncomplete_auto_completeopt = 0
224+
hook_source: source $VIM_PATH/config/local.plugins/asyncomplete.vim
225+
221226
- repo: thecontinium/asyncomplete-conjure.vim
222227
on_source: asyncomplete.vim
223228
hook_source: |
224229
autocmd User asyncomplete_setup call asyncomplete#register_source(
225230
\ asyncomplete#sources#conjure#get_source_options({
226231
\ 'name': 'conjure',
227232
\ 'allowlist': ['clojure'],
233+
\ 'time': 20,
234+
\ 'triggers': {'*': ['/']},
235+
\ 'priority': 1,
228236
\ 'completor': function('asyncomplete#sources#conjure#completor'),
229237
\ }))
230238
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
source $VIM_PATH/config/plugins/denite.vim
2+
3+
" Pre-processors
4+
" ---
5+
6+
function! s:sort_by_priority_preprocessor(options, matches) abort
7+
let l:items = []
8+
for [l:source_name, l:matches] in items(a:matches)
9+
for l:item in l:matches['items']
10+
if stridx(l:item['word'], a:options['base']) == 0
11+
let l:item['priority'] =
12+
\ get(asyncomplete#get_source_info(l:source_name), 'priority', 1)
13+
call add(l:items, l:item)
14+
endif
15+
endfor
16+
endfor
17+
let l:items = sort(l:items, {a, b -> b['priority'] - a['priority']})
18+
call asyncomplete#preprocess_complete(a:options, l:items)
19+
endfunction
20+
21+
let g:asyncomplete_preprocessor = [function('s:sort_by_priority_preprocessor')]
22+
23+
" vim: set ts=2 sw=2 tw=80 noet :

0 commit comments

Comments
 (0)