From 41c60279948d5862b830eeff8c9bed16fe183c85 Mon Sep 17 00:00:00 2001 From: jmp <59481467+mcauley-penney@users.noreply.github.com> Date: Tue, 16 May 2023 18:53:06 -0700 Subject: [PATCH] docs: fix typos, add confirm.behavior example cfg (#1576) --- doc/cmp.txt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/doc/cmp.txt b/doc/cmp.txt index 5250706..b977aac 100644 --- a/doc/cmp.txt +++ b/doc/cmp.txt @@ -219,14 +219,20 @@ NOTE: `lua require('cmp').complete()` can be used to call these functio If you didn't select any item and the option table contains `select = true`, nvim-cmp will automatically select the first item. - You can control, how the completion item is injected into + You can control how the completion item is injected into the file through the `behavior` option: - `behavior=cmd.ConfirmBehavior.Insert`: inserts the selected item and + `behavior=cmp.ConfirmBehavior.Insert`: inserts the selected item and moves adjacent text to the right (default). - `behavior=cmd.ConfirmBehavior.Replace`: replaces adjecent text with - the selected item. - + `behavior=cmp.ConfirmBehavior.Replace`: replaces adjecent text with + the selected item. +>lua + cmp.setup { + mapping = { + [""] = cmp.mapping.confirm({ select = true, behavior = cmp.ConfirmBehavior.Replace }), + } + } +< *cmp.event:on* (%EVENT_NAME%, callback) Subscribe to nvim-cmp's event. Events are listed below.