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

How to filter only portion of a line, and not the whole line?

Expand Messages
  • ben lieb
    Greetings Vim Users! This is my first post, so Hello all from North Carolina! I have decided to write some perl filters for vim, but was disappointed that it
    Message 1 of 3 , Jan 27, 2007
    View Source
    • 0 Attachment
      Greetings Vim Users! This is my first post, so Hello all from North
      Carolina!

      I have decided to write some perl filters for vim, but was disappointed
      that it seems I can only filter WHOLE LINES (and not selected parts of
      lines). Is this true?

      I found that...

      :'<,'>!my_filter.pl

      ...is given the whole line, even when only two words in the middle of
      the line are selected. Is there any way to send only parts of lines and
      not the whole line(s).

      Thanks in advance for any and all help, and since this is my first post,
      I want to say a big THANK YOU to all those in the vim dev community for
      maintaining such a powerful tool!
    • A.J.Mechelynck
      ... Filters are line-oriented. If you want to give only part of a line (or a blockwise visual selection, which is part of several lines) to a filter, one
      Message 2 of 3 , Jan 28, 2007
      View Source
      • 0 Attachment
        ben lieb wrote:
        > Greetings Vim Users! This is my first post, so Hello all from North
        > Carolina!
        >
        > I have decided to write some perl filters for vim, but was disappointed
        > that it seems I can only filter WHOLE LINES (and not selected parts of
        > lines). Is this true?
        >
        > I found that...
        >
        > :'<,'>!my_filter.pl
        >
        > ...is given the whole line, even when only two words in the middle of
        > the line are selected. Is there any way to send only parts of lines and
        > not the whole line(s).
        >
        > Thanks in advance for any and all help, and since this is my first post,
        > I want to say a big THANK YOU to all those in the vim dev community for
        > maintaining such a powerful tool!
        >
        >
        >

        Filters are line-oriented.

        If you want to give only part of a line (or a blockwise visual selection,
        which is part of several lines) to a filter, one possible workaround is to
        extract whatever you want to filter to a temporary buffer and filter that.


        Best regards,
        Tony.
      • Gary Johnson
        ... There is a plugin that lets you do this, vis.vim. You can find it here: http://vim.sourceforge.net/scripts/script.php?script_id=1195 HTH, Gary -- Gary
        Message 3 of 3 , Jan 28, 2007
        View Source
        • 0 Attachment
          On 2007-01-28, ben lieb <red@...> wrote:

          > I have decided to write some perl filters for vim, but was disappointed
          > that it seems I can only filter WHOLE LINES (and not selected parts of
          > lines). Is this true?
          >
          > I found that...
          >
          > :'<,'>!my_filter.pl
          >
          > ...is given the whole line, even when only two words in the middle of
          > the line are selected. Is there any way to send only parts of lines and
          > not the whole line(s).

          There is a plugin that lets you do this, vis.vim. You can find it
          here:

          http://vim.sourceforge.net/scripts/script.php?script_id=1195

          HTH,
          Gary

          --
          Gary Johnson | Agilent Technologies
          garyjohn@... | Wireless Division
          | Spokane, Washington, USA
        Your message has been successfully submitted and would be delivered to recipients shortly.