Toggles between the current window and the current buffer opened in a new tab page.
:ToggleOnly
You have to define your own key bindings. For example:
nnoremap <leader>o :ToggleOnly<Enter>
Use your favourite plugin manager. For example, using Plug:
call plug#begin()
Plug 'caenrique/nvim-maximize-window-toggle'
call plug#end()