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

Re: How to do column operations within VIM?

Expand Messages
  • Charles E Campbell Jr
    ... Look into using vis.vim; with it, you can visual-block select (:help visual-block) ... and the results will be restricted to the selected column. You can
    Message 1 of 6 , Oct 1, 2007
    • 0 Attachment
      xz wrote:

      >I did this before but do not remember how.
      >What is frustrating is I cannot google it out :(
      >Anybody tell me how to do this?
      >
      >
      Look into using vis.vim; with it, you can

      visual-block select (:help visual-block)
      :B any-ex-operation

      and the results will be restricted to the selected column.

      You can get vis.vim from:

      http://vim.sourceforge.net/scripts/script.php?script_id=1195 (stable)
      http://mysite.verizon.net/astronaut/vim/index.html#VIS
      (cutting edge)


      To install if you're using vim7.1:

      1. Install a new version of vis:
      vim vis.vba.gz
      :so %
      :q


      To install if you're using vim7.0:

      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) Install a new version of vis:
      vim vis.vba.gz
      :so %
      :q

      Regards,
      Chip Campbell


      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • xz
      On Oct 1, 2:47 pm, Charles E Campbell Jr ... Thanks for the reply. But.... no internal way?
      Message 2 of 6 , Oct 1, 2007
      • 0 Attachment
        On Oct 1, 2:47 pm, Charles E Campbell Jr <drc...@...>
        wrote:
        > xz wrote:
        > >I did this before but do not remember how.
        > >What is frustrating is I cannot google it out :(
        > >Anybody tell me how to do this?
        >
        > Look into using vis.vim; with it, you can
        >
        > visual-block select (:help visual-block)
        > :B any-ex-operation
        >
        > and the results will be restricted to the selected column.
        >
        > You can get vis.vim from:
        >
        > http://vim.sourceforge.net/scripts/script.php?script_id=1195 (stable)
        > http://mysite.verizon.net/astronaut/vim/index.html#VIS
        > (cutting edge)
        >
        > To install if you're using vim7.1:
        >
        > 1. Install a new version of vis:
        > vim vis.vba.gz
        > :so %
        > :q
        >
        > To install if you're using vim7.0:
        >
        > 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) Install a new version of vis:
        > vim vis.vba.gz
        > :so %
        > :q
        >
        > Regards,
        > Chip Campbell


        Thanks for the reply.
        But.... no internal way?


        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Charles E Campbell Jr
        ... Guess why the plugin was written! Chip Campbell --~--~---------~--~----~------------~-------~--~----~ You received this message from the vim_use
        Message 3 of 6 , Oct 1, 2007
        • 0 Attachment
          xz wrote:

          >
          >
          >Thanks for the reply.
          >But.... no internal way?
          >
          >
          >
          Guess why the plugin was written!

          Chip Campbell


          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Tim Chase
          ... [snipped long answer from Dr. Chip] ... I think Dr. Chip may have given you the $5 answer to what may have been a $0.05 question...Vim supports basic
          Message 4 of 6 , Oct 1, 2007
          • 0 Attachment
            >>> I did this before but do not remember how.
            >>> What is frustrating is I cannot google it out :(
            >>> Anybody tell me how to do this?
            >> Look into using vis.vim; with it, you can
            [snipped long answer from Dr. Chip]
            >
            > Thanks for the reply.
            > But.... no internal way?

            I think Dr. Chip may have given you the $5 answer to what may
            have been a $0.05 question...Vim supports basic column operations
            through "visual block mode" using control+V (or, IIUC, control+Q
            if you're one of the poor folks that source mswin.vim). You can
            read about it at

            :help blockwise-visual
            :help visual-block

            There are some basic operations you can perform on these
            blockwise units:

            :help blockwise-operators

            which include things like prepending/appending, shifting,
            replacing, and cut/copy/paste'ing.

            Dr. Chip's solution was like swatting flies with a battleship :)
            He gave you a pointer to a solution that massively expands upon
            the above-mentioned basic inbuilt functionality. If what you
            want is just the basic operations that Vim supplies in a stock
            build, then there's no need for the vis.vim script. However, if
            you do have need to do more with visual blocks, the vis.vim
            script is your one-stop-shop for many, many things.

            -tim






            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_use" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • Charles E Campbell Jr
            ... True -- there are some things you can do, such as replace a column with a character, yank it, put it, and apply a change (this operation is not
            Message 5 of 6 , Oct 1, 2007
            • 0 Attachment
              Tim Chase wrote:

              >>>>I did this before but do not remember how.
              >>>>What is frustrating is I cannot google it out :(
              >>>>Anybody tell me how to do this?
              >>>>
              >>>>
              >>>Look into using vis.vim; with it, you can
              >>>
              >>>
              >[snipped long answer from Dr. Chip]
              >
              >
              >>Thanks for the reply.
              >>But.... no internal way?
              >>
              >>
              >
              >I think Dr. Chip may have given you the $5 answer to what may
              >have been a $0.05 question...Vim supports basic column operations
              >through "visual block mode" using control+V (or, IIUC, control+Q
              >if you're one of the poor folks that source mswin.vim). You can
              >read about it at
              >
              > :help blockwise-visual
              > :help visual-block
              >
              >There are some basic operations you can perform on these
              >blockwise units:
              >
              > :help blockwise-operators
              >
              >which include things like prepending/appending, shifting,
              >replacing, and cut/copy/paste'ing.
              >
              >Dr. Chip's solution was like swatting flies with a battleship :)
              > He gave you a pointer to a solution that massively expands upon
              >the above-mentioned basic inbuilt functionality. If what you
              >want is just the basic operations that Vim supplies in a stock
              >build, then there's no need for the vis.vim script. However, if
              >you do have need to do more with visual blocks, the vis.vim
              >script is your one-stop-shop for many, many things.
              >
              >

              True -- there are some things you can do, such as replace a column with
              a character, yank it, put it, and apply a change (this operation is not
              substitute).

              Usually this question is asked by those who wish to do a substitute on a
              column -- and for that, vis.vim is good.

              Regards,
              Chip Campbell


              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_use" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            Your message has been successfully submitted and would be delivered to recipients shortly.