So I want to be able to automatically open help files in a new tab.
I saw a question on this SE that pretty much solved my problem.
I wanted to make just one change: center the screen.
"That will be easy," I thought....
"Only apply to .txt files...
augroup HelpInTabs
autocmd!
autocmd BufEnter *.txt call HelpInNewTab()
augroup END
let g:help_in_tabs = 1
"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"
" THIS IS MY CHANGE:
execute "normal zz"
endif
endfunction
quite unexpectedly, there is no difference. ☁️
zz
mapped to anything? Just in case, usenormal! zz
(I'm pretty sure you don't need theexecute
statement either. Also, you can just do:tab help <topic>
to open a help page in a new tab.map <Leader>ve :vertical botright help<CR>
HelpInNewTab()
gives the desired result. Even running:doautocmd
works. But when firing automatically, there is no change, as you mentioned. In addition, I found that after switching to another tab and back, the screen is centered! I think this might be a bug.