Loading ...
Sorry, an error occurred while loading the content.

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

Expand Messages
  • Thiago de Arruda
    ... 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:
    Message 1 of 13 , Apr 23, 2013
    • 0 Attachment
      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@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Thiago de Arruda
      OK I finally managed to get fully working and will post here in case anyone is interested, just put the code in vimrc and you can quickly invoke help in the
      Message 2 of 13 , Apr 23, 2013
      • 0 Attachment
        OK I finally managed to get fully working and will post here in case anyone is
        interested, just put the code in vimrc and you can quickly invoke help in the
        current window by pressing <leader>h:

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

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

        nnoremap <silent> <leader>h :view +1 $VIMRUNTIME/doc/help.txt

        Thanks for everyone's tips

        --
        --
        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@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • Edward Beckett
        you could simply open a new instance or tab for help ... -- -- You received this message from the vim_use maillist. Do not top-post! Type your reply below
        Message 3 of 13 , Apr 23, 2013
        • 0 Attachment

          you could simply open a new instance or tab for help

          On Apr 22, 2013 6:37 AM, "Thiago Padilha" <tpadilha84@...> wrote:
          I googled about this but only found how to open in a vertical split or in a full window. I cannot find how can I navigate to help without splitting or breaking my current layout.

          Normally I already have two windows splitting the screen vertically and would like to open help in the current window then navigate back with ctrl+o. Any easy way to accomplish that?

          --
          --
          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@....
          For more options, visit https://groups.google.com/groups/opt_out.
           
           

          --
          --
          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@....
          For more options, visit https://groups.google.com/groups/opt_out.
           
           
        • Thiago de Arruda
          ... I d rather open the help in full height in the current window then navigate back with CTRL+O, which is already how I m used to navigate between files.
          Message 4 of 13 , Apr 24, 2013
          • 0 Attachment
            On 04/23, Edward Beckett wrote:
            > you could simply open a new instance or tab for help

            I'd rather open the help in full height in the current window then navigate back
            with CTRL+O, which is already how I'm used to navigate between files. Besides,
            since I already use tmux with multiple vim instances, tabs get redundant for me.
          • Edward Beckett
            hmm... well if you get an answer do tell... your work flow does sound rather convenient... ... -- -- You received this message from the vim_use maillist. Do
            Message 5 of 13 , Apr 24, 2013
            • 0 Attachment

              hmm... well if you get an answer do tell... your work flow does sound rather convenient...

              On Apr 24, 2013 8:11 AM, "Thiago de Arruda" <tpadilha84@...> wrote:
              On 04/23, Edward Beckett wrote:
              > you could simply open a new instance or tab for help

              I'd rather open the help in full height in the current window then navigate back
              with CTRL+O, which is already how I'm used to navigate between files. Besides,
              since I already use tmux with multiple vim instances, tabs get redundant for me.

              --
              --
              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@....
              For more options, visit https://groups.google.com/groups/opt_out.
               
               
            • Thiago de Arruda
              ... As I decribed in my previous email, I managed to get a working solution by placing this code in my vimrc: function! OpenHelpInCurrentWindow(topic) view
              Message 6 of 13 , Apr 24, 2013
              • 0 Attachment
                On 04/24, Edward Beckett wrote:
                > hmm... well if you get an answer do tell... your work flow does sound
                > rather convenient...

                As I decribed in my previous email, I managed to get a working solution by
                placing this code in my vimrc:

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

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

                nnoremap <silent> <leader>h :Help

                Then with <leader>h or :Help you can open a help topic in the current window
              Your message has been successfully submitted and would be delivered to recipients shortly.