diff options
| -rw-r--r-- | .config/nvim/lua/init/02-commands.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/.config/nvim/lua/init/02-commands.lua b/.config/nvim/lua/init/02-commands.lua index 96c83da..a36906f 100644 --- a/.config/nvim/lua/init/02-commands.lua +++ b/.config/nvim/lua/init/02-commands.lua @@ -26,6 +26,12 @@ C( C( 'SmartOpen', function(opts) + local only_one_empty_window = F.winnr('$') == 1 and + F.bufname() == '' and + not F.getbufinfo().changed and + F.line('$') == 1 and + F.getline(1) == '' + local modifiers if F.winwidth(F.winnr()) < 150 then modifiers = 'topleft' @@ -48,6 +54,10 @@ C( return end + if only_one_empty_window then + vim.cmd.wincmd('o') + end + if O.filetype == 'help' then if vim.bo.textwidth > 0 then vim.cmd(('vertical resize %d'):format(vim.bo.textwidth)) |
