SnippetComplete : Insert mode completion that completes defined abbreviations and other snippets.
| script karma |
Rating 3/3,
Downloaded by 397
|
Comments, bugs, improvements
|
Vim wiki
|
| created by |
| Ingo Karkat |
| |
| script type |
| utility |
| |
| description |
DESCRIPTION
Insert mode abbreviations and snippets can dramatically speed up editing, but
how does one remember all those shortcuts that are rarely used? You can list
all insert mode abbreviations via :ia to break out of this vicious circle,
but switching to command mode for that is cumbersome.
This plugin offers a context-sensitive insert mode completion to quickly list
and complete defined abbreviations directly while typing.
SEE ALSO
- The SnippetCompleteSnipMate.vim plugin (vimscript #4276) extends the
completion with snippets for the popular snipMate plugin (vimscript #2540).
USAGE
In insert mode, optionally type part of the snippet shortcut or a fragment
from its expected expansion, and invoke the snippet completion via CTRL-X ].
You can then search forward and backward via CTRL-N / CTRL-P, as usual.
CTRL-X ] Find matches for abbreviations that start with the
text in front of the cursor. If other snippet types
are registered, show those, too.
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.
There are three types of abbreviations (full-id,
end-id and non-id), which can consist of different
characters. Thus, there can be more than one candidate
for the existing completion base, e.g. "pre@c" can
expand into a full-id abbreviation starting with "c"
or into a non-id one starting with "pre@c". The
completion indicates such a ambiguity through the
message "base n of m; next: blah", and you can cycle
through the different completion bases by repeating
the i_CTRL-X_] shortcut.
Matches are selected and inserted as with any other
ins-completion, see popupmenu-keys. If you use
<Space> or i_CTRL-] to select an abbreviation, it'll
be expanded automatically. |
| |
| 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 SnippetComplete*.vmb.gz
:so %
To uninstall, use the :RmVimball command.
DEPENDENCIES
- Requires Vim 7.0 or higher.
- Requires the CompleteHelper.vim plugin (vimscript #3914), version 1.10 or
higher.
CONFIGURATION
If you want to use a different mapping, map your keys to the
<Plug>(SnippetComplete) mapping target _before_ sourcing the script (e.g. in
your vimrc).
For example, to use CTRL-X <Tab>, use this:
imap <C-x><Tab> <Plug>(SnippetComplete)
INTEGRATION
There exist multiple snippet systems that extend the built-in abbreviations
with support for filetype-specific and more complex expansions, like allowing
placeholders and expansion of in-line scriptlets. One popular one is the
snipMate plugin (vimscript #2540).
Since there is a seamless transition from simple abbreviation to complex
snippet, it may help to have a completion for both sources. To support this,
this plugin allows to write completions for other snippet plugins with just a
little bit of configuration and a function to retrieve the valid snippets.
This completion can be stand-alone via a different mapping, or it can add the
snippets to the i_CTRL-X_] completion mapping provided here. |
| |
script versions (upload new version)
Click on the package to download.
ip used for rating: 54.242.233.11
|