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

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

Expand Messages
  • Charles E Campbell
    C Campbell ... Manpageview does that (:OMan topic). You can get it from my website: http://www.drchip.org/astronaut/vim/index.html#MANPAGEVIEW You can also use
    Message 1 of 13 , Apr 23, 2013


      C Campbell

      On Apr 22, 2013, at 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.
       

      Manpageview does that (:OMan topic).

       You can also use ZoomWin to use ctrl-o to expand a window to cover the whole vim display and use ctrl-o to go back.  (http://.../index.html#ZOOMWIN).

      Regards,
      Chip Campbell

      --
      --
      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
      ... This isn t working for me, while the help doc is opened, the topic for foobar opens in another window. I have even tried :view $VIMRUNTIME/doc/help |
      Message 2 of 13 , Apr 23, 2013
        On 04/23, Tony Mechelynck wrote:
        >
        > So you can always open help for subject foobar in the current window
        > by doing
        >
        > :view $VIMRUNTIME/doc/help.txt | help foobar
        >

        This isn't working for me, while the help doc is opened, the topic for "foobar"
        opens in another window.

        I have even tried :view '$VIMRUNTIME/doc/help | setf help | help foobar' with no
        luck, the help topic always open in another window.

        I'm amazed that something that seems so simple is so difficult to accomplish in
        the most powerful editor :)

        --
        --
        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.
      • Ben Fritz
        ... 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. -- -- You
        Message 3 of 13 , Apr 23, 2013
          On Tuesday, April 23, 2013 10:30:59 AM UTC-5, Thiago de Arruda wrote:
          > On 04/23, Tony Mechelynck wrote:
          >
          > >
          >
          > > So you can always open help for subject foobar in the current window
          >
          > > by doing
          >
          > >
          >
          > > :view $VIMRUNTIME/doc/help.txt | help foobar
          >
          > >
          >
          >
          >
          > This isn't working for me, while the help doc is opened, the topic for "foobar"
          >
          > opens in another window.
          >
          >
          >
          > I have even tried :view '$VIMRUNTIME/doc/help | setf help | help foobar' with no
          >
          > luck, the help topic always open in another window.
          >
          >
          >
          > I'm amazed that something that seems so simple is so difficult to accomplish in
          >
          > the most powerful editor :)

          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.

          --
          --
          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
          ... 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 4 of 13 , Apr 23, 2013
            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 5 of 13 , Apr 23, 2013
              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 6 of 13 , Apr 23, 2013

                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 7 of 13 , Apr 24, 2013
                  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 8 of 13 , Apr 24, 2013

                    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 9 of 13 , Apr 24, 2013
                      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.