From b9c494a53e15a37c8b69fd2870bf80028004ec4d Mon Sep 17 00:00:00 2001 From: hrsh7th Date: Fri, 27 Aug 2021 11:31:50 +0900 Subject: [PATCH] Add documentation for mapping fallbacks --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index 73e330d..20d47a5 100644 --- a/README.md +++ b/README.md @@ -355,6 +355,26 @@ Default: `cmp.PreselectMode.Item` FAQ ==================== +#### What is the `pairs-wise plugin automatically supported`? + +Some pairs-wise plugin set up the mapping automatically. +For example, `vim-endwise` will map `` even if you don't do any mapping instructions for the plugin. + +But I think the user want to override `` mapping only when the mapping item is selected. + +The `nvim-cmp` does it automatically. + +The following configuration will be working as + +1. If the completion-item is selected, will be working as `cmp.mapping.confirm`. +2. If the completion-item isn't selected, will be working as vim-endwise feature. + +```lua +mapping = { + [''] = cmp.mapping.confirm() +} +``` + #### How to set up like nvim-compe's `preselect = 'always'`? You can use the following configuration.