From 134cf40096004f820b55c25c788d5a12f1757c22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Mendon=C3=A7a?= Date: Sun, 20 Oct 2024 20:42:07 +0100 Subject: [PATCH] feat: toggle sidebar_header (#737) --- README.md | 1 + lua/avante/config.lua | 1 + lua/avante/sidebar.lua | 2 ++ 3 files changed, 4 insertions(+) diff --git a/README.md b/README.md index 6ac008d..d7cc32e 100644 --- a/README.md +++ b/README.md @@ -257,6 +257,7 @@ _See [config.lua#L9](./lua/avante/config.lua) for the full config_ wrap = true, -- similar to vim.o.wrap width = 30, -- default % based on available width sidebar_header = { + enabled = true, -- true, false to enable/disable the header align = "center", -- left, center, right for title rounded = true, }, diff --git a/lua/avante/config.lua b/lua/avante/config.lua index da019ee..f5ac69c 100644 --- a/lua/avante/config.lua +++ b/lua/avante/config.lua @@ -166,6 +166,7 @@ Respect and use existing conventions, libraries, etc that are already present in width = 30, -- default % based on available width in vertical layout height = 30, -- default % based on available height in horizontal layout sidebar_header = { + enabled = true, -- true, false to enable/disable the header align = "center", -- left, center, right for title rounded = true, }, diff --git a/lua/avante/sidebar.lua b/lua/avante/sidebar.lua index cabd26b..4964e5e 100644 --- a/lua/avante/sidebar.lua +++ b/lua/avante/sidebar.lua @@ -605,6 +605,8 @@ local base_win_options = { function Sidebar:render_header(winid, bufnr, header_text, hl, reverse_hl) if not bufnr or not api.nvim_buf_is_valid(bufnr) then return end + if not Config.windows.sidebar_header.enabled then return end + if not Config.windows.sidebar_header.rounded then header_text = " " .. header_text .. " " end local winbar_text = "%#Normal#"