Some time ago I found an interesting trick on Damian Conway's vimrc which allows to open help files in new tabs instead of split windows. The code is the following:
"Only apply to .txt files...
augroup HelpInTabs
autocmd!
autocmd BufEnter *.txt call HelpInNewTab()
augroup END
"Only apply to help files...
function! HelpInNewTab ()
if &buftype == 'help' && g:help_in_tabs
"Convert the help window to a tab...
execute "normal \<C-W>T"
endif
endfunction
Of course this piece of code works well but I'd like to improve it: I feel that opening the help file into a new tab isn't that convenient and I rather open it into a new buffer and give the focus on this buffer.
So I'm looking for a command which would replace this line:
execute "normal \<C-W>T"
and more precisely <C-W>T
to turn the window into a new buffer instead of a new tab.
Unfortunately, I could find anything which could help me in the documentation. So is it possible? And if it is, how can I do it?
<C-w>o
? (also see: How to “full screen” browse Vim help?).:bn
to go back to my previous buffer that close the help buffer (it doesn't appear anymore in:ls
)?