You can use :mksession
with a specialized 'sessionoptions'
to make this easier.
:set sessionoptions=blank,help,folds,winsize,localoptions
:mksession
:tabnew
:source Session.vim
Using this technique we can create an easy to use command. Put the following command in your vimrc
:
command! -bar DuplicateTabpane
\ let s:sessionoptions = &sessionoptions |
\ try |
\ let &sessionoptions = 'blank,help,folds,winsize,localoptions' |
\ let s:file = tempname() |
\ execute 'mksession ' . s:file |
\ tabnew |
\ execute 'source ' . s:file |
\ finally |
\ silent call delete(s:file) |
\ let &sessionoptions = s:sessionoptions |
\ unlet! s:file s:sessionoptions |
\ endtry
Now you can just call :DuplicateTabpane
.
For more information see:
:h :mksession
:h :mkview
:h 'sessionoptions'
:h :tabnew
:h :source