From 29dabc476821e437020ef3d77425940a54bf82c0 Mon Sep 17 00:00:00 2001 From: Yuexun Date: Mon, 19 Aug 2024 12:40:33 +1000 Subject: [PATCH] feat(ui): add config to turn off hints popup (#75) --- README.md | 4 ++++ lua/avante/config.lua | 8 ++++++++ lua/avante/selection.lua | 3 +++ 3 files changed, 15 insertions(+) diff --git a/README.md b/README.md index 3096545..3f36120 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,10 @@ _See [config.lua#L9](./lua/avante/config.lua) for the full config_ ---@type string | fun(): any list_opener = "copen", }, + --- @class AvanteHintsConfig + hints = { + enbaled = true, + } } ``` diff --git a/lua/avante/config.lua b/lua/avante/config.lua index 43a3e9f..e234fb8 100644 --- a/lua/avante/config.lua +++ b/lua/avante/config.lua @@ -82,6 +82,10 @@ M.defaults = { ---@type string | fun(): any list_opener = "copen", }, + --- @class AvanteHintsConfig + hints = { + enbaled = true, + }, } ---@type avante.Config @@ -92,6 +96,10 @@ M.options = {} ---@field highlights AvanteConflictHighlights M.diff = {} +---@class AvanteHintsConfig +---@field enabled boolean +M.hints = {} + ---@param opts? avante.Config function M.setup(opts) M.options = vim.tbl_deep_extend("force", M.defaults, opts or {}) diff --git a/lua/avante/selection.lua b/lua/avante/selection.lua index 7986f65..af9cb0f 100644 --- a/lua/avante/selection.lua +++ b/lua/avante/selection.lua @@ -62,6 +62,9 @@ end function Selection:setup_autocmds() Selection.did_setup = true + if Config.hints.enabled == false then + return self + end api.nvim_create_autocmd({ "ModeChanged" }, { group = self.augroup, pattern = { "n:v", "n:V", "n:" }, -- Entering Visual mode from Normal mode