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

Re: Problem with Visual selection on an empty line

Expand Messages
  • glts
    ... I m sorry, I should have mentioned that this is just a simplified example. Sometimes I start a selection in the middle of a line and then extend it
    Message 1 of 5 , Apr 9, 2013
    • 0 Attachment
      On Tuesday, April 9, 2013 5:48:25 PM UTC+2, Ben Fritz wrote:
      > On Tuesday, April 9, 2013 6:26:58 AM UTC-5, glts wrote:
      > >
      > > But what if the line between abc and xyz is empty?
      > >
      > > abc
      > >
      > > xyz
      > >
      > > Now vjd will always result in:
      > >
      > > axyz
      > >
      > > But I don't like this, it goes against my intuition. Is there a way to
      > > tell Vim not to include the newline character in the Visual selection,
      > > so that I get the same result as with vjhd?
      > >
      >
      > Why are you including the empty line in your visual selection at all? There is nothing there to delete except the line itself.

      I'm sorry, I should have mentioned that this is just a simplified
      example.

      Sometimes I start a selection in the middle of a line and then extend it
      downwards. Sometimes the selection ends on an empty line or on a stretch
      of empty lines. I can see what I selected and then operate on it.

      It is in these circumstances that I expect a result like:

      a
      xyz

      I expect d to delete the highlighted line or lines so to speak. I don't
      expect it to delete the newline character even though that may be the
      correct behaviour strictly speaking.

      The procedure I'm using now is k$ and then d, but unfortunately that
      solution is not suitable for scripting. Also, I have to remember using
      it.

      --
      --
      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.
    • glts
      ... Yes. Unfortunately, I have to pass the selection to a plugin over which I have no control, so setting selection is out of question. I think I m just
      Message 2 of 5 , Apr 9, 2013
      • 0 Attachment
        On Tuesday, April 9, 2013 5:59:16 PM UTC+2, Christian Brabandt wrote:
        > :set selection=exclusive

        Yes. Unfortunately, I have to pass the selection to a plugin over which
        I have no control, so setting 'selection' is out of question.

        I think I'm just going to back up when getline(ln) =~ '^$' or something.

        Thanks.

        --
        --
        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.