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

how to go top of command outputing?

Expand Messages
  • nielinjie
    Hello list: When editing a python file, I run !python % , and this works, but have a problem. The output of the python script is very long, so when the script
    Message 1 of 7 , Aug 31, 2008
    • 0 Attachment
      Hello list:
      When editing a python file, I run '!python %', and this works, but
      have a problem. The output of the python script is very long, so when
      the script finished, I can not scroll back to the top of output...
      thank for any help :-)

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Ag. D. Hatzimanikas
      ... You can redirect the output into some file or a register or a variable. For instance: redir @a your command here redir END and then you can put the
      Message 2 of 7 , Aug 31, 2008
      • 0 Attachment
        On Sun, Aug 31, at 03:57 nielinjie wrote:
        >
        > Hello list:
        > When editing a python file, I run '!python %', and this works, but
        > have a problem. The output of the python script is very long, so when
        > the script finished, I can not scroll back to the top of output...
        > thank for any help :-)
        >

        You can redirect the output into some file or a register or a variable.
        For instance:

        redir @a
        your command here
        redir END

        and then you can put the contents of the register in a scratch window
        (there are many available in vim.org).

        See:

        :h :redir

        Regards,
        Ag.

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Ben Schmidt
        ... (or less)? Probably no good in gvim, but in console vim it should work. Ben. --~--~---------~--~----~------------~-------~--~----~ You received this
        Message 3 of 7 , Aug 31, 2008
        • 0 Attachment
          nielinjie wrote:
          > Hello list:
          > When editing a python file, I run '!python %', and this works, but
          > have a problem. The output of the python script is very long, so when
          > the script finished, I can not scroll back to the top of output...
          > thank for any help :-)

          :!python % | more

          (or less)?

          Probably no good in gvim, but in console vim it should work.

          Ben.



          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Tony Mechelynck
          ... more (which is made for a dumb terminal) works in gvim, but it cannot scroll back: it will just stop after each page of output. It also exists on both
          Message 4 of 7 , Aug 31, 2008
          • 0 Attachment
            On 31/08/08 14:35, Ben Schmidt wrote:
            > nielinjie wrote:
            >> Hello list:
            >> When editing a python file, I run '!python %', and this works, but
            >> have a problem. The output of the python script is very long, so when
            >> the script finished, I can not scroll back to the top of output...
            >> thank for any help :-)
            >
            > :!python % | more
            >
            > (or less)?
            >
            > Probably no good in gvim, but in console vim it should work.
            >
            > Ben.

            more (which is made for a dumb terminal) works in gvim, but it cannot
            scroll back: it will just stop after each page of output. It also exists
            on both Unix-like and Dos-like systems. less (which can scroll back but
            requires a random-access console) will work only in Console vim, and
            only on Unix-like systems or on Windows systems where the appropriate
            "Unix utilities" package (there are several from different makers) has
            been installed.

            The other solution allows using the full power of Vim to view the output:

            :new
            :0r !python #

            ":new" splits to an empty buffer
            The other command feeds the previous editfile (which is now the
            alternate file) to the python interpreter and reads the output into the
            current buffer, "after line zero" i.e. before line 1; you'll get a
            spurious empty line at the end, which you can optionally remove by
            adding a third ex-command:

            :$d



            Best regards,
            Tony.
            --
            History repeats itself. That's one thing wrong with history.

            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_use" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • A. S. Budden
            ... I can wholeheartedly recommend Dr Chip s RunView for this: see http://mysite.verizon.net/astronaut/vim/ To run the whole script, (assuming you ve set up
            Message 5 of 7 , Sep 1, 2008
            • 0 Attachment
              2008/8/31 nielinjie <nielinjie@...>:
              >
              > Hello list:
              > When editing a python file, I run '!python %', and this works, but
              > have a problem. The output of the python script is very long, so when
              > the script finished, I can not scroll back to the top of output...
              > thank for any help :-)

              I can wholeheartedly recommend Dr Chip's RunView for this: see
              http://mysite.verizon.net/astronaut/vim/

              To run the whole script, (assuming you've set up g:runview_filtcmd),
              you just type :%RunView! and it will pipe the contents of the script
              to python (or whatever) and display the output in a new (vertically
              split) window. Each successive run gets appended to the same window
              with markers to separate the distinct runs.

              Hope that helps,

              Al

              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_use" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            • momodi
              I think you could use xterm. !xterm -e python % ; read -n 1 ... --~--~---------~--~----~------------~-------~--~----~ You received this message from the
              Message 6 of 7 , Sep 1, 2008
              • 0 Attachment
                I think you could use xterm.
                !xterm -e"python % ; read -n 1"

                On Aug 31, 6:57 pm, nielinjie <nielin...@...> wrote:
                > Hello list:
                > When editing a python file, I run '!python %', and this works, but
                > have a problem. The output of the python script is very long, so when
                > the script finished, I can not scroll back to the top of output...
                > thank for any help :-)
                --~--~---------~--~----~------------~-------~--~----~
                You received this message from the "vim_use" maillist.
                For more information, visit http://www.vim.org/maillist.php
                -~----------~----~----~----~------~----~------~--~---
              • Peter Palm
                ... Or you could suspend vim, and just run python [filename] | view ... Regards, Peter --~--~---------~--~----~------------~-------~--~----~ You received this
                Message 7 of 7 , Sep 1, 2008
                • 0 Attachment
                  Op maandag 1 september 2008, schreef momodi:
                  > On Aug 31, 6:57 pm, nielinjie <nielin...@...> wrote:
                  > > Hello list:
                  > > When editing a python file, I run '!python %', and this works, but
                  > > have a problem. The output of the python script is very long, so
                  > > when the script finished, I can not scroll back to the top of
                  > > output... thank for any help :-)
                  >
                  > I think you could use xterm.
                  > !xterm -e"python % ; read -n 1"

                  Or you could suspend vim, and just run
                  python [filename] | view

                  or, in another buffer:
                  :r !python [filename]

                  Regards,

                  Peter

                  --~--~---------~--~----~------------~-------~--~----~
                  You received this message from the "vim_use" maillist.
                  For more information, visit http://www.vim.org/maillist.php
                  -~----------~----~----~----~------~----~------~--~---
                Your message has been successfully submitted and would be delivered to recipients shortly.