From 557ffaf31c56f82004ef229c115d68edd310e063 Mon Sep 17 00:00:00 2001 From: Pawel Grzybek Date: Tue, 4 Feb 2025 12:08:38 +0000 Subject: [PATCH 1/2] Auto-hide recipe for blink.cmd --- README.md | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c2f2ff6f..a4b4d37b 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,10 @@ To toggle auto trigger for the current buffer, use `require("copilot.suggestion" Copilot suggestion is automatically hidden when `popupmenu-completion` is open. In case you use a custom menu for completion, you can set the `copilot_suggestion_hidden` buffer variable to `true` to have the -same behavior. For example, with `nvim-cmp`: +same behavior. + +
+Example using `nvim-cmp` ```lua cmp.event:on("menu_opened", function() @@ -129,6 +132,29 @@ cmp.event:on("menu_closed", function() vim.b.copilot_suggestion_hidden = false end) ``` +
+ +
+Example using `blink.cmp` + +```lua +vim.api.nvim_create_autocmd("User", { + pattern = "BlinkCmpMenuOpen", + callback = function() + vim.b.copilot_suggestion_hidden = true + end, +}) + +vim.api.nvim_create_autocmd("User", { + pattern = "BlinkCmpMenuClose", + callback = function() + vim.b.copilot_suggestion_hidden = false + end, +}) + +``` +
+ The `copilot.suggestion` module exposes the following functions: From 49eb1842aa7cf44a2ff5cf2ac59678c9d25bae13 Mon Sep 17 00:00:00 2001 From: Pawel Grzybek Date: Tue, 4 Feb 2025 12:09:56 +0000 Subject: [PATCH 2/2] Remove backticks --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a4b4d37b..dafd96fe 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ menu for completion, you can set the `copilot_suggestion_hidden` buffer variable same behavior.
-Example using `nvim-cmp` +Example using nvim-cmp ```lua cmp.event:on("menu_opened", function() @@ -135,7 +135,7 @@ end)
-Example using `blink.cmp` +Example using blink.cmp ```lua vim.api.nvim_create_autocmd("User", {