sponsor Vim development Vim logo Vim Book Ad

multiselect : Create multiple selections and operate

 script karma  Rating 71/32, Downloaded by 5641  Comments, bugs, improvements  Vim wiki

created by
Hari Krishna Dara
 
script type
utility
 
description
This plugin extends the Vim's visual mode functionality by allowing you to
select non-contiguous regions and execute commands on them. It makes it really
easy to select multiple regions using mouse, as you can use Ctrl+Mouse
combination just like in MS Word. There are a number of operations to very
easily manipulate selections such as modifying the regions
(add/delete/inverte/clear), hiding, refreshing, saving and restoring etc. You
can execute both normal and :ex mode commands in one shot on all the regions.
The selections are also local to the buffer, so you can have separate selectins
for each buffer.

Usage:

Once installed, the features are available in all the buffers. To create
selection regions you can use mouse or keyboard.
    - To use mouse, hold Ctrl key and make a visual selection using the
      LeftMouse button just like you normally do. Once the mouse button is
      released, the selection gets automatically added as a new selection
      region. If you are selecting only one line, you can release the mouse
      button without having to drag.
    - To use keyboard, make a visual selection using |visual-mode| commands or
      mouse and press <Enter> to create a new region out of it. The <Enter> (or
      <CR>) key is mapped only if it is not already mapped in visual mode. The
      cursor is placed in the direction of the selection such that it is easier
      to continue moving the cursor for making further selections.
    - To clear part or the whole of a region from selection, repeat the
      same exact procedure over that region. You can however mix mouse and
      keyboard usage. The procedure is equivalent to running the |:MSInvert|
      command as describe in |multiselect-commands|.
    - Once you repeat the procedure to create all the regions that you need to
      act on, use one of the |:MSExecCmd| or |:MSExecNormalCmd| (or one of their
      equivalent maps) to execute commands on them. Ex:
        - Delete all the lines in the current selections >
            MSExecCmd d
        - Convert all the characters in the current selections to upper case. >
            MSExecNormalCmd gU
    - Use |:MSClear| (or its map) to clear the selection.


With the support of multiselect in other plugins, it becomes very useful. E.g., you can execute perfoce commands such as submitting files (using vimscript#240) on a group of selected files, using the multiselect support in selectbuf plugin (vimscript #107). It is possible to extend netrw plugin to support operations on multiple files too.




Search_key_words: multiselect multiple selection select selections mouse hari_vim Hari Krishna Dara
 
install details
Requires:  genutils (vimscript#197)
- Extract the zip archives in to your runtime directory (.vim or vimfiles
  under your HOME directory).
- Start a new instance or go to an existing instance of vim.
- Execute:
    :helpt <your runtime directory>/doc
  This should generate the help tags for the selectbuf plugin help.
- Type :help multiselect to read the help and finish configuration.

For version older than 2.0, you need to download the non-autoload versions of genutils and multvals (vimscript#171) plugins.
 

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
multiselect-2.2.zip 2.2 2006-09-11 7.0 Hari Krishna Dara Changed public API to not autoload script. It doesn't make sense for
public API to load the script if it is not already loaded. This will
also cause problems when the plugin is disabled, but other plugins try
to use it.
multiselect-2.0.zip 2.0 2006-09-03 7.0 Hari Krishna Dara - All the functionality has been rewritten to take advantage of new Vim7
  features such as Lists. The programmatic API is not backwards compatible.
- The plugin is now autoloaded, so it will not be (auto)loaded until you execute
  the first mapping/command. This will help improve the startup time of your Vim
  session.
- Misc. bug fixes have been fixed in the ares of |:MSInvert| and |:MSAdd|.
- The g:multiselTmpMark is no longer required. The plugin now
  uses getpos() and setpos() to avoid overwriting any user marks.
- New setting |g:multiselQuickSelAdds|.
- New commands |:MSMatchAddByDiffHlGroup| and |:MSVMatchAddByDiffHlGroup| to
  select regions in a |vimdiff| window.
multiselect.vim 1.3 2005-03-17 6.0 Hari Krishna Dara - New commands MSMatchAddBySynGroup and MSVMatchAddBySynGroup to select
  lines automatically by their syntax group in a given range. Useful to
  select all lines in comments (or more specifically perl pod) etc. and
  do operations such as running a spell check on them.
- New global function MSAddSelectionsByExpr() for creating new commands
  such as MSMatchAddBySynGroup and MSMatchAdd by the user.
multiselect.vim 1.2 2004-10-28 6.0 Hari Krishna Dara - MSInvert command now works better.
multiselect.vim 1.1 2004-10-20 6.0 Hari Krishna Dara - Full support for mouse in making multiple selections. Works pretty
  much like in MS word.
- Improved behavior for MSInvert.

Get the latest multvals.vim and genutils.vim plugins.
multiselect.vim 1.0 2004-04-04 6.0 Hari Krishna Dara Initial upload
ip used for rating: 142.132.191.50

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.
   
Vim at Github