48
48
opts = {
49
49
-- 'default' for mappings similar to built-in completion
50
50
-- 'super-tab' for mappings similar to vscode (tab to accept, arrow keys to navigate)
51
+ -- 'enter' for mappings similar to 'super-tab' but with 'enter' to accept
51
52
-- see the "default configuration" section below for full documentation on how to define
52
53
-- your own keymap. when defining your own, no keybinds will be assigned automatically.
53
54
keymap = ' default' ,
@@ -160,10 +161,15 @@ MiniDeps.add({
160
161
161
162
``` lua
162
163
{
163
- -- the keymap may be a preset ('default' | 'super-tab') OR a table of keys => command[]
164
+ -- the keymap may be a preset ('default' | 'super-tab' | 'enter' ) OR a table of keys => command[]
164
165
-- when defining your own, no keybinds will be assigned automatically.
165
166
-- you may pass a function in the command array where returning true
166
167
-- will prevent the next command from running
168
+ --
169
+ -- The "fallback" command will run the next non-blink keymap.
170
+ -- For example, to accept the current completion item with "enter", or create a new line,
171
+ -- when the blink window is closed, you would define it as:
172
+ -- ['<CR>'] = { 'accept', 'fallback' }
167
173
--
168
174
-- "default" keymap
169
175
-- ['<C-space>'] = { 'show', 'show_documentation', 'hide_documentation' },
@@ -184,7 +190,7 @@ MiniDeps.add({
184
190
-- or use `window.autocomplete.selection = "manual" | "auto_insert"`
185
191
--
186
192
-- ['<C-space>'] = { 'show', 'show_documentation', 'hide_documentation' },
187
- -- ['<C-e>'] = { 'hide' },
193
+ -- ['<C-e>'] = { 'hide', 'fallback' },
188
194
--
189
195
-- ['<Tab>'] = {
190
196
-- function(cmp)
@@ -204,6 +210,24 @@ MiniDeps.add({
204
210
-- ['<C-b>'] = { 'scroll_documentation_up', 'fallback' },
205
211
-- ['<C-f>'] = { 'scroll_documentation_down', 'fallback' },
206
212
--
213
+ -- "enter" keymap
214
+ -- you may want to set `window.autocomplete.selection = "manual" | "auto_insert"`
215
+ --
216
+ -- ['<C-space>'] = { 'show', 'show_documentation', 'hide_documentation' },
217
+ -- ['<C-e>'] = { 'hide', 'fallback' },
218
+ -- ['<CR>'] = { 'accept', 'fallback' },
219
+ --
220
+ -- ['<Tab>'] = { 'snippet_forward', 'fallback' },
221
+ -- ['<S-Tab>'] = { 'snippet_backward', 'fallback' },
222
+ --
223
+ -- ['<Up>'] = { 'select_prev', 'fallback' },
224
+ -- ['<Down>'] = { 'select_next', 'fallback' },
225
+ -- ['<C-p>'] = { 'select_prev', 'fallback' },
226
+ -- ['<C-n>'] = { 'select_next', 'fallback' },
227
+ --
228
+ -- ['<C-b>'] = { 'scroll_documentation_up', 'fallback' },
229
+ -- ['<C-f>'] = { 'scroll_documentation_down', 'fallback' },
230
+ --
207
231
-- available commands:
208
232
-- show, hide, accept, select_and_accept, select_prev, select_next, show_documentation, hide_documentation,
209
233
-- scroll_documentation_up, scroll_documentation_down, snippet_forward, snippet_backward, fallback
0 commit comments