From e7c942ff921e8d345f6420609c3757ea805eb164 Mon Sep 17 00:00:00 2001 From: bxhart Date: Sat, 11 Apr 2026 23:31:10 +0200 Subject: [PATCH 1/2] Add explorer option to hide it at initial launch. It can still be toggled by toggle_visibility --- lua/codediff/config.lua | 1 + lua/codediff/ui/explorer/render.lua | 2 +- lua/codediff/ui/view/panel.lua | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/codediff/config.lua b/lua/codediff/config.lua index da6fb325..3153bcc8 100644 --- a/lua/codediff/config.lua +++ b/lua/codediff/config.lua @@ -49,6 +49,7 @@ M.defaults = { -- Explorer panel configuration explorer = { position = "left", -- "left" or "bottom" + hidden = false, width = 40, -- Width when position is "left" (columns) height = 15, -- Height when position is "bottom" (lines) view_mode = "list", -- "list" (flat file list) or "tree" (directory tree) diff --git a/lua/codediff/ui/explorer/render.lua b/lua/codediff/ui/explorer/render.lua index c4829584..dedaaa86 100644 --- a/lua/codediff/ui/explorer/render.lua +++ b/lua/codediff/ui/explorer/render.lua @@ -175,7 +175,7 @@ function M.create(status_result, git_root, tabpage, width, base_revision, target current_file_path = nil, -- Track currently selected file current_file_group = nil, -- Track currently selected file's group (staged/unstaged) current_selection = nil, -- Full file selection used to replay current state - is_hidden = false, -- Track visibility state + is_hidden = explorer_config.hidden, -- Track visibility state visible_groups = vim.deepcopy(explorer_config.visible_groups or { staged = true, unstaged = true, conflicts = true }), } diff --git a/lua/codediff/ui/view/panel.lua b/lua/codediff/ui/view/panel.lua index cb872d2a..0fce58ee 100644 --- a/lua/codediff/ui/view/panel.lua +++ b/lua/codediff/ui/view/panel.lua @@ -36,6 +36,10 @@ function M.setup_explorer(tabpage, session_config, original_win, modified_win) local explorer_obj = explorer_module.create(status_result, session_config.git_root, tabpage, nil, session_config.original_revision, session_config.modified_revision, explorer_opts) + if explorer_config.hidden == true then + vim.api.nvim_win_close(explorer_obj.winid, true) + end + lifecycle.set_explorer(tabpage, explorer_obj) local initial_focus = explorer_config.initial_focus or "explorer" From bb54497ec730986de2b710f8c5dafbf90d194348 Mon Sep 17 00:00:00 2001 From: bxhart Date: Tue, 14 Apr 2026 12:06:03 +0200 Subject: [PATCH 2/2] Update README --- README.md | 1 + lua/codediff/config.lua | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 61a6cd68..026bb2f9 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,7 @@ https://github.com/user-attachments/assets/64c41f01-dffe-4318-bce4-16eec8de356e -- Explorer panel configuration explorer = { position = "left", -- "left" or "bottom" + hidden = false, -- Initial visibility state width = 40, -- Width when position is "left" (columns) height = 15, -- Height when position is "bottom" (lines) indent_markers = true, -- Show indent markers in tree view (│, ├, └) diff --git a/lua/codediff/config.lua b/lua/codediff/config.lua index 3153bcc8..5c63a712 100644 --- a/lua/codediff/config.lua +++ b/lua/codediff/config.lua @@ -49,7 +49,7 @@ M.defaults = { -- Explorer panel configuration explorer = { position = "left", -- "left" or "bottom" - hidden = false, + hidden = false, -- Initial visibility state width = 40, -- Width when position is "left" (columns) height = 15, -- Height when position is "bottom" (lines) view_mode = "list", -- "list" (flat file list) or "tree" (directory tree)