sponsor Vim development Vim logo Vim Book Ad

FiletypeRegisters : Localize register contents based on filetype

 script karma  Rating 0/0, Downloaded by 867  Comments, bugs, improvements  Vim wiki

created by
Salman Halim
 
script type
utility
 
description
Plugin to keep certain registers (specified by the global variable
g:localRegisters) specific to individual filetypes.  For example, if editing
a Java file in one window and a Vim script in another, one may want to
search for a variable name in the Java window that has no bearing in the Vim
window; however, ordinary functionality would clobber the Vim window search
register value, requiring the use of search history if the original
expression was complicated.

This relies on my getVar.vim (vimscript #353).

Mappings (default):

<Leader>im -- used to import one register from another filetype

Commands:

Copyregister -- used to import one register from another filetype (the
mapping just executes this command)

Customizations:

By default, no registers are localized (so no behavior changes should be
noticed).  To localize registers, place an assignment to g:localRegisters
inside your _vimrc:

let g:localRegisters="abcm/"

The above allows registers a, b, c, m and the search register to be
localized based on filetype (all Vim scripts get one copy, all Java files
another etc.).

To change the default mapping for importing register contents from another
filetype, create a normal mode mapping to <Plug>CopyRegister in your _vimrc.

TODO:

- Keith Roberts:  Allow certain filetypes to retain global settings through
  the use of an option (set through an ftplugin, for example) -- these would
  inherit the settings of the last window, in all likelihood, rather than
  setting their own.

- Maybe allow certain filetypes to ALWAYS keep in synch with others?
 
install details
Pop it into the plugin directory and assign a value to g:localRegisters inside your _vimrc.
 

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
FiletypeRegisters.vim 1.1 2004-05-20 6.0 Salman Halim 1.1:  Added ability for different filetypes to have their own set of stored
registers.  Note that if a filetype has explicit registers set, it does NOT
automatically also get localized storage of the global ones -- they have to
be explicitly included in the local version (setup through the call to
Setfiletyperegisters).  Suggested by Keith Roberts.
FiletypeRegisters.vim 1.0 2004-05-20 6.0 Salman Halim Initial upload
ip used for rating: 3.227.251.94

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.
   
OSDN