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

moving virual rectange about in virtualedit mode

Expand Messages
  • Yakov Lerner
    I set ve=all and selected a rectangle with Ctrl-V. How can I move this rectangle up/down left/right with arrows ? Thanks Yakov
    Message 1 of 6 , Apr 29, 2007
    • 0 Attachment
      I 'set ve=all' and selected a rectangle with Ctrl-V.
      How can I move this rectangle up/down left/right with arrows ?

      Thanks
      Yakov
    • Yakov Lerner
      ... No, I meant move as in, erase in old place and paint in new place . Yakov
      Message 2 of 6 , Apr 29, 2007
      • 0 Attachment
        On 4/30/07, Sartak <sartak@...> wrote:
        > On 4/29/07, Yakov Lerner <iler.ml@...> wrote:
        > > I 'set ve=all' and selected a rectangle with Ctrl-V.
        > > How can I move this rectangle up/down left/right with arrows ?
        > >
        > > Thanks
        > > Yakov
        > >
        >
        > I assume you're asking how you can move the "other sides" of a visual
        > block. When you're using visual block you usually have control of only
        > one corner (southwest for me most of the time, but it could be any of
        > the four). You can use the o and O commands to start moving different
        > corners. Note that the o command also works in the other two visual
        > modes, and so is very handy.

        No, I meant "move" as in, "erase in old place and paint in new place".

        Yakov
      • Tim Chase
        ... text frame. ... I presume your example should be ... with the c n3 and the d back over the 4 in there which mysteriously vanished from your example.
        Message 3 of 6 , Apr 30, 2007
        • 0 Attachment
          >> Well, could one not do something like the following?
          >>
          >> :vnoremap <down> <down>o<down>o
          >
          > No, I did not mean "move the corners of the selection".
          > I meants "move the contents".
          > I meant "erase the contents at the old place and put the contents
          > at the new place". Imagine moving text frames in the Word.
          > This is what I mean. As if the selection are is a floating
          text frame.
          > For example. Given the file:
          >
          > |--------------
          > |abcdefghijk
          > |123456789
          >
          > I select rectangle 2x2 "ab\n12" with Ctrl-V.
          >
          > I press Down and Right.
          > The result shall be approximately like:
          >
          > |--------------
          > | defghijk
          > | ab456789
          > 12
          >
          > Depending on sophistication, and text under
          > the moving rectangle can be either erase with blanks, or
          > preserved. (more difficult). I'd make it an option.

          I presume your example should be

          |--------------
          | cdefghijk
          |ab3456789
          |12

          with the "c\n3" and the "d" back over the "4" in there
          which mysteriously vanished from your example.

          The following suite of mappings seems to do what you
          describe:

          :vnoremap <down> ygvr<space>gvoo<down>o<down>pgv
          :vnoremap <up> ygvr<space>gvoo<up>o<up>pgv
          :vnoremap <left> ygvr<space>gvoo<left>o<left>pgv
          :vnoremap <right> ygvr<space>gvoo<right>o<right>pgv

          I'm not sure why they need the "oo" in them, but I may have
          stumbled across a bug. Without it, the 2nd and subsequent
          uses mangle the selection when you move. At least in the
          <down> case...I just left it in there for the other 3 cases.

          To reproduce it here, I simply

          :vnoremap <down> ygvr<space>gv<down>o<down>pgv

          and then visual-block something and hit <down> twice.
          Debugging showed that on the second attempt, the <down>
          didn't move the selection properly.

          I don't know so much about swapping bits around or
          remembering what got overwritten for later replacement
          rather than just erasing with spaces. That, as you say,
          would be considerably "more difficult".

          -tim
        • Charles E Campbell Jr
          ... With DrawIt v8d, you can move a selected rectangle about with your mouse. Here s the relevant portion of the help for DrawIt: One may drag
          Message 4 of 6 , May 2 8:49 AM
          • 0 Attachment
            Yakov Lerner wrote:

            > I 'set ve=all' and selected a rectangle with Ctrl-V.
            > How can I move this rectangle up/down left/right with arrows ?

            With DrawIt v8d, you can move a selected rectangle about with your mouse.
            Here's the relevant portion of the help for DrawIt:

            <ctrl-leftmouse>

            One may drag and move a selection with <ctrl-leftmouse>. First,
            select the region using the <leftmouse>. Release the mouse button,
            then press ctrl and the <leftmouse> button; while continuing to press
            the button, move the mouse. The selected block of text will then
            move along with the cursor.

            Here's how to get & install DrawIt (when 7.1 comes out, this will become
            lots easier - just steps 3&4)

            To get an up-to-date version of drawit, you'll also need to get an
            up-to-date version of vimball. So:

            1) Get an up-to-date version of vimball:
            http://vim.sourceforge.net/scripts/script.php?script_id=1502
            -or- http://mysite.verizon.net/astronaut/vim/index.html#VimBall
            (the mysite.verizon.net one will be the more recent version)

            2) Remove the old vimball plugin and install the new one:

            Linux:
            cd /usr/local/share/vim/vim70
            /bin/rm plugin/vimball*.vim autoload/vimball*.vim doc/pi_vimball.txt
            mv (wherever it was downloaded)/vimball.tar.gz .
            gunzip vimball.tar.gz
            tar -xvf vimball.tar

            Windows:
            Under Windows, check your runtimepath to determine where your
            vim 7.0's runtime directories are:

            vim
            :echo &rtp
            :q

            The first directory is likely your personal plugins directory,
            the second one is your vim system directory.

            cd (to your vim system directory)
            del plugin\vimballPlugin.vim
            del autoload\vimball.vim
            del doc\pi_vimball.txt
            ren (wherever)\vimball.tar.gz vimball.tar.gz
            gunzip vimball.tar.gz
            tar -xvf vimball.tar


            3) Get DrawIt:
            http://vim.sourceforge.net/scripts/script.php?script_id=40
            http://mysite.verizon.net/astronaut/vim/index.html#DRAWIT

            4) Install an up-to-date version of Drawit:
            vim DrawIt.vba.gz
            :so %
            :q
          • Gary Johnson
            ... Unfortunately, this works only for gvim, not vim. in an xterm opens the Main Options menu. ... One may need to uninstall (i.e., delete)
            Message 5 of 6 , May 2 10:34 AM
            • 0 Attachment
              On 2007-05-02, Charles E Campbell Jr <drchip@...> wrote:
              > Yakov Lerner wrote:
              >
              > > I 'set ve=all' and selected a rectangle with Ctrl-V.
              > > How can I move this rectangle up/down left/right with arrows ?
              >
              > With DrawIt v8d, you can move a selected rectangle about with your mouse.
              > Here's the relevant portion of the help for DrawIt:
              >
              > <ctrl-leftmouse>
              >
              > One may drag and move a selection with <ctrl-leftmouse>. First,
              > select the region using the <leftmouse>. Release the mouse button,
              > then press ctrl and the <leftmouse> button; while continuing to press
              > the button, move the mouse. The selected block of text will then
              > move along with the cursor.

              Unfortunately, this works only for gvim, not vim. <ctrl-leftmouse>
              in an xterm opens the Main Options menu.

              > Here's how to get & install DrawIt (when 7.1 comes out, this will become
              > lots easier - just steps 3&4)

              > 3) Get DrawIt:
              > http://vim.sourceforge.net/scripts/script.php?script_id=40
              > http://mysite.verizon.net/astronaut/vim/index.html#DRAWIT
              >
              > 4) Install an up-to-date version of Drawit:
              > vim DrawIt.vba.gz
              > :so %
              > :q
              >

              One may need to uninstall (i.e., delete) any earlier version of
              DrawIt, too, specifically the file ~/.vim/plugin/DrawIt.vim. The
              symptoms of needing to do this include vim complaining at startup
              that \di has been defined twice.

              I use the line-drawing capability of DrawIt all the time. I haven't
              done much with the visual-block commands, so I thought I'd try one.
              I think I found a bug in the version of DrawIt from the astronaut
              site.

              I inserted the following two paragraphs of text into a buffer,
              started DrawIt by typing \di, left-clicked the mouse on the
              character in the upper left corner of the region (the 'e' in
              "everywhere", no longer visible below), dragged the visual selection
              to the lower right corner, and typed \b to draw a box.

              Mary had a little lamb,
              Its fleece was white as snow,
              And +------------------+ went,
              The |amb was sure to go|
              ||
              It f|llowed her to scho|l one day,
              Whic+------------------+le,
              And made the children laugh and play
              To see a lamb at school.

              Note that the two bars between the paragraphs are in columns 1 and 2
              instead of 8 and 27.

              Regards,
              Gary

              --
              Gary Johnson | Agilent Technologies
              garyjohn@... | Mobile Broadband Division
              | Spokane, Washington, USA
            • Charles E Campbell Jr
              ... See DrawIt s help, lines 253-256. The visual-block commands require spaces to work in. Most of these commands are imported from Sylvain Viart s
              Message 6 of 6 , May 2 11:05 AM
              • 0 Attachment
                Gary Johnson wrote:

                >On 2007-05-02, Charles E Campbell Jr <drchip@...> wrote:
                >
                >
                >> Yakov Lerner wrote:
                >>
                >>
                >>
                >>>I 'set ve=all' and selected a rectangle with Ctrl-V.
                >>>How can I move this rectangle up/down left/right with arrows ?
                >>>
                >>>
                >> With DrawIt v8d, you can move a selected rectangle about with your mouse.
                >> Here's the relevant portion of the help for DrawIt:
                >>
                >> <ctrl-leftmouse>
                >>
                >> One may drag and move a selection with <ctrl-leftmouse>. First,
                >> select the region using the <leftmouse>. Release the mouse button,
                >> then press ctrl and the <leftmouse> button; while continuing to press
                >> the button, move the mouse. The selected block of text will then
                >> move along with the cursor.
                >>
                >>
                >
                >Unfortunately, this works only for gvim, not vim. <ctrl-leftmouse>
                >in an xterm opens the Main Options menu.
                >
                >
                >
                >> Here's how to get & install DrawIt (when 7.1 comes out, this will become
                >> lots easier - just steps 3&4)
                >>
                >>
                >
                >
                >
                >> 3) Get DrawIt:
                >> http://vim.sourceforge.net/scripts/script.php?script_id=40
                >> http://mysite.verizon.net/astronaut/vim/index.html#DRAWIT
                >>
                >> 4) Install an up-to-date version of Drawit:
                >> vim DrawIt.vba.gz
                >> :so %
                >> :q
                >>
                >>
                >>
                >
                >One may need to uninstall (i.e., delete) any earlier version of
                >DrawIt, too, specifically the file ~/.vim/plugin/DrawIt.vim. The
                >symptoms of needing to do this include vim complaining at startup
                >that \di has been defined twice.
                >
                >I use the line-drawing capability of DrawIt all the time. I haven't
                >done much with the visual-block commands, so I thought I'd try one.
                >I think I found a bug in the version of DrawIt from the astronaut
                >site.
                >
                >I inserted the following two paragraphs of text into a buffer,
                >started DrawIt by typing \di, left-clicked the mouse on the
                >character in the upper left corner of the region (the 'e' in
                >"everywhere", no longer visible below), dragged the visual selection
                >to the lower right corner, and typed \b to draw a box.
                >
                > Mary had a little lamb,
                > Its fleece was white as snow,
                > And +------------------+ went,
                > The |amb was sure to go|
                >||
                > It f|llowed her to scho|l one day,
                > Whic+------------------+le,
                > And made the children laugh and play
                > To see a lamb at school.
                >
                >Note that the two bars between the paragraphs are in columns 1 and 2
                >instead of 8 and 27.
                >
                >
                See DrawIt's help, lines 253-256. The visual-block commands require
                spaces to work in.
                Most of these commands are imported from Sylvain Viart's drawing.vim; I
                haven't tried
                making the "holer" routine obsolete yet.

                Regards,
                Chip Campbell
              Your message has been successfully submitted and would be delivered to recipients shortly.