-
Notifications
You must be signed in to change notification settings - Fork 0
/
dda.txt
125 lines (92 loc) · 4.14 KB
/
dda.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
*dda.txt* Dark deno-powered AI plugin for neovim/Vim8
Author: Shougo <Shougo.Matsu at gmail.com>
License: MIT license
CONTENTS *dda-contents*
Introduction |dda-introduction|
Install |dda-install|
Interface |dda-interface|
Options |dda-options|
Functions |dda-functions|
Examples |dda-examples|
FAQ |dda-faq|
Compatibility |dda-compatibility|
==============================================================================
INTRODUCTION *dda-introduction*
*dda* is the abbreviation of "dark deno-powered AI".
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 *dda-install*
Note: Dda.vim requires Neovim (0.8.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
You need to set `$OPENAI_API_KEY`. It is generated by
https://beta.openai.com/account/api-keys
==============================================================================
INTERFACE *dda-interface*
------------------------------------------------------------------------------
OPTIONS *dda-options*
------------------------------------------------------------------------------
FUNCTIONS *dda-functions*
*dda#completion()*
dda#completion({prompt}, [{suffix}[, {options}]])
Complete {prompt} text.
{suffix} means after cursor text.
Note: Both {prompt} and {suffix} texts are sent to API.
Note: It append the current line.
Refer to |dda-options| about {options}. If you skip a value,
it uses the default value.
*dda#edit()*
dda#edit({input}, [{instruction}[, {options}]])
Edit {input} text with {instruction} context.
Note: Both {input} and {instruction} texts are sent to API.
Note: It replaces the current line.
Refer to |dda-options| about {options}. If you skip a value,
it uses the default value.
==============================================================================
EXAMPLES *dda-examples*
>
" Completion with prompt
command! -nargs=* -range -bar
\ Dda call RangeCompletion(<line1>, <line2>, <range>, <q-args>)
function! RangeCompletion(line1, line2, range, prompt)
const offset = 20
if a:range > 0
" Visual mode
const selected = getline(a:line1, a:line2)->join("\n")
if a:prompt !=# ''
silent call deletebufline('%'->bufnr(), a:line1, a:line2)
call dda#edit(selected, a:prompt)
else
call dda#completion(selected)
endif
else
if a:prompt !=# ''
call dda#completion(a:prompt)
else
" Use current buffer
call dda#completion(
\ getline([1, line('.') - offset]->max(),
\ line('.') - 1)
\ ->add(dda#util#get_input())->join("\n"),
\ getline(line('.') + 1, line('.') + offset)
\ ->insert(dda#util#get_next_input())->join("\n")
\ )
endif
endif
endfunction
" Completion with current buffer
inoremap <C-a> <Cmd>Dda<CR>
<
==============================================================================
FREQUENTLY ASKED QUESTIONS (FAQ) *dda-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
==============================================================================
COMPATIBILITY *dda-compatibility*
==============================================================================
vim:tw=78:ts=8:ft=help:norl:noet:fen:noet: