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

AW: list of characterwise vs. linewise exceptions?

Expand Messages
  • Riehm Stephen
    I do something similar all the time - you can use visual mode to force the way vim treats the range. To take your example: delete
    Message 1 of 2 , Oct 1, 2003
    • 0 Attachment
      I do something similar all the time - you can use visual mode to force the
      way vim treats the range.
      To take your example:

      <outer>
      <inner>
      <nestedinner>delete this inner text</nestedInner>
      </inner>
      </outer>

      if you are on the first inner and you type V*d it will delete all the lines
      because V only works linewise.
      (I took the liberty of extending your example to demonstrate that with
      visual mode you can see what you are about to change and possibly extend the
      range before actually doing it)
      The same goes for %, // searching etc.

      As for the exceptions, searching is NOT a linewise movement, it can crosses
      multiple lines but it positions the cursor
      characterwiselylikeifyouknowwhatImean :-)

      Hope this helps

      Steve
      --

      -----Ursprüngliche Nachricht-----
      Von: Tim Chase [mailto:gumnos@...]
      Gesendet: Mittwoch, 1. Oktober 2003 14:52
      An: vim@...
      Betreff: list of characterwise vs. linewise exceptions?


      Reading under my ":he linewise", it states that

      "Generally, motions that move between lines affect lines (are linewise),
      and motions that move within a line affect characters (are characterwise).
      However, there are some exceptions."

      Is there any catalog of these exceptions? I've discovered that various
      searching (slash/?/*/#/n/N) turns out to be characterwise rather than
      linewise, even if they occur across multiple lines. I discovered it by
      attempting to delete a block of xml


      with the cursor in the text of the <inner> tag, if I do a "d*" to delete
      to the next "inner" tag, I would have expected it to leave me with

      <outer>
      </outer>

      however, I end up with something like

      <outer>
      <iinner>
      </outer>

      (where in this case, my cursor was on the first "n" of "inner" before I
      did a "d*")

      I've just taken to doing "d*dd" to clean up that last line, but it does
      bungle the yank contents (they're no longer the block I chose to delete,
      but the remnant line <iinner>.

      I can get by without this, but it would be nice to know what behaviors to
      expect from which movements. Anybody have any such "master-list"?
      Thanks,

      -tim








      Der Inhalt dieser E-Mail oder eventueller Anhänge ist ausschliesslich
      für den bezeichneten Adressaten bestimmt. Wenn Sie nicht der
      vorgesehene Adressat dieser E-Mail oder dessen Vertreter sein
      sollten, so beachten Sie bitte, dass jede Form der Kenntnisnahme,
      Veröffentlichung, Vervielfältigung oder Weitergabe des Inhalts
      dieser E-Mail unzulässig ist. Wir bitten Sie, sich in diesem Fall
      mit dem Absender der E-Mail in Verbindung zu setzen.

      The information contained in this email is intended solely for
      the addressee. If you are not the intended recipient, any form
      of disclosure, reproduction, distribution or any action taken
      or refrained from in reliance on it, is prohibited and may
      be unlawful. Please notify the sender immediately.
    • Riehm Stephen
      Then you might like to try slightly different patterns... the question will then be what s easier for you? regexes or simple commands and cleaning up the
      Message 2 of 2 , Oct 1, 2003
      • 0 Attachment
        Then you might like to try slightly different patterns... the question will
        then be "what's easier for you? regexes or simple commands and cleaning up
        the rough edges?"

        ie: d/\<input\>/+0 would delete the whole line (since the + sets the cursor
        to the beginning of the next line)

        or as someone else mentioned, d*dd would also achieve the same result and is
        probably easier.

        Sorry to hear about your anorexic vim :-(

        Steve
        --

        -----Ursprüngliche Nachricht-----
        Von: Tim Chase [mailto:gumnos@...]
        Gesendet: Mittwoch, 1. Oktober 2003 15:36
        An: Riehm Stephen; vim@...
        Betreff: Re: list of characterwise vs. linewise exceptions?


        > and you type V*d it will delete all the lines because V only works
        linewise.

        Thanks for the suggestion...I've done this, but have fallen out of the
        habit, because a remote machine I regularly use (over which I have no
        control, and which only offers me a jailshelled account) offers only a
        stripped down version of vim compilied without visual commands. (without
        a *lot* of nicities :( ) They had a more souped up version available
        once-upon-a-time, but because of some Python threading issue pegging CPU
        usage, they disabled it for user accounts, so I'm stuck with anorexic-vim
        :) I can't get them to simply rebuild from sources without Python (IIRC,
        this issue has even been fixed in the latest versions). Ah well.

        -tim






        Der Inhalt dieser E-Mail oder eventueller Anhänge ist ausschliesslich
        für den bezeichneten Adressaten bestimmt. Wenn Sie nicht der
        vorgesehene Adressat dieser E-Mail oder dessen Vertreter sein
        sollten, so beachten Sie bitte, dass jede Form der Kenntnisnahme,
        Veröffentlichung, Vervielfältigung oder Weitergabe des Inhalts
        dieser E-Mail unzulässig ist. Wir bitten Sie, sich in diesem Fall
        mit dem Absender der E-Mail in Verbindung zu setzen.

        The information contained in this email is intended solely for
        the addressee. If you are not the intended recipient, any form
        of disclosure, reproduction, distribution or any action taken
        or refrained from in reliance on it, is prohibited and may
        be unlawful. Please notify the sender immediately.
      Your message has been successfully submitted and would be delivered to recipients shortly.