-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
ddc.txt
1918 lines (1477 loc) · 62.8 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
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
*ddc.txt* Dark deno-powered completion framework for NeoVim/Vim
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|
Events |ddc-events|
Examples |ddc-examples|
UIs |ddc-uis|
UI option |ddc-ui-options|
UI params |ddc-ui-params|
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|
Types |ddc-types|
Create UI |ddc-create-ui|
UI attributes |ddc-ui-attributes|
Create source |ddc-create-source|
Source attributes |ddc-source-attributes|
Item attributes |ddc-item-attributes|
Create filter |ddc-create-filter|
filter attributes |ddc-filter-attributes|
Previewer |ddc-previewer|
previewer attributes |ddc-previewer-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.8.0+) or Vim 9.0.1276+ (latest is
recommended).
Please install both Deno 1.45+ and "denops.vim" v7.0+.
https://deno.land/
https://github.com/vim-denops/denops.vim
NOTE: Ddc.vim does not include any UIs, sources and filters.
You must install them which you want manually.
You can search ddc.vim plugins(UIs, 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('ui', 'native')
" Pass a dictionary to set multiple options
call ddc#custom#patch_global(#{
\ sourceOptions: #{
\ _: #{
\ keywordPattern: '[a-zA-Z_]\w*',
\ },
\ },
\ })
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 events to fire auto completion or narrow current items.
It must be list of |autocmd-events| string.
NOTE: Supported events is described in |ddc-events|.
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 screen flicker.
Default: v:false
*ddc-option-cmdlineSources*
cmdlineSources
It is a list of elements like |ddc-option-sources| or the
dictionary.
The dictionary key is command line type from |getcmdtype()|.
The dictionary value is a list of elements like
|ddc-option-sources|.
It is used for |Command-line-mode|.
NOTE: If you set it, |input()| auto completion is enabled.
NOTE: "ddc-ui-pum" is required for the feature.
https://github.com/Shougo/ddc-ui-pum
Default: []
>
" e.g.
call ddc#custom#patch_global('cmdlineSources', {
\ ':': ['cmdline-history', 'cmdline', 'around'],
\ '@': ['cmdline-history', 'input', 'file', 'around'],
\ '>': ['cmdline-history', 'input', 'file', 'around'],
\ '/': ['around', 'line'],
\ '?': ['around', 'line'],
\ '-': ['around', 'line'],
\ '=': ['input'],
\ })
<
*ddc-option-dynamicUi*
dynamicUi
It is the function which overwrites |ddc-option-ui| after
gather items.
The function returns new ui name.
NOTE: {func} is evaluated after user input and it affects
completion performance.
Default: ""
*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-hideOnEvents*
hideOnEvents
If it is enabled, ddc.vim will hide UI when
|ddc-option-autoCompleteEvents| is fired.
NOTE: It will increase screen flicker.
Default: v:false
*ddc-option-keywordPattern*
keywordPattern
NOTE: The option is deprecated.
Please use |ddc-source-option-keywordPattern| instead.
*ddc-option-postFilters*
postFilters
It is a list of elements like |ddc-source-option-matchers|.
It is called after the items are filtered.
It is useful if you want to sort items regardless source
orders.
Default: []
*ddc-option-sources*
sources
It is a list of elements which are formatted as:
>
#{
name: {source-name},
options: {source-options},
params: {source-params},
}
<
You have to select one or more sources to use completion.
Items 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
*ddc-option-ui*
ui
Specify UI name.
NOTE: You must set the option in the first.
Default: ""
*ddc-option-uiOptions*
uiOptions
It is a dictionary that maps UI names to its options. The
options with the name "_" is used as the options for all
UIs.
See also |ddc-ui-options|.
Default: {}
*ddc-option-uiParams*
uiParams
It is a dictionary that maps UI names to its parameters.
See also |ddc-ui-params|.
Default: {}
------------------------------------------------------------------------------
FUNCTIONS *ddc-functions*
*ddc#callback()*
ddc#callback({id} [, {payload}])
This is only for ddc plugin developers. It calls back to
sources and filters that registered with this id.
NOTE: It is for Vim script callback functions like LSP. It
does not work for deno async functions.
{id}: String to identify the receiver. All sources and filters
share the namespace, so please take care how naming.
`source/${this.name}` and `filter/${this.name}` are
recommended.
{payload}: Arbitrary object passed as resolved. The default
value is |v:null|.
*ddc#disable()*
ddc#disable()
Disable ddc.vim all features permanently.
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([{opts}])
Enable ddc.vim features and you can use it.
{opts} is dictionary and it has the following keys.
"context_filetype": Use context based filetype.
"context_filetype": Use "context_filetype.vim" plugin.
"treesitter": Use |treesitter| feature in NeoVim.
"none": Use current buffer 'filetype'.
Default: "none"
NOTE: It changes the global state.
*ddc#enable_cmdline_completion()*
ddc#enable_cmdline_completion()
Enable ddc.vim command line completion feature for next
command line session.
"DDCCmdlineLeave" |User| autocmd is called after command line
leave.
NOTE: The command line completion is disabled after command
line leave.
NOTE: It must be called before command line mode.
NOTE: "ddc-ui-pum" is required for the feature.
https://github.com/Shougo/ddc-ui-pum
*ddc#enable_terminal_completion()*
ddc#enable_terminal_completion()
Enable ddc.vim terminal completion feature.
NOTE: "ddc-ui-pum" is required for the feature.
https://github.com/Shougo/ddc-ui-pum
NOTE: It is experimental feature in Vim. NeoVim is
recommended.
*ddc#get_previewer()*
ddc#get_previewer({item}[, {context}])
Get |ddc-previewer| from {item}.
{context} is used as preview window context.
It is useful to render preview information dynamically.
*ddc#hide()*
ddc#hide([{event}])
Hide current completion UI.
{event} is completion event.
It must be list of |autocmd-events| string or "Manual" or
"Initialize" or "Update".
NOTE: It is used to cancel the completion.
NOTE: It does not restore inserted text.
>
inoremap <C-e> <Cmd>call ddc#hide()<CR>
<
*ddc#on_complete_done()*
ddc#on_complete_done({completed_item})
It must be called when completion item is completed.
The UI calls the API.
*ddc#on_event()*
ddc#on_event({event})
Call ddc "onEvent" callback manually.
Please see |ddc-events|.
*ddc#register()*
ddc#register({type}, {path})
Register ddc extension.
{type} is "ui" or "source" or "filter".
{path} is ddc extension path.
NOTE: {path} must be full path.
*ddc#set_static_import_path()*
ddc#set_static_import_path()
Make static import file to optimize load ddc extensions from
current 'runtimepath'.
NOTE: It should be called if you have updated plugins.
NOTE: It changes "denops/ddc/_mods.js" in the repository.
"--skip-worktree" is recommended if you use "git".
>
$ git update-index --skip-worktree denops/ddc/_mods.js
<
*ddc#skip_next_complete()*
ddc#skip_next_complete()
Skip the next auto completion.
It is used to disable auto completion.
*ddc#syntax#get()*
ddc#syntax#get()
Get current syntax groups.
NOTE: "nvim-treesitter" is used if it is installed.
*ddc#syntax#in()*
ddc#syntax#in({checks})
Check {checks} syntax groups in cursor.
*ddc#update_items()*
ddc#update_items({name}, {items})
Change source {name}'s items to {items} and refresh current
completion.
It is useful to create asynchronous sources. But it increases
screen flicker.
NOTE: It does not work for volatile source.
*ddc#visible()*
ddc#visible()
Return |v:true| when current completion UI is visible.
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.
NOTE: It must be called after |DenopsReady|.
*ddc#custom#get_current()*
ddc#custom#get_current()
Get current options.
NOTE: It must be called after |DenopsReady|.
*ddc#custom#get_filetype()*
ddc#custom#get_filetype()
Get filetype specific options.
NOTE: It must be called after |DenopsReady|.
*ddc#custom#get_context()*
ddc#custom#get_context()
Get context specific options.
NOTE: It must be called after |DenopsReady|.
*ddc#custom#get_global()*
ddc#custom#get_global()
Get global options.
NOTE: It must be called after |DenopsReady|.
*ddc#custom#load_config()*
ddc#custom#load_config({path})
Load TypeScript configuration from {path} file.
NOTE: {path} must be full path.
NOTE: The loading is asynchronous.
*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 options.
The key is {option-name} and the value is {value} in {dict}.
See |ddc-options| for available {option-name}.
*ddc#custom#set_context_buffer()*
ddc#custom#set_context_buffer({func})
Overwrites buffer specific options used for context.
{func} is function. {func} returns overwrites options
dictionary.
NOTE: {func} is evaluated after user input and it affects
completion performance.
*ddc#custom#set_context_filetype()*
ddc#custom#set_context_filetype({filetype}, {func})
Overwrites filetype specific options used for context.
{filetype} accepts a string or a list of strings.
{func} is function. {func} returns overwrites options
dictionary.
NOTE: {func} is evaluated after user input and it affects
completion performance.
>
call ddc#custom#set_context_filetype('go', { ->
\ ddc#syntax#in('TSComment') ? {
\ 'sources': ['nextword', 'around'],
\ } : {} })
call ddc#custom#set_context_filetype('c', { ->
\ ddc#syntax#in('Comment') ? {
\ 'sources': ['nextword', 'around'],
\ } : {} })
<
*ddc#custom#set_context_global()*
ddc#custom#set_context_global({func})
Overwrites global options used for context.
{func} is function. {func} returns overwrites options
dictionary.
NOTE: {func} is evaluated after user input and it affects
completion performance.
------------------------------------------------------------------------------
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({ui-name})
Open current completion popup menu by {ui-name}.
NOTE: It must be in |:map-<expr>|.
*ddc#map#complete_common_string()*
ddc#map#complete_common_string()
Complete common string in items.
This can be useful when items have a long common prefix.
NOTE: It must be in |:map-<expr>|.
*ddc#map#extend()*
ddc#map#extend({confirm-key})
Confirm the items and extend current completion.
{confirm-key} is popup confirm key like <C-y>.
NOTE: It must be in |:map-<expr>|.
*ddc#map#insert_item()*
ddc#map#insert_item({index})
Insert the item at index {index}. Indices start at 0.
NOTE: It must be in |:map-<expr>|.
NOTE: |v:completed_item| must be writable.
*ddc#map#manual_complete()*
ddc#map#manual_complete([{options}])
Manual trigger ddc completion.
{options} is |ddc-options|.
NOTE: Manual completion ignores
|ddc-source-option-minAutoCompleteLength|.
NOTE: After you open completion UI in manual completion, your
next input will be used as manual completion until the items
are empty or |ddc#hide()| is called.
NOTE: If you want to narrow manual completion items, you must
set |ddc-option-autoCompleteEvents|.
------------------------------------------------------------------------------
EVENTS *ddc-events*
Below events are only supported.
"Initialize": Called when ddc is initialized.
"Manual": Called when |ddc#map#manual_complete()|.
"Update": Called when |ddc#update_items()|.
Default |:autocmd| events:
|TextChangedI|, |TextChangedP|,
|InsertEnter|, |InsertLeave|,
|CmdlineEnter|, |CmdlineLeave|,
|BufEnter|, |BufLeave|,
|FileType|,
|CompleteDone|,
|CmdlineChanged| (|ddc#enable_cmdline_completion()|),
|TextChangedT| (|ddc#enable_terminal_completion()|),
NOTE: You can call events manually by |ddc#on_event()|.
==============================================================================
EXAMPLES *ddc-examples*
>
" Customize global settings
" You must set the default ui.
" NOTE: native ui
" https://github.com/Shougo/ddc-ui-native
call ddc#custom#patch_global('ui', 'native')
" Use around source.
" https://github.com/Shougo/ddc-source-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.
" NOTE: It does not work for pum.vim
"inoremap <expr> <TAB>
"\ pumvisible() ? '<C-n>' :
"\ (col('.') <= 1 <Bar><Bar> getline('.')[col('.') - 2] =~# '\s') ?
"\ '<TAB>' : ddc#map#manual_complete()
" <S-TAB>: completion back.
" NOTE: It does not work for pum.vim
"inoremap <expr> <S-TAB> pumvisible() ? '<C-p>' : '<C-h>'
" Use ddc.
call ddc#enable()
<
==============================================================================
UIS *ddc-uis*
NOTE: The UIs are not bundled in ddc.vim. You need to install them
to use ddc.vim. Please search them by https://github.com/topics/ddc-ui
NOTE: The default UI is empty. You need to configure it to use ddc.
The UIs must put under "denops/@ddc-uis/*.ts".
NOTE: The name is named by file name.
------------------------------------------------------------------------------
UI OPTIONS *ddc-ui-options*
Undefined now
------------------------------------------------------------------------------
UI PARAMS *ddc-ui-params*
These are the parameters that each UIs can have. You can select the
behavior and tune the performance.
Please read the UI documentation.
==============================================================================
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 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. If they 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 elements like |ddc-source-option-matchers|.
They change items attributes.
Items will be processed in the order you specify here.
Default: []
*ddc-source-option-dup*
dup (string) (Optional)
It changes duplicated words behavior.
"force": Duplicated words are overwritten.
"keep": Duplicated words are added.
"ignore": Duplicated words are removed.
Default: "ignore"
*ddc-source-option-enabledIf*
enabledIf (string)
The text is evaluated to enable the source.
If the result is |v:true| or the text is empty string, the
source is enabled.
Default: ''
*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-keywordPattern*
keywordPattern
It defines the keyword pattern for completion.
NOTE: It is JavaScript regexp.
NOTE: "\k" is converted to "['iskeyword']" pattern.
NOTE: "[:keyword:]" is converted to 'iskeyword' pattern.
NOTE: The source/filter must convert 'iskeyword' to use it.
Default: '\k*'
*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 items always.
Default: v:false
*ddc-source-option-mark*
mark (string)
A text icon indicating the source displayed with the item.
NOTE: If the source set item menu, the source must set it. If
the attribute is empty string, the item menu will be disabled.
Default: ""
*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 elements which are formatted as:
>
#{
name: {filter-name},
options: {filter-options},
params: {filter-params},
}
<
They filter items by user input.
Items will be processed in the order you specify here.
Default: []
*ddc-source-option-maxAutoCompleteLength*
maxAutoCompleteLength (number)
Ignored length of keyword for auto completion.
It is useful to edit BASE64 files.
NOTE: It does not work for manual completion.
Default: 80
*ddc-source-option-maxKeywordLength*
maxKeywordLength (number)
The maximum word of length for items.
If it is 0, the feature is disabled.
Default: 0
*ddc-source-option-maxItems*
maxItems (number)
If there are more items than this value, ddc will ignore the
filtering.
Default: 500
*ddc-source-option-maxManualCompleteLength*
maxManualCompleteLength (number)
The mamimum length of keyword required for manual completion.
Default: 80
*ddc-source-option-minAutoCompleteLength*
minAutoCompleteLength (number)
The minimum length of keyword required for auto completion.
NOTE: It does not work for manual completion.
Default: 2
*ddc-source-option-minManualCompleteLength*
minManualCompleteLength (number)
The minimum length of keyword required for manual completion.
Default: 1
*ddc-source-option-minKeywordLength*
minKeywordLength (number)
The minimum word of length for items.
If it is 0, the feature is disabled.
Default: 0
*ddc-source-option-preview*
preview (boolean)
If it is False, ddc disables preview feature.
Default: v:true
*ddc-source-option-replaceSourceInputPattern*
replaceSourceInputPattern
It defines the regexp pattern to remove a match in the source
input text.
It is useful when if you use non-forward-matching filter
algorithms (e.g., fuzzy matching).
NOTE: It is JavaScript regexp.
NOTE: "\k" is not converted.
Default: ''
*ddc-source-option-sorters*
sorters (string[])
It is a list of elements like |ddc-source-option-matchers|.
They sort items.
Items will be processed in the order you specify here.
Default: []
*ddc-source-option-timeout*
timeout (number)
The |ddc-source-attribute-gather| 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 items 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.
matchers: To filter items by user input
sorters: To sort items
converters: To change items attributes
Call order is matchers -> sorters -> converters
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 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.
==============================================================================
TYPES *ddc-types*
Please see the TypeScript definition.
https://jsr.io/@shougo/ddc-vim/doc
==============================================================================
CREATE UI *ddc-create-ui*
To create UI, you should read other UIs implementation.
Source class must extend "BaseUI" class.
NOTE: The sources must be written in TypeScript language.
NOTE: If you call Vim functions, it is not asynchronous.
------------------------------------------------------------------------------
UI ATTRIBUTES *ddc-ui-attributes*
*ddc-ui-attribute-hide*
hide (function) (Required)
Called to hide UI.
*ddc-ui-attribute-show*
show (function) (Required)
Called to show UI.
*ddc-source-ui-skipCompletion*
skipCompletion (function) (Optional)
Called to skip current completion.
It returns True, to skip completion.
*ddc-ui-attribute-onInit*
onInit (function) (Optional)
Called before call UI functions.
*ddc-ui-attribute-params*
params (function) (Required)
Called to get UI params.
*ddc-ui-attribute-visible*
visible (function) (Optional)
Called to check current UI is visible.
==============================================================================
CREATE SOURCE *ddc-create-source*
To create source, you should read other sources implementation.
Source class must extend "BaseSource" class.
NOTE: The sources must be written in TypeScript language.
NOTE: If you call Vim functions, 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.
NOTE: Supported events is described in |ddc-events|.
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-gather*
gather (function) (Required)
Called to gather items.
The function must return items list or below dictionary.
>
{
items: Item[],
isIncomplete: boolean,
}