sponsor Vim development Vim logo Vim Book Ad

marvim : Macro Persistent Storage and Shareable Repository for VIM

 script karma  Rating 128/39, Downloaded by 1948    Comments, bugs, improvements  Vim wiki

created by
Chamindra de Silva
script type
MARVIM - MAcro Repository for VIM

"Give your most complex macros a name and store it for future recall and use"

Problem statement(s):
   * Can not remember those complex VIM macro sequences you use frequently?
   * Wish you could save those macros beyond your immediate session?
   * Wish you could share your VIM macros with each other?
   * Why not templates as well in the same script?

    * Recording of VIM macros into persistent storage for future use
    * Auto-complete based recursive search and load of stored VIM macros
    * Visually select and save templates into persistent storage
    * Macro namespaces, to permit organization of macros
    * Support for a default namespace based on filetype
    * Supports a shared macro repository for a team on a shared directory
    * Macro menu items in GVIM version for all main actions

<F2>            - Find and execute a macro or insert template from repository
Visual <F2> - Replays last macro for each line selected
<F3>             - Save default macro register by name to the macro repository
Visual <F3>  - Save selection as template by name to the macro repository
<Tab>            - On the Macro command line for cycling through autocomplete
<Control>+D - On the Macro command line for listing autocomplete options

o Store a new macro to the repository

1)  record macro as usual into q register
    (i.e. qq..<macro keystrokes>..q)
2)  press save macro key <F3> (default) in normal mode
3)  enter the macro name when prompted after the prefix
    (a prefix will be provided based on the filetype)
4)  macro is now store in the repository

o Save template into repository

1)  select area you want to save in visual mode
2)  press the macro save button <F3> (default) in visual mode
3)  enter the template name when prompted
    (a prefix will be provided based on the filetype)
4)  template is now saved in repository

o Recall macro/template through a search

1)  press the macro find key <F2> (default) in normal mode
2)  enter a search string when prompted
    (a prefix will be put by default, which can be deleted)
3)  press <Tab> or <Control-D> to auto-complete until you find the macro
4)  macro is now run and also loaded for further use into the q register

o Replay last loaded macro on multiple lines for each line

1)  select the area you want the macro to run on in visual mode
2)  press the macro find key <F3> (default) in visual mode
3)  macro in q register is replayed for every line

Bugs, Patches, Help and Suggestions
If you have some feedback, find any bugs or need some help, please send
and email to chamindra [at] gmail.com and put the word marvim in the
subject line.

Further information
Read the README file or goto http://chamindra.googlepages.com/marvim

install details
* Download Marvim to your VIM plugin ($VIMRUNTIME/plugin) directory
  or source it explicitly. Below is an example if you place it in
  the home directory

  source $HOME/marvim.vim

* Start vim and this will automatically create the base marvim macro
  repository in your home directory. Based on the OS it will be
  located as follows:

  UNIX      ~/.marvim  
  WINDOWS   C:\Document and Settings\Username\marvim

* (optional) Copy predefined macro/template directories into the base
  marvin macro directory. Marvim uses recursive directory search so
  you can nest the directories as you wish.

* (optional) change the default hotkeys as given above

Changing the default hotkeys, repository and macro register
Optionally place the following lines in your vimrc before the location
you source the marvim.vim script (don't worry about location if
the script is in the vim plugin directory).

  " to change the macro storage location use the following
  let marvim_store = '/usr/local/share/projectX/marvim'
  let marvim_find_key = '<Space>' " change find key from <F2> to 'space'
  let marvim_store_key = 'ms'     " change store key from <F3> to 'ms'
  let marvim_register = 'c'       " change used register from 'q' to 'c'
  let marvim_prefix = 0           " disable default syntax based prefix


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
marvim.tar.gz 0.4 2008-09-28 7.0 Chamindra de Silva Change Log
- Now supports auto-completion based recursive search for macros on the command  line
- Use <Tab> and <Ctrl-D> to search for macros in command line as usual in VIM
- The default name space is taken from the file type on the command line ( e.g. php:)
marvim.tar.gz 0.3 2008-09-21 6.0 Chamindra de Silva Changelog - v0.3 Beta
- New namespace features for macro that map to macro sub-directories
- Supported the creation of macros and templates in a namespace
- Creates namespace directories if they do not exist
- Added the ability to point to a different macro store
- The above permits a shared macro/template repository within a team
- Refactored code to make macro and template saving a function
- Fixed bug on windows listing of macros without whole path name

marvim.tar.gz 0.2 2008-02-15 7.0 Chamindra de Silva Change Log
- Made script windows compatible
- Makes the macro home directory if it does not exist
- Recursively looks up base repository subdirectories for macros
- Creates a macro menu for the GUI versions
- Changed defauly macro input register to q
- Made it easy to define configuration details in vimrc
- Abstracted hotkeys so that they can be defined in the vimrc easily
- Fixed the breaking on spaces in directory paths
- Changed template extension to mvt for ease
- Changed naming conventions to avoid namespace conflict
marvim.tar.gz 0.1 2008-02-13 7.0 Chamindra de Silva Initial upload
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.
SourceForge.net Logo