diff --git a/README.md b/README.md index 7ff0473..a149820 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,7 @@ mapping = { - *cmp.mapping.close()* - *cmp.mapping.confirm({ select = bool, behavior = cmp.ConfirmBehavior.{Insert,Replace} })* -In addition, You can specify vim's mode to those mapping functions like this. +In addition, You can specify vim's mode to those mapping functions. ```lua mapping = { @@ -148,6 +148,23 @@ mapping = { } ``` +You can specify your custom mapping function. + +```lua +mapping = { + [''] = function(fallback) + if vim.fn.pumvisible() == 1 then + vim.fn.feedkeys(vim.api.nvim_replace_termcodes('', true, true, true), 'n') + elseif vim.fn['vsnip#available']() == 1 then + vim.fn.feedkeys(vim.api.nvim_replace_termcodes('(vsnip-expand-or-jump)', true, true, true), '') + else + fallback() + end + end, +} +``` + + ### completion.autocomplete (type: cmp.TriggerEvent[]) Which events should trigger `autocompletion`.