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

trouble with motions to a fold?

Expand Messages
  • Tim Chase
    zj and zk seem like pseudo-motions...while they move the cursor, they can t be used as real motions for commands that take operators. If you want to delete
    Message 1 of 2 , Apr 1, 2003
    • 0 Attachment
      zj and zk seem like pseudo-motions...while they move the cursor, they
      can't be used as real motions for commands that take operators. If you
      want to delete "from here to the next fold", I would normally assume that

      dzj

      would do the trick. However, vim returns to normal mode after getting the
      "dz" and doesn't take the "j", treating it as just a "next line"

      It's not just the "d" operator, but the "zf" (where I first found the
      problem, trying to create a fold from "here to the previous fold" with
      "zfzk") and surely others. Is this a bug, a feature, has it already been
      fixed and my 6.0 is just old and stale, or am i nutso? ;*) Has anybody
      else experienced this? And have a work-around or patch?

      Thanks in advance,

      -tim
    • Bram Moolenaar
      ... Earlier today Ralf Hetzel reported the same problem. Coincidence? Using zj and zk as a motion after an operator wasn t supported so far. But it s
      Message 2 of 2 , Apr 1, 2003
      • 0 Attachment
        Tim Chase wrote:

        > zj and zk seem like pseudo-motions...while they move the cursor, they
        > can't be used as real motions for commands that take operators. If you
        > want to delete "from here to the next fold", I would normally assume that
        >
        > dzj
        >
        > would do the trick. However, vim returns to normal mode after getting the
        > "dz" and doesn't take the "j", treating it as just a "next line"
        >
        > It's not just the "d" operator, but the "zf" (where I first found the
        > problem, trying to create a fold from "here to the previous fold" with
        > "zfzk") and surely others. Is this a bug, a feature, has it already been
        > fixed and my 6.0 is just old and stale, or am i nutso? ;*) Has anybody
        > else experienced this? And have a work-around or patch?

        Earlier today Ralf Hetzel reported the same problem. Coincidence?

        Using "zj" and "zk" as a motion after an operator wasn't supported so
        far. But it's easy to make it work:

        *** ../vim61.434/src/normal.c Sun Mar 23 21:06:00 2003
        --- src/normal.c Tue Apr 1 20:01:35 2003
        ***************
        *** 339,345 ****
        {'w', nv_wordcmd, 0, FALSE},
        {'x', nv_abbrev, NV_KEEPREG, 0},
        {'y', nv_operator, 0, 0},
        ! {'z', nv_zet, NV_NCH_NOP, 0},
        {'{', nv_findpar, 0, BACKWARD},
        {'|', nv_pipe, 0, 0},
        {'}', nv_findpar, 0, FORWARD},
        --- 339,345 ----
        {'w', nv_wordcmd, 0, FALSE},
        {'x', nv_abbrev, NV_KEEPREG, 0},
        {'y', nv_operator, 0, 0},
        ! {'z', nv_zet, NV_NCH_ALW, 0},
        {'{', nv_findpar, 0, BACKWARD},
        {'|', nv_pipe, 0, 0},
        {'}', nv_findpar, 0, FORWARD},
        ***************
        *** 4126,4134 ****
        if (
        #ifdef FEAT_FOLDING
        /* "zf" and "zF" are always an operator, "zd", "zo", "zO", "zc"
        ! * and "zC" only in Visual mode. */
        cap->nchar != 'f' && cap->nchar != 'F'
        && !(VIsual_active && vim_strchr((char_u *)"dcCoO", cap->nchar))
        &&
        #endif
        checkclearop(cap->oap))
        --- 4126,4136 ----
        if (
        #ifdef FEAT_FOLDING
        /* "zf" and "zF" are always an operator, "zd", "zo", "zO", "zc"
        ! * and "zC" only in Visual mode. "zj" and "zk" are motion
        ! * commands. */
        cap->nchar != 'f' && cap->nchar != 'F'
        && !(VIsual_active && vim_strchr((char_u *)"dcCoO", cap->nchar))
        + && cap->nchar != 'j' && cap->nchar != 'k'
        &&
        #endif
        checkclearop(cap->oap))


        --
        "My particular problem is with registry entries, which seem to just accumulate
        like plastic coffee cups..." -- Paul Moore

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
        \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
        \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///
      Your message has been successfully submitted and would be delivered to recipients shortly.