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

91154Re: keeping lines selected even after a filter has been applied.

Expand Messages
  • Tony Mechelynck
    Jun 2, 2008
      On 03/06/08 00:04, Rahul wrote:
      > Normally after using a visual select followed by a filter, the
      > selected lines lose focus (i.e. no longer remain selected).
      > That makes it hard to reapply the same filter over and over on a block
      > of lines. Is there a way to change this behaviour for a certain
      > command.
      > A concrete example:
      > I write a filter "Rot" that rotates a molecule (defined by a block of
      > visually selected lines) in small increments:
      > command -range=% -nargs=* Rot '<,'>!rot %<args>
      > It might make sense for a user to keep repeatedly applying it to the
      > same block. Thus, I want to keep the block selected until, say, the
      > user presses the Esc key. Is there a way of achieving this? (Of
      > course, my filter does not increase / decrease the number of lines.
      > i.e. operates on n visually selected lines to produce n modified
      > lines)
      > --
      > Rahul

      You can use the :'<,'> range even when no visual area is selected -- it
      means "from start line to end line of the _latest_ visual selection.

      Best regards,
      ARTHUR: Be quiet! I order you to shut up.
      OLD WOMAN: Order, eh -- who does he think he is?
      ARTHUR: I am your king!
      OLD WOMAN: Well, I didn't vote for you.
      "Monty Python and the Holy Grail" PYTHON (MONTY)

      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
    • Show all 8 messages in this topic