forked from Shougo/ddc.vim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathddc.txt
969 lines (717 loc) · 27 KB
/
ddc.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
*ddc.txt* Dark deno-powered completion framework for neovim/Vim8
Version: 0.15
Author: Shougo <Shougo.Matsu at gmail.com>
License: MIT license
CONTENTS *ddc-contents*
Introduction |ddc-introduction|
Install |ddc-install|
Interface |ddc-interface|
Options |ddc-options|
Functions |ddc-functions|
Custom Functions |ddc-custom-functions|
Key mappings |ddc-key-mappings|
Examples |ddc-examples|
Sources |ddc-sources|
Source option |ddc-source-options|
Source params |ddc-source-params|
Filters |ddc-filters|
Filter options |ddc-filter-options|
Filter params |ddc-filter-params|
Create source |ddc-create-source|
Source attributes |ddc-source-attributes|
Candidate attributes |ddc-candidate-attributes|
Create filter |ddc-create-filter|
filter attributes |ddc-filter-attributes|
FAQ |ddc-faq|
Compatibility |ddc-compatibility|
==============================================================================
INTRODUCTION *ddc-introduction*
*ddc* is the abbreviation of "dark deno-powered completion". It provides an
asynchronous keyword completion system in the current buffer.
If you don't want to configure plugins, you don't have to use the plugin.
It does not work with zero configuration. You can use other plugins.
==============================================================================
INSTALL *ddc-install*
Note: Ddc.vim requires Neovim (0.5.0+) or Vim8.2.0662+ (latest is
recommended).
Please install both Deno and "denops.vim".
https://deno.land/
https://github.com/vim-denops/denops.vim
Note: Ddc.vim does not include any sources and filters.
You must install them you want manually.
You can search ddc.vim plugins(sources and filters) from
https://github.com/topics/ddc-vim.
==============================================================================
INTERFACE *ddc-interface*
------------------------------------------------------------------------------
OPTIONS *ddc-options*
Options can be toggled through the use of |ddc#custom#patch_global()|.
For example:
>
" Set a single option
call ddc#custom#patch_global('completionMode', 'manual')
" Pass a dictionary to set multiple options
call ddc#custom#patch_global({
\ 'keywordPattern': '[a-zA-Z_]\w*',
\ 'smartCase': v:true,
\ })
call ddc#custom#patch_filetype(['c', 'cpp'], 'sources', ['around'])
<
The set of available options follows.
*ddc-option-autoCompleteDelay*
autoCompleteDelay
Delay the completion after input in milliseconds.
Default: 0
*ddc-option-autoCompleteEvents*
autoCompleteEvents
The auto completion fired events. It must be list of
|autocmd-events| string.
Default: ["InsertEnter", "TextChangedI", "TextChangedP"]
*ddc-option-backspaceCompletion*
backspaceCompletion
If it is enabled, ddc.vim will complete even when backspace is
typed.
Note: It is disabled by default since backspace completion
will cause completion flicker.
Note: The flicker can reduce by |ddc-option-completionMenu|.
Default: v:false
*ddc-option-completionMenu*
completionMenu
The completion popup menu type. It must be following string.
"native": Use |ins-completion-menu|.
"pum.vim": Use "pum.vim" popup menu instead.
https://github.com/Shougo/pum.vim
It use floating windows for neovim or popup for Vim8
feature.
It can reduce completion flicker.
Note: It is experimental feature.
Default: "native"
*ddc-option-completionMode*
completionMode
The completion mode. It must be following string.
"popupmenu": Use popup menu.
"inline": Use virtual text by |nvim_buf_set_extmark()|.
Note: It is neovim only.
Note: It does not work in command line mode.
"manual": You can display popup menu manually by
|ddc#map#complete()|.
Default: "popupmenu"
*ddc-option-filterOptions*
filterOptions
It is a dictionary that maps filter names to its options.
See also |ddc-filter-options|.
Default: {}
>
" e.g.
call ddc#custom#patch_global('filterOptions', {
\ 'matcher_head': {},
\ })
<
*ddc-option-filterParams*
filterParams
It is a dictionary that maps filter names to its parameters.
Default: {}
>
" e.g.
call ddc#custom#patch_global('filterParams', {
\ 'matcher_head': {},
\ })
<
*ddc-option-inlineHighlight*
inlineHighlight
The highlight of |ddc-option-completionMode|'s inline text.
Default: "Comment"
*ddc-option-keywordPattern*
keywordPattern
It defines the keyword pattern for completion.
Note: It is JavaScript regexp.
Note: "\k" is converted to 'iskeyword' pattern.
Default: '\k*'
*ddc-option-overwriteCompleteopt*
overwriteCompleteopt
If it is enabled, ddc.vim overwrites 'completeopt'
automatically.
Note: If you disable the feature, you need to change
'completeopt' manually.
Default: v:true
*ddc-option-sources*
sources
It is a list of registered source names. You have to select
one or more sources to use completion.
Candidates from sources with smaller indexes will have smaller
indexes.
Default: []
>
" e.g.
call ddc#custom#patch_global('sources', ['around'])
<
*ddc-option-sourceOptions*
sourceOptions
It is a dictionary that maps source names to its options. The
options with the name "_" is used as the options for all
sources.
See also |ddc-source-options|.
Default: {}
>
" e.g.
call ddc#custom#patch_global('sourceOptions', {
\ '_': {'matchers': ['matcher_head']},
\ 'around': {'mark': 'A'},
\ })
<
*ddc-option-sourceParams*
sourceParams
It is a dictionary that maps source names to its parameters.
See also |ddc-source-params|.
Default: {}
>
" e.g.
call ddc#custom#patch_global('sourceParams', {
\ 'around': {'max': 8},
\ })
<
*ddc-option-specialBufferCompletion*
specialBufferCompletion
If it is false and 'buftype' is not "", ddc auto completion is
disabled automatically.
Default: v:false
------------------------------------------------------------------------------
FUNCTIONS *ddc-functions*
*ddc#disable()*
ddc#disable()
Disable ddc.vim all features permanentlly.
It should be used when ddc.vim is broken.
It should not be used for temporary plugin disable.
Note: It changes the global state.
*ddc#enable()*
ddc#enable()
Enable ddc.vim features and you can use it.
Note: It changes the global state.
*ddc#refresh_candidates()*
ddc#refresh_candidates()
It calls the auto completion of ddc to refresh current
candidates.
*ddc#register()*
ddc#register({dict})
Register source or filter.
The {dict} must have following keys.
name: The filter name
path: The filter path
type: "source" or "filter"
*ddc#register_filter()*
ddc#register_filter({dict})
Note: deprecated.
*ddc#register_source()*
ddc#register_source({dict})
Note: deprecated.
CUSTOM FUNCTIONS *ddc-custom-functions*
*ddc#custom#alias()*
ddc#custom#alias({type}, {alias-name}, {base-name})
Define {alias-name} alias based on {base-name}.
{type} must be "source" or "filter".
Note: It must be called before sources/filters initialization.
>
call ddc#custom#alias('source', 'foo', 'around')
call ddc#custom#patch_global('sources', ['foo'])
call ddc#custom#patch_global('sourceOptions', {
\ '_': {
\ 'matchers': ['matcher_head'],
\ 'sorters': ['sorter_rank'],
\ 'converters': ['converter_remove_overlap'],
\ },
\ 'around': {'mark': 'A'},
\ 'foo': {'mark': 'foo'},
\ })
<
*ddc#custom#get_buffer()*
ddc#custom#get_buffer()
Get current buffer specific options.
*ddc#custom#get_current()*
ddc#custom#get_current()
Get current options.
*ddc#custom#get_filetype()*
ddc#custom#get_filetype()
Get filetype specific options.
*ddc#custom#get_global()*
ddc#custom#get_global()
Get global options.
*ddc#custom#patch_buffer()*
ddc#custom#patch_buffer({option-name}, {value})
ddc#custom#patch_buffer({dict})
Set local options on current buffer. The arguments are the
same as for |ddc#custom#patch_global()|.
*ddc#custom#patch_filetype()*
ddc#custom#patch_filetype({filetype}, {option-name}, {value})
ddc#custom#patch_filetype({filetype}, {dict})
Set options used for filetypes. {filetype} accepts a string or
a list of strings. Options are {dict} or {'{option-name}':
{value}}.
*ddc#custom#patch_global()*
ddc#custom#patch_global({option-name}, {value})
ddc#custom#patch_global({dict})
Set {option-name} option to {value}.
If {dict} is available, the key is {option-name} and the value
is {value}. See |ddc-options| for available {option-name}.
*ddc#custom#set_buffer()*
ddc#custom#set_buffer({dict})
Overwrites all local options on current buffer.
The {dict} is the same as for |ddc#custom#set_global()|.
*ddc#custom#set_filetype()*
ddc#custom#set_filetype({filetype}, {dict})
Overwrites all options used for filetypes. {filetype} accepts
a string or a list of strings.
The {dict} is the same as for |ddc#custom#set_global()|.
*ddc#custom#set_global()*
ddc#custom#set_global({dict})
Overwrites all global config options.
The {dict} key is {option-name} and the value is {value}. See
|ddc-options| for available {option-name}.
------------------------------------------------------------------------------
KEY MAPPINGS *ddc-key-mappings*
*ddc#map#can_complete()*
ddc#map#can_complete()
Return |v:true| if current word completion is available.
*ddc#map#complete()*
ddc#map#complete()
Open current completion popup menu.
Note: It must be in |:map-<expr>|.
*ddc#map#complete_common_string()*
ddc#map#complete_common_string()
Complete common string in candidates.
This can be useful when candidates have a long common prefix.
Note: It must be in |:map-<expr>|.
*ddc#map#insert_candidate()*
ddc#map#insert_candidate({index})
Insert the candidate at index {index}. Indices start at 0.
Note: It must be in |:map-<expr>|.
*ddc#map#manual_complete()*
ddc#map#manual_complete([{sources}])
Manual trigger ddc completion.
You can provide a list of {sources}: It can be the name of a
source or a list of sources name.
Note: It must be in |:map-<expr>|.
==============================================================================
EXAMPLES *ddc-examples*
>
" Customize global settings
" Use around source.
" https://github.com/Shougo/ddc-around
call ddc#custom#patch_global('sources', ['around'])
" Use matcher_head and sorter_rank.
" https://github.com/Shougo/ddc-matcher_head
" https://github.com/Shougo/ddc-sorter_rank
call ddc#custom#patch_global('sourceOptions', {
\ '_': {
\ 'matchers': ['matcher_head'],
\ 'sorters': ['sorter_rank']},
\ })
" Change source options
call ddc#custom#patch_global('sourceOptions', {
\ 'around': {'mark': 'A'},
\ })
call ddc#custom#patch_global('sourceParams', {
\ 'around': {'maxSize': 500},
\ })
" Customize settings on a filetype
call ddc#custom#patch_filetype(
\ ['c', 'cpp'], 'sources', ['around', 'clangd']
\ )
call ddc#custom#patch_filetype(['c', 'cpp'], 'sourceOptions', {
\ 'clangd': {'mark': 'C'},
\ })
call ddc#custom#patch_filetype('markdown', 'sourceParams', {
\ 'around': {'maxSize': 100},
\ })
" Mappings
" <TAB>: completion.
inoremap <silent><expr> <TAB>
\ pumvisible() ? '<C-n>' :
\ (col('.') <= 1 <Bar><Bar> getline('.')[col('.') - 2] =~# '\s') ?
\ '<TAB>' : ddc#map#manual_complete()
" <S-TAB>: completion back.
inoremap <expr><S-TAB> pumvisible() ? '<C-p>' : '<C-h>'
" Use ddc.
call ddc#enable()
<
==============================================================================
SOURCES *ddc-sources*
Note: The sources are not bundled in ddc.vim. You need to install them
to use ddc.vim. Please search them by https://github.com/topics/ddc-source
Note: The default sources are empty. You need to
configure them to use ddc.
The sources must be registered by |ddc#register_source()| or put under
"denops/@ddc-sources/*.ts".
Note: The name is named by file name.
------------------------------------------------------------------------------
SOURCE OPTIONS *ddc-source-options*
Note: The sources cannot set default options for source. If the source need
to specify the recommended configuration, you should write it in the
documentation instead.
*ddc-source-option-converters*
converters (string[])
It is a list of registered filter names that used with this
source. Candidates will be processed in the order you specify
here.
Default: []
*ddc-source-option-dup*
dup (boolean) (Optional)
The candidates will be added even when the same word is
already present.
Default: v:false
*ddc-source-option-forceCompletionPattern*
forceCompletionPattern (string)
If it matches the input, ddc ignores
|ddc-source-option-minAutoCompleteLength|.
Note: It is JavaScript regexp.
Default: ''
*ddc-source-option-ignoreCase*
ignoreCase (boolean)
If it is True, ddc ignores case.
Default: v:false
*ddc-source-option-isVolatile*
isVolatile (boolean)
If it is True, ddc refresh candidates always.
Default: v:false
*ddc-source-option-mark*
mark (string)
A text icon indicating the source displayed with the
candidate.
Note: If the source set candidate menu, the source must set
it. If the attribute is empty string, the candidate menu will
be disabled.
Default: ""
*ddc-source-option-maxAutoCompleteLength*
maxAutoCompleteLength (number)
Ignored length of keyword for auto completion.
It is useful to edit BASE64 files.
Default: 80
*ddc-source-option-maxCandidates*
maxCandidates (number)
If there are more candidates than this value, ddc will ignore
the filtering.
Default: 500
*ddc-source-option-matcherKey*
matcherKey (string)
Matcher compare key instead of "word".
If it is empty string, the feature is disabled.
Default: ""
*ddc-source-option-matchers*
matchers (string[])
It is a list of registered filter names that used with this
source. Candidates will be processed in the order you specify
here.
Default: []
*ddc-source-option-minAutoCompleteLength*
minAutoCompleteLength (number)
Length of keyword required for auto completion.
Default: 2
*ddc-source-option-sorters*
sorters (string[])
It is a list of registered filter names that used with this
source. Candidates will be processed in the order you specify
here.
Default: []
*ddc-source-option-timeout*
timeout (number)
The |ddc-source-attribute-gatherCandidates| timeout for
completion.
Default: 2000
------------------------------------------------------------------------------
SOURCE PARAMS *ddc-source-params*
These are the parameters that each source can have. You can select the
behavior and tune the performance.
Please read the source documentation.
==============================================================================
FILTERS *ddc-filters*
Once candidates have been supplied by one or more sources, they are passed
through the filters, which are matchers, converters or sorters. Sources can
have specific filters.
Note: The filters are not bundled in ddc.vim. You need to install them
to use ddc.vim. Please search them by https://github.com/topics/ddc-filter
Note: The default matchers/sorters/converters are empty. You need to
configure them to use ddc.
The filters must be registered by |ddc#register_filter()| or put under
"denops/@ddc-filters/*.ts".
Note: The name is named by file name.
------------------------------------------------------------------------------
FILTER OPTIONS *ddc-filter-options*
Undefined now
------------------------------------------------------------------------------
FILTER PARAMS *ddc-filter-params*
These are the parameters that each filter can have. You can select the
behavior and tune the performance.
Please read the filter documentation.
==============================================================================
CREATE SOURCE *ddc-create-source*
To create source, you should read other sources implementation.
The files must be registered by |ddc#register_source()|.
Source class must extend the Base class.
Note: The sources must be written in Typescript language.
Note: If you call Vim functions in your source, it is not asynchronous.
------------------------------------------------------------------------------
SOURCE ATTRIBUTES *ddc-source-attributes*
*ddc-source-attribute-events*
events (string[]) (Optional)
List of events for which |ddc-source-attribute-onEvent|
should get called.
Default: []
*ddc-source-attribute-isBytePos*
isBytePos (boolean) (Optional)
If |ddc-source-attribute-getCompletePosition| returns byte
position, it must be true.
It is useful to use Vim script function.
Default: false
*ddc-source-attribute-gatherCandidates*
gatherCandidates (function) (Required)
It is called to gather candidates.
*ddc-source-attribute-getCompletePosition*
getCompletePosition (function) (Optional)
It is called to get the position of the current completion.
*ddc-source-attribute-onCompleteDone*
onCompleteDone (function) (Optional)
Called after the completion.
It is useful to substitute text after completion.
Note: |ddc-candidate-attribute-user_data| must be "UserData"
to use the feature.
*ddc-source-attribute-onEvent*
onEvent (function) (Optional)
Called for the autocommands.
It is useful to make cache.
*ddc-source-attribute-onInit*
onInit (function) (Optional)
Called before call source functions.
*ddc-source-attribute-params*
params (function) (Required)
Called to get source params.
------------------------------------------------------------------------------
CANDIDATE ATTRIBUTES *ddc-candidate-attributes*
*ddc-candidate-attribute-name*
word (string) (Required)
The completion word of a candidate. It is used for matching
inputs.
*ddc-candidate-attribute-abbr*
abbr (string) (Optional)
The abbreviation of a candidate. It is displayed in popup
window.
*ddc-candidate-attribute-kind*
kind (string) (Optional)
The kind of a candidate. It is displayed in popup window.
*ddc-candidate-attribute-menu*
menu (string) (Optional)
The menu information of a candidate. It is displayed in popup
window.
*ddc-candidate-attribute-info*
info (string) (Optional)
The preview information of a candidate. If 'completeopt'
contains "preview", it will be displayed in |preview-window|.
*ddc-candidate-attribute-dup*
dup (boolean) (Optional)
If true, the item will be displayed in the popup menu when an
item with the same word is already present.
*ddc-candidate-attribute-user_data*
user_data (UserData | string) (Optional)
The source specific data.
==============================================================================
CREATE FILTER *ddc-create-filter*
To create filter, you should read other filters implementation.
The files must be registered by |ddc#register_filter()|.
Filter class must extend the Base class.
Note: The filters must be written in Typescript language.
Note: If you call Vim functions in your source, it is not asynchronous.
------------------------------------------------------------------------------
FILTER ATTRIBUTES *ddc-filter-attributes*
*ddc-filter-attribute-events*
events (string[]) (Optional)
List of events for which |ddc-filter-attribute-onEvent|
should get called.
Default: []
*ddc-filter-attribute-filter*
filter (function) (Required)
It is called to filter candidates.
*ddc-filter-attribute-onEvent*
onEvent (function) (Optional)
Called for the autocommands.
It is useful to make cache.
*ddc-filter-attribute-onInit*
onInit (function) (Optional)
Called before call filter functions.
*ddc-filter-attribute-params*
params (function) (Required)
Called to get filter params.
==============================================================================
FREQUENTLY ASKED QUESTIONS (FAQ) *ddc-faq*
Q: How to donate money to you?
A: I have started github sponsorship to spend more time for Vim/neovim
plugins. You can donate money to help me!
https://github.com/sponsors/Shougo
Q: Why does ddc.vim not include any sources/matchers/sorters/converters?
A: Because I cannot determine the best default
sources/matchers/sorters/converters.
Users use different environments/policy, etc...
So ddc.vim should not define the defaults.
You must define your defaults by configuration.
ddc.vim does not conflict with your defaults.
Q: Why do sources have no default options?
A: Because users can customize sources perfectly. If a source has the
default, users have to check them. It increases configuration cost.
The config should work as users config.
Q: I want to use inline suggestiong like fish shell.
A: >
inoremap <expr><C-t> ddc#insert_candidate(0)
call ddc#custom#patch_global('completionMode', 'inline')
Q: The Linked/chained completion exists like vim-mucomplete?
A: It is not implemented, but you can emulate the behavior by
|ddc#map#manual_complete()| like this. >
let g:chains = ['around', 'zsh', 'deoppet']
function! MyChainCompletion() abort
let head = g:chains[0]
let g:chains = g:chains[1:] + [head]
return ddc#map#manual_complete([head])
endfunction
inoremap <silent><expr> <C-t> MyChainCompletion()
Q: I want to silence the |ins-completion-menu| messages in the command line
such as "-- XXX completion (YYY)", "match 1 of 2", "The only match", "Pattern
not found", "Back at original", etc.
A: You can disable the messages through the 'shortmess' option. >
set shortmess+=c
Q: I want to use the auto select feature.
A: You can use it by the 'completeopt' option. >
set completeopt+=noinsert
Q: How do I select one of the responses from the pop up?
A: Please press <C-y> on the candidate.
Q: I want to close the preview window after completion is done.
A: >
autocmd CompleteDone * silent! pclose!
<
Or
>
autocmd InsertLeave * silent! pclose!
<
Note: It conflicts with delimitMate.
https://github.com/Shougo/deoplete.nvim/issues/234
Q: I want to disable the preview window feature.
A: >
set completeopt-=preview
Q: I want to look selected function's arguments. But I don't like preview
window feature.
A: ddc.vim does not implement the feature. ddc.vim provides auto completion
feature only. The extra tasks are out of the range.
But you can do it by echodoc plugin.
http://github.com/Shougo/echodoc.vim
Or you can use lsp_signature.nvim plugin for nvim-lsp.
https://github.com/ray-x/lsp_signature.nvim
Q: I want to use floating preview window feature.
A: ddc.vim does not implement the feature. ddc.vim provides auto completion
feature only. The extra tasks are out of the range.
You can do it by float-preview.nvim plugin.
https://github.com/ncm2/float-preview.nvim
Or you can use ddc-nvim-lsp-doc plugin for nvim-lsp.
https://github.com/matsui54/ddc-nvim-lsp-doc
Q: Why don't create file/path source is for ddc.vim?
A: I know it is the important source. But it is not easy to implement.
Please see below issues.
* Path separator "\" or "/" problem. It should be converted to "/"?
* Start complete position problem
* The relative path is from buffer directory or current directory?
* When complete paths?
* Special characters should be escaped or not?
* Filename or path input may include spaces
* When trigger the source?
* Slash may be comment or URL or divide operator
* Hidden files
* Tilde/Enviroment variables substitution
* Link resolve
The file path source is the most buggy source in deoplete sources. So I don't
want to implement it anymore.
But other people has implemented it instead.
https://github.com/LumaKernel/ddc-file
Q: I want to enable "skkeleton" source when "skkeleton" is enabled only.
A: >
autocmd User skkeleton-enable-pre call s:skkeleton_pre()
function! s:skkeleton_pre() abort
" Overwrite sources
let s:prev_buffer_config = ddc#custom#get_buffer()
call ddc#custom#patch_buffer('sources', ['skkeleton'])
endfunction
autocmd User skkeleton-disable-pre call s:skkeleton_post()
function! s:skkeleton_post() abort
" Restore sources
call ddc#custom#set_buffer(s:prev_buffer_config)
endfunction
Q: I want to enable command line completion by ddc.vim.
A: Note: pum.vim is needed.
https://github.com/Shougo/pum.vim
>
call ddc#custom#patch_global('completionMenu', 'pum.vim')
call ddc#custom#patch_global('autoCompleteEvents',
\ ['InsertEnter', 'TextChangedI', 'TextChangedP', 'CmdlineChanged'])
cnoremap <Tab> <Cmd>call pum#map#insert_relative(+1)<CR>
cnoremap <S-Tab> <Cmd>call pum#map#insert_relative(-1)<CR>
cnoremap <C-n> <Cmd>call pum#map#insert_relative(+1)<CR>
cnoremap <C-p> <Cmd>call pum#map#insert_relative(-1)<CR>
cnoremap <C-y> <Cmd>call pum#map#confirm()<CR>
cnoremap <C-e> <Cmd>call pum#map#cancel()<CR>
nnoremap : <Cmd>call CommandlinePre()<CR>:
function! CommandlinePre() abort
" Overwrite sources
let s:prev_buffer_config = ddc#custom#get_buffer()
call ddc#custom#patch_buffer('sources', ['necovim', 'around'])
autocmd CmdlineLeave * ++once call CommandlinePost()
" Enable command line completion
call ddc#enable_cmdline_completion()
endfunction
function! CommandlinePost() abort
" Restore sources
call ddc#custom#set_buffer(s:prev_buffer_config)
endfunction
Note: It is experimental support.
==============================================================================
COMPATIBILITY *ddc-compatibility*
2021.09.22
* Remove old sources spec support
2021.09.20
* "denops/@ddc-sources/*.ts" or "denops/@ddc-filters/*.ts" files are
autoloaded for denops compatibility.
2021.09.19
* "params" is required for both sources and filters.
* Allow string "user_data".
* ddc#custom#get_buffer() returns current buffer values.
2021.09.18
* "user_data" must be Record<string, JSONValue> type.
2021.09.17
* ddc#register_source() and ddc#register_filter() are deprecated
2021.09.16
* Remove old filters spec support
2021.09.14
* Check all denops API call
2021.09.13
* Change "specialBufferCompletionFiletypes" to "specialBufferCompletion"
2021.09.02
* Change onInit() timing. It is called before sources/filters after
initialized.
* Change onInit() arguments.
* Catch source/filters errors.
2021.08.28
* "denops/ddc-sources/*.ts" or "denops/ddc-filters/*.ts" files are autoloaded.
2021.08.27
* Remove deprecated prototypes
2021.08.20
* Sources and Filters functions arguments are changed
2021.08.15
* Use 'iskeyword' for |ddc-option-keywordPattern|.
2021.08.14
* Don't complete when backspace, because of completion flicker.
2021.08.13
* Disable special buffers completion except
ddc-option-specialBufferCompletionFiletypes.
2021.08.09
* Rename ddc#auto_complete() to ddc#refresh_candidates()
2021.08.02
* Change gatherCandidates() arguments in sources
* Change filter() arguments in filters
2021.08.01
* Split "around" source
* Split "matcher_head" filter
* Split "sorter_rank" filter
==============================================================================
vim:tw=78:ts=8:ft=help:norl:noet:fen:noet: