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

list of characterwise vs. linewise exceptions?

Expand Messages
  • Tim Chase
    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
    Message 1 of 5 , Oct 1, 2003
    View Source
    • 0 Attachment
      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

      <outer>
      <inner>
      <nestedinner></nestedInner>
      </inner>
      </outer>

      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
    • Thomas Köhler
      Hi, Tim Chase wrote [2003/10/01]: [...] ... Not being able to help with your original problem (I have no such list, sorry), I have a suggestion for your
      Message 2 of 5 , Oct 1, 2003
      View Source
      • 0 Attachment
        Hi,

        Tim Chase wrote [2003/10/01]:
        [...]
        > I discovered it by attempting to delete a block of xml
        >
        > <outer>
        > <inner>
        > <nestedinner></nestedInner>
        > </inner>
        > </outer>
        >
        > 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>.

        Not being able to help with your original problem (I have no such
        list, sorry), I have a suggestion for your special case: Try
        visual line mode! Instead of typing d*dd - just hit V*d instead.
        This will work like this:
        <outer>
        | <inner>
        | <nestedinner></nestedInner>
        | </inner>
        </outer>

        The lines marked via "|" are in a visual line selection now.
        Hitting d will delete all of these lines (and you can paste the
        whole thing via the p command).

        I often use visual mode in cases where a single vi command would
        do just because I see what it really will affect (and that I did
        not overlook something).

        Ciao,
        Thomas

        --
        Thomas Köhler Email: jean-luc@... | LCARS - Linux
        <>< WWW: http://jeanluc-picard.de | for Computers
        IRC: jeanluc | on All Real
        PGP public key available from Homepage! | Starships
      • Tim Chase
        ... 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
        Message 3 of 5 , Oct 1, 2003
        View Source
        • 0 Attachment
          > 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
        • Antony Scriven
          ... Maybe :help o_V will be of use? I m assuming that that will still be in your stripped-down Vim. Antony
          Message 4 of 5 , Oct 1, 2003
          View Source
          • 0 Attachment
            Tim Chase wrote:

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

            Maybe :help o_V will be of use? I'm assuming that that will
            still be in your stripped-down Vim.

            Antony
          • Tim Chase
            ... wow...learned something new! :) Unfortunately, this seems to require that vim be built with +visual which it s not. I eagerly ssh ed onto the box to test
            Message 5 of 5 , Oct 1, 2003
            View Source
            • 0 Attachment
              > Maybe :help o_V will be of use? I'm assuming that that will
              > still be in your stripped-down Vim.

              wow...learned something new! :) Unfortunately, this seems to require that
              vim be built with +visual which it's not. I eagerly ssh'ed onto the box
              to test it to discover it was a bust. Attempting "dV*" gave me the
              errorbell when I hit the V. It's RH's "Tiny version without GUI" vim6.1
              with the only features enabled being

              +builtin_terms
              +fork()
              +iconv
              +multi_byte
              +terminfo
              +wildignore
              +writebackup

              As stated, it's a pretty stripped down version of vim :)

              Thanks for the new modifier...at least I can use this to solve the problem
              at home :)

              -tim
            Your message has been successfully submitted and would be delivered to recipients shortly.