summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/plugins/octo.lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/plugins/octo.lua')
-rw-r--r--.config/nvim/lua/plugins/octo.lua28
1 files changed, 22 insertions, 6 deletions
diff --git a/.config/nvim/lua/plugins/octo.lua b/.config/nvim/lua/plugins/octo.lua
index ccb518d..025c488 100644
--- a/.config/nvim/lua/plugins/octo.lua
+++ b/.config/nvim/lua/plugins/octo.lua
@@ -26,10 +26,26 @@ return {
{ '@', '', mode = 'i', ft = 'octo', silent = true },
{ '#', '', mode = 'i', ft = 'octo', silent = true },
},
- opts = {
- enable_builtin = true,
- -- default_to_projects_v2 = true,
- default_merge_method = 'squash',
- picker = 'snacks',
- },
+ opts = function()
+ -- Keep some empty windows in sessions
+ vim.api.nvim_create_autocmd('ExitPre', {
+ group = vim.api.nvim_create_augroup('octo_exit_pre', { clear = true }),
+ callback = function(_)
+ local keep = { 'octo' }
+ for _, win in ipairs(vim.api.nvim_list_wins()) do
+ local buf = vim.api.nvim_win_get_buf(win)
+ if vim.tbl_contains(keep, vim.bo[buf].filetype) then
+ vim.bo[buf].buftype = '' -- set buftype to empty to keep the window
+ end
+ end
+ end,
+ })
+
+ return {
+ enable_builtin = true,
+ -- default_to_projects_v2 = true,
+ default_merge_method = 'squash',
+ picker = 'snacks',
+ }
+ end,
}