Update mapping docs

This commit is contained in:
hrsh7th
2021-08-24 22:55:23 +09:00
parent c0fcdd9c61
commit fc31a7e8ef

View File

@@ -138,7 +138,7 @@ mapping = {
- *cmp.mapping.close()* - *cmp.mapping.close()*
- *cmp.mapping.confirm({ select = bool, behavior = cmp.ConfirmBehavior.{Insert,Replace} })* - *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 ```lua
mapping = { mapping = {
@@ -148,6 +148,23 @@ mapping = {
} }
``` ```
You can specify your custom mapping function.
```lua
mapping = {
['<Tab>'] = function(fallback)
if vim.fn.pumvisible() == 1 then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<C-n>', true, true, true), 'n')
elseif vim.fn['vsnip#available']() == 1 then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>(vsnip-expand-or-jump)', true, true, true), '')
else
fallback()
end
end,
}
```
### completion.autocomplete (type: cmp.TriggerEvent[]) ### completion.autocomplete (type: cmp.TriggerEvent[])
Which events should trigger `autocompletion`. Which events should trigger `autocompletion`.