expander.vim : flexible expansion of abbreviations/templates
script karma |
Rating 0/0,
Downloaded by 490 |
Comments, bugs, improvements
|
Vim wiki
|
created by |
Michael Benfield |
|
script type |
utility |
|
description |
expander.vim requires Vim's Python interface-----
expander expands abbreviations. Its abbreviations can take arguments that are repeated in the expanded text. For instance, for C++ iterators you can type:
@fib@vector<char>@vec<C-e>
and this expands to:
for(vector<char>::iterator i = vec.begin(); i != vec.end(); ++i) {
*
}
With your cursor in the place of the *. Defining new abbreviations is easy. The above one was defined like this:
"fib": """
for($1::iterator i = $2.begin(); i != $2.end(); ++i) {
$#$0
}"""
When expander expands this, it replaces the string $# with spaces equal to your shiftwidth, it puts the cursor at $0, and it replaces $1, $2, etc, with the first, second, etc, arguments. |
|
install details |
Untar expander.tar.bz2 in your ~/.vim so that expander.vim goes into plugin/ and expander.txt goes into doc/. Run :helptags ~/.vim/doc.
:help expander |
|
script versions (upload new version)
Click on the package to download.
ip used for rating: 3.138.102.178
|