From 4d3c4b5ecd937a928bc2b5df3f7451d07439ac1d Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Sat, 3 May 2025 19:03:16 +0300 Subject: A few small changes to nvim config --- .config/nvim/lua/plugins/octo.lua | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to '.config/nvim/lua/plugins/octo.lua') 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, } -- cgit v1.3.1