local presets = { none = {}, default = { [''] = { 'show', 'show_documentation', 'hide_documentation' }, [''] = { 'cancel', 'fallback' }, [''] = { 'select_and_accept' }, [''] = { 'select_prev', 'fallback' }, [''] = { 'select_next', 'fallback' }, [''] = { 'scroll_documentation_up', 'fallback' }, [''] = { 'scroll_documentation_down', 'fallback' }, [''] = { 'snippet_forward', 'fallback' }, [''] = { 'snippet_backward', 'fallback' }, }, ['super-tab'] = { [''] = { 'show', 'show_documentation', 'hide_documentation' }, [''] = { 'cancel', 'fallback' }, [''] = { function(cmp) if cmp.snippet_active() then return cmp.accept() else return cmp.select_and_accept() end end, 'snippet_forward', 'fallback', }, [''] = { 'snippet_backward', 'fallback' }, [''] = { 'select_prev', 'fallback' }, [''] = { 'select_next', 'fallback' }, [''] = { 'select_prev', 'fallback' }, [''] = { 'select_next', 'fallback' }, [''] = { 'scroll_documentation_up', 'fallback' }, [''] = { 'scroll_documentation_down', 'fallback' }, }, enter = { [''] = { 'show', 'show_documentation', 'hide_documentation' }, [''] = { 'cancel', 'fallback' }, [''] = { 'accept', 'fallback' }, [''] = { 'snippet_forward', 'fallback' }, [''] = { 'snippet_backward', 'fallback' }, [''] = { 'select_prev', 'fallback' }, [''] = { 'select_next', 'fallback' }, [''] = { 'select_prev', 'fallback' }, [''] = { 'select_next', 'fallback' }, [''] = { 'scroll_documentation_up', 'fallback' }, [''] = { 'scroll_documentation_down', 'fallback' }, }, } --- Gets the preset keymap for the given preset name --- @param name string --- @return table function presets.get(name) local preset = presets[name] if preset == nil then error('Invalid blink.cmp keymap preset: ' .. name) end return preset end return presets