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

How to put search result on FIRST screen line

Expand Messages
  • Philip Rhoades
    People, I want to flick through a large text file with repeated sections of variable length (but each with four heading lines) so that the the first heading
    Message 1 of 11 , Apr 3, 2013
    • 0 Attachment
      People,

      I want to flick through a large text file with repeated sections of
      variable length (but each with four heading lines) so that the the first
      heading line of each section always ends up as the first screen line -
      is there some way of doing this with the search facility?

      Thanks,

      Phil.
      --
      Philip Rhoades

      GPO Box 3411
      Sydney NSW 2001
      Australia
      E-mail: phil@...

      --
      --
      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.
    • Kent
      i didn t understand your text format very well but zt will move your current line (line under cursor) to screen top. which you may need, to build your
      Message 2 of 11 , Apr 3, 2013
      • 0 Attachment
        i didn't understand your text format very well but

        zt

        will move your current line (line under cursor) to screen top. which
        you may need, to build your command.



        On Wed, Apr 3, 2013 at 9:15 PM, Philip Rhoades <phil@...> wrote:
        > People,
        >
        > I want to flick through a large text file with repeated sections of variable
        > length (but each with four heading lines) so that the the first heading line
        > of each section always ends up as the first screen line - is there some way
        > of doing this with the search facility?
        >
        > Thanks,
        >
        > Phil.
        > --
        > Philip Rhoades
        >
        > GPO Box 3411
        > Sydney NSW 2001
        > Australia
        > E-mail: phil@...
        >
        > --
        > --
        > 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.
      • Paul Isambert
        ... Try something like: noremap X /PATTERN zt:nohl where PATTERN is whatever matches the first heading line. You can use ? instead of / to jump
        Message 3 of 11 , Apr 3, 2013
        • 0 Attachment
          > I want to flick through a large text file with repeated sections of
          > variable length (but each with four heading lines) so that the the first
          > heading line of each section always ends up as the first screen line -
          > is there some way of doing this with the search facility?

          Try something like:

          noremap <buffer> X /PATTERN<CR>zt:nohl<CR>

          where PATTERN is whatever matches the first heading line. You can use ? instead
          of / to jump backward.

          Best,
          Paul

          --
          --
          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.
        • Philip Rhoades
          Kent, Thanks but I don t want to do a second command - I want the search results on the first screen line after the search . . Regards, Phil. ... -- Philip
          Message 4 of 11 , Apr 3, 2013
          • 0 Attachment
            Kent,

            Thanks but I don't want to do a second command - I want the search
            results on the first screen line after the search . .

            Regards,

            Phil.


            On 2013-04-04 06:47, Kent wrote:
            > i didn't understand your text format very well but
            >
            > zt
            >
            > will move your current line (line under cursor) to screen top. which
            > you may need, to build your command.
            >
            >
            >
            > On Wed, Apr 3, 2013 at 9:15 PM, Philip Rhoades <phil@...>
            > wrote:
            >> People,
            >>
            >> I want to flick through a large text file with repeated sections of
            >> variable
            >> length (but each with four heading lines) so that the the first
            >> heading line
            >> of each section always ends up as the first screen line - is there
            >> some way
            >> of doing this with the search facility?
            >>
            >> Thanks,
            >>
            >> Phil.
            >> --
            >> Philip Rhoades
            >>
            >> GPO Box 3411
            >> Sydney NSW 2001
            >> Australia
            >> E-mail: phil@...
            >>
            >> --
            >> --
            >> 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.
            >>
            >>
            >
            > --

            --
            Philip Rhoades

            GPO Box 3411
            Sydney NSW 2001
            Australia
            E-mail: phil@...

            --
            --
            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.
          • Christian Brabandt
            Hi Philip! (Please don t top poste). ... Then map it to your favorite key . Mit freundlichen Grüßen Christian -- Letzte Worte des Anstreichers: Aber sicher
            Message 5 of 11 , Apr 3, 2013
            • 0 Attachment
              Hi Philip!

              (Please don't top poste).

              On Do, 04 Apr 2013, Philip Rhoades wrote:

              > Kent,
              >
              > Thanks but I don't want to do a second command - I want the search
              > results on the first screen line after the search . .

              Then map it to your favorite key
              .
              Mit freundlichen Grüßen
              Christian
              --
              Letzte Worte des Anstreichers:
              "Aber sicher ist das Gerüst stabil."

              --
              --
              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.
            • Philip Rhoades
              Christian, ... I usually don t but Kent did when he replied to my original post so I had to follow suit otherwise my reply to Kent would have been hard to read
              Message 6 of 11 , Apr 3, 2013
              • 0 Attachment
                Christian,


                On 2013-04-04 07:03, Christian Brabandt wrote:
                > Hi Philip!
                >
                > (Please don't top poste).


                I usually don't but Kent did when he replied to my original post so I
                had to follow suit otherwise my reply to Kent would have been hard to
                read . .


                > On Do, 04 Apr 2013, Philip Rhoades wrote:
                >
                >> Kent,
                >>
                >> Thanks but I don't want to do a second command - I want the search
                >> results on the first screen line after the search . .
                >
                > Then map it to your favorite key


                What do you mean? How do you map the search and the "zt" command?

                Thanks,

                Phil.
                --
                Philip Rhoades

                GPO Box 3411
                Sydney NSWW 2001
                Australia
                E-mail: phil@...

                --
                --
                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.
              • Taylor Hedberg
                ... e.g.: nnoremap n nzt
                Message 7 of 11 , Apr 3, 2013
                • 0 Attachment
                  Philip Rhoades, Thu 2013-04-04 @ 07:09:21+1100:
                  > What do you mean? How do you map the search and the "zt" command?

                  e.g.:

                  nnoremap <Leader>n nzt
                • Philip Rhoades
                  Taylor, ... That seems to put the searched line in the centre of the screen . . not the first line of the screen. Thanks, Phil. -- Philip Rhoades GPO Box 3411
                  Message 8 of 11 , Apr 3, 2013
                  • 0 Attachment
                    Taylor,


                    On 2013-04-04 07:17, Taylor Hedberg wrote:
                    > Philip Rhoades, Thu 2013-04-04 @ 07:09:21+1100:
                    >> What do you mean? How do you map the search and the "zt" command?
                    >
                    > e.g.:
                    >
                    > nnoremap <Leader>n nzt


                    That seems to put the searched line in the centre of the screen . . not
                    the first line of the screen.

                    Thanks,

                    Phil.
                    --
                    Philip Rhoades

                    GPO Box 3411
                    Sydney NSW 2001
                    Australia
                    E-mail: phil@...

                    --
                    --
                    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.
                  • Taylor Hedberg
                    ... Not sure why that would be, as `zt` scrolls the cursor line to the top of the window. It is working as intended on my machine.
                    Message 9 of 11 , Apr 3, 2013
                    • 0 Attachment
                      Philip Rhoades, Thu 2013-04-04 @ 07:40:47+1100:
                      > That seems to put the searched line in the centre of the screen . .
                      > not the first line of the screen.

                      Not sure why that would be, as `zt` scrolls the cursor line to the top
                      of the window. It is working as intended on my machine.
                    • Tim Chase
                      ... Do you have a non-default setting (i.e., very large value) for scrolloff ? -tim -- -- You received this message from the vim_use maillist. Do not
                      Message 10 of 11 , Apr 3, 2013
                      • 0 Attachment
                        On 2013-04-04 07:40, Philip Rhoades wrote:
                        > > nnoremap <Leader>n nzt
                        >
                        > That seems to put the searched line in the centre of the screen . .
                        > not the first line of the screen.

                        Do you have a non-default setting (i.e., very large value) for
                        'scrolloff'?

                        -tim


                        --
                        --
                        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.
                      • Philip Rhoades
                        Paul, ... That s it! Excellent! Thanks, Phil. -- Philip Rhoades GPO Box 3411 Sydney NSW 2001 Australia E-mail: phil@pricom.com.au -- -- You received this
                        Message 11 of 11 , Apr 3, 2013
                        • 0 Attachment
                          Paul,


                          On 2013-04-04 06:57, Paul Isambert wrote:
                          >> I want to flick through a large text file with repeated sections of
                          >> variable length (but each with four heading lines) so that the the
                          >> first
                          >> heading line of each section always ends up as the first screen line
                          >> -
                          >> is there some way of doing this with the search facility?
                          >
                          > Try something like:
                          >
                          > noremap <buffer> X /PATTERN<CR>zt:nohl<CR>
                          >
                          > where PATTERN is whatever matches the first heading line. You can use
                          > ? instead
                          > of / to jump backward.


                          That's it! Excellent!

                          Thanks,

                          Phil.
                          --
                          Philip Rhoades

                          GPO Box 3411
                          Sydney NSW 2001
                          Australia
                          E-mail: phil@...

                          --
                          --
                          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.
                        Your message has been successfully submitted and would be delivered to recipients shortly.