Tuesday, April 23, 2013

Re: How can I open help in the current window?

On 04/23, Ben Fritz wrote:
> I think the difference is that the :help command looks for a window with the 'buftype' option set to "help". :help 'buftype' says you're not supposed to set that manually, but I don't think there is anything preventing you from doing so. This should work slightly better:
>
> :view $VIMRUNTIME/doc/help.txt | set buftype=help | help foobar
>
> It seems to work for me, anyway. I'd set up a command to do all this for you rather than typing it all every time, though.
>
> Or just use :tab help.
>

It worked for me Ben, thanks to you and all that responded to this thread!
Using what I learned here I defined a new command that does what I need:

function! OpenHelpInCurrentWindow(topic)
keepjumps view $VIMRUNTIME/doc/help.txt
setl filetype=help
setl buftype=help
setl nomodifiable
exe 'help ' . a:topic
endfunction

command! -nargs=? -complete=help Help call OpenHelpInCurrentWindow(<q-args>)

The only thing missing is to stop the first 'view' command from adding an entry
to the jumplist. Apparently 'keepjumps' is having no effect, anyone has a better
idea?

Thanks again

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment