sponsor Vim development Vim logo Vim Book Ad

EntryComplete : Insert mode completion based on lines in designated files or buffers.

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

created by
Ingo Karkat
 
script type
utility
 
description
DESCRIPTION
Cheat sheets that contain a single phrase, formula, or function invocation per
line can be very helpful and are used by many people. Using such as a
completion source is difficult, though. The full line completion
(i_CTRL-X_CTRL-L considers other buffers, but cannot be restricted to a
single one. And to trigger the completion, the base has to be written on a new
line; you cannot recall a phrase from within an existing one. All of this can
be avoided by using a snippet plugin, but the syntax to define them usually is
more complex (so one cannot directly use one's cheat sheet), and the
additional features interfere with easy definition. Also, not every snippet
plugin offers the popup selection aspect of insert-mode completion, so you may
have to remember the snippet name to recall it.

This plugin provides a highly configurable completion of lines found in
designated files or buffers, triggered by a keyword in front of the cursor.
With its flexibility, you can use custom cheat sheets for a project, filetype,
or particular buffer or window as well as global ones.

SOURCE
Inspired by
    http://stackoverflow.com/questions/27539429/vim-snippet-phrase-dropdown-menu

SEE ALSO
- Check out the CompleteHelper.vim plugin page (vimscript #3914) for a full
  list of insert mode completions powered by it.

USAGE
In insert mode, invoke the entry completion via CTRL-X CTRL-E
You can then search forward and backward via CTRL-N / CTRL-P, as usual.

CTRL-X CTRL-E           Find matches for entries (i.e. entire lines) from the
                        designated sources configured by
                        g:EntryComplete_Sources.
 
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 EntryComplete*.vmb.gz
    :so %
To uninstall, use the :RmVimball command.

DEPENDENCIES
- Requires Vim 7.0 or higher.
- Requires the ingo-library.vim plugin (vimscript #4433), version 1.019 or
  higher.
- Requires the CompleteHelper.vim plugin (vimscript #3914), version 1.50 or
  higher.

CONFIGURATION
For a permanent configuration, put the following commands into your vimrc:

This completion uses designated files or buffers as completion sources. You
can configure window-local, buffer-local, or global Lists of sources. A Number
is taken as a Vim buffer, a String specifies a filespec, a List directly
specifies matches (either as simple strings, or match objects as described
under complete-items), a Funcref is invoked without arguments and should
return a List of filespecs:
    let g:EntryComplete_Sources = [bufnr('lines.txt'), expand('~/.vimrc'),
    \   ['foo', 'bar', {'word': 'baz', 'menu': 'my favorite'}]
    \]

The default configuration checks for entries in entries/{filetype} in each
'runtimepath' directory, usually in your user's configuration in
~/.vim/entries/{filetype}. You can add additional directories to be checked
via g:EntryComplete_FiletypeEntriesPath or b:EntryComplete_FiletypeEntriesPath.

If you want to use a different mapping, map your keys to the
<Plug>(EntryComplete) mapping target _before_ sourcing the script
(e.g. in your vimrc):
    imap <C-x><C-e> <Plug>(EntryComplete)
 

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
EntryComplete-1.10.vmb.gz 1.10 2017-03-09 7.0 Ingo Karkat - ENH: Support Lists of matches / match objects.
EntryComplete-1.00.vmb.gz 1.00 2014-12-23 7.0 Ingo Karkat Initial upload
ip used for rating: 54.225.59.242

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