SnippetCompleteSnipMate : Integrate snipMate snippets into SnippetComplete plugin.
script karma |
Rating 0/0,
Downloaded by 1555 |
Comments, bugs, improvements
|
Vim wiki
|
created by |
Ingo Karkat |
|
script type |
utility |
|
description |
DESCRIPTION
Simple expansions can be done with Vim's built-in abbreviations, but for
form-like text fragments that contain multiple cursor stops or mirrored
replacements of typed text, one needs a plugin like the popular snipMate
(vimscript #2540). As many snippets start simple but are extended later on, it
is useful to have a completion for both abbreviations and snippets, so that
you don't need to remember how the text fragment you want to use is defined.
Apart from the integration with abbreviations, this plugin offers the
following advantages over the CTRL-R <Tab> completion built into snipMate
itself:
- Summary rendering of the snippet expansion in the completion popup menu,
including the number of lines the snippet expands to and the number of
multi-snips alternatives.
- Preview of the full snippet / all multi-snips (when 'completeopt' contains
"preview").
This plugin integrates snipMate snippets into the insert mode completion for
Vim abbreviations of the SnippetComplete.vim plugin (vimscript #2926), and
offers an additional completion only for snipMate snippets.
USAGE
The plugin extends the i_CTRL-X_] completion of Vim insert mode
abbreviations from the SnippetComplete.vim plugin with snippets from
snipMate. Just continue using that as before.
Snippets appear in the completion popup prefixed with "%N", where N is the
number of lines that the snippet expands to. Multi-snips appear as "M*N",
where M is the number of alternatives.
Alternatively, this plugin provides an additional CTRL-X <Tab> completion
solely for snipMate snippets, excluding Vim abbreviations.
CTRL-X <Tab> Find matches for snipMate snippets that start with the
text in front of the cursor.
If no matches were found that way, matches anywhere in
the snippet or in the snippet's expanded text will be
shown. So if you can't remember the shortcut, but a
word fragment from the resulting expansion, just try
with that. |
|
install details |
INSTALLATION
This script is packaged as a vimball. If you have the "gunzip" decompressor
in your PATH, simply edit the *.vmb.gz package in Vim; otherwise, decompress
the archive first, e.g. using WinZip. Inside Vim, install by sourcing the
vimball or via the :UseVimball command.
vim SnippetCompleteSnipMate*.vmb.gz
:so %
To be able to access its snippets, snipMate must be patched. Open
~/.vim/plugin/snipMate.vim and insert the following function at the bottom:
fun! GetSnipsInCurrentScope()
let snips = {}
for scope in [bufnr('%')] + split(&ft, '\.') + ['_']
call extend(snips, get(s:snippets, scope, {}), 'keep')
call extend(snips, get(s:multi_snips, scope, {}), 'keep')
endfor
return snips
endf
To uninstall, use the :RmVimball command.
DEPENDENCIES
- Requires Vim 7.0 or higher.
- Requires the SnippetComplete.vim plugin (vimscript #2926), version 2.10 or
higher.
- Requires the snipMate plugin (vimscript #2540)
CONFIGURATION
For a permanent configuration, put the following commands into your vimrc:
If you want to use a different mapping, map your keys to the
<Plug>(SnippetCompleteSnipMate) mapping target _before_ sourcing the script
(e.g. in your vimrc):
imap <C-x><Tab> <Plug>(SnippetCompleteSnipMate)
If you don't need the additional mapping, disable it via:
imap <Plug>Disable(SnippetCompleteSnipMate) <Plug>(SnippetCompleteSnipMate) |
|
script versions (upload new version)
Click on the package to download.
ip used for rating: 142.132.191.50
|