sponsor Vim development Vim logo Vim Book Ad

vis : Extended Visual Mode Commands, Substitutes, and Searches

 script karma  Rating 156/59, Downloaded by 6292  Comments, bugs, improvements  Vim wiki

created by
Charles Campbell
script type
I'm hereby making the <vis.vim> script, long available at http://www.drchip.org/astronaut/vim/index.html#VIS, also available here at vim.sf.net.  There are two commands made available: B and S.

Visual Commands:


    Use V, v, or ctrl-v to visually mark some region.  Then use
       :B cmd     (this command will appear as:   :'<,'>B cmd)

    The command will then be applied to just the visually selected region.
    For examples:

      Use ctrl-v to select a column and then do a substitute on just that column.  
      ctrl-v ..move.. :B s/pattern/becomes/
      Use ctrl-v to select a column, then apply an external filter to just that column.
      ctrl-v ..move.. :B !sort

Visual Searches:


    Use V, v, or ctrl-v to visually mark some region.  Then use
        :S pattern   (this search will appear as     :'<,'>S pattern)

    The search will then be applied to just the visually selected region.
    It may be repeated with n and N commands, too (without having to
    re-mark the region).  A plain S will apply the last :S-pattern
    to the latest selected region.

Related Subjects:

* For incrementing/decrementing numbers, dates, and letters in a column: see vimscript#670 and vimtip#150
* For sorting based on a column (column-restricted, whole lines but column-keyed), see vimtip#588
* For overwriting visual blocks with other visual blocks: see vimtip#808
* For more on applying substitutes to a visual block: see vimtip#63
* For swapping pairs of visual blocks: see vimtip#329

(alpha/beta version available at http://www.drchip.org/astronaut/vim/index.html#VIS)
install details
vim vis.vba.gz
:so %

(uses vimscript#1502's vimball archiver)

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vis.vba.gz 20 2013-03-29 7.0 Charles Campbell Split into a plugin/autoload pair (faster vim startup).
Cedit bypassed in vis.vim (bugfix).
Fixed bug where VisBlockCmd() effectively shortened a visual block selection due to a short last line.
vis.vba.gz 19 2006-06-20 7.0 Charles Campbell improvement -- cecutil updated to use keepjumps (vim 7.0)
bugfix -- small mod made to allow AlignMaps to work with visual blocks (...:B norm \somemap)
bugfix -- works around formatoption setting
vis.tar.gz 18 2005-08-26 6.0 Charles Campbell Bugfix - vis.vim now works around a virtcol() behavior difference between ve=all vs ve=block
(effect -- a ctrl-v selected region, with ve=block and a short last line, didn't build a search pattern for the entire block)
vis.tar.gz 17 2005-04-25 6.0 Charles Campbell Vis.vim now uses cecutil.vim functions; I've now included them in the tarball to make installation simpler.
vis.vim.gz 16 2005-04-14 6.0 Charles Campbell * Both B and S visual mode commands now use <q-args> instead of <args>
* Visual character selections (v) didn't restrict itself to the selected region when either ignorecase is used or if only one or two lines were in the region.
vis.vim.gz 15 2005-02-01 6.0 Charles Campbell Visual Commands, Substitutes, and Searches (visual line, character, and block)
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.