PrevInsertComplete : Recall and insert mode completion for previously inserted text.
| script karma
Downloaded by 414
Comments, bugs, improvements
script versions (upload new version)
This plugin lets you quickly recall previous insertions and insert them again
at the cursor position. Essentially, it's the built-in i_CTRL-A command
souped up with history and selection.
In insert mode, you can narrow down the candidates by typing a keyword first;
then, only insertions with a match will be offered as completion candidates.
In normal mode, you can directly recall the [count]'th previous insertion, or
have it list the last 9 insertions and let you choose.
To avoid that the many minor tactical edits clobber up the history, only
significant (longer) edits are recalled.
- Check out the CompleteHelper.vim plugin page (vimscript #3914) for a full
list of insert mode completions powered by it.
CTRL-X CTRL-A Find previous insertions (i_CTRL-A, quote.) whose
contents match the keyword before the cursor. First, a
match at the beginning is tried; if that returns no
results, it may match anywhere.
Further use of CTRL-X CTRL-A will append insertions done
after the previous recall.
[count]q<CTRL-@> Recall and append previous [count]'th insertion.
[count]q<CTRL-A> Lists the last 9 insertions, then prompts for a number.
The chosen insertion is appended [count] times.
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.
To uninstall, use the :RmVimball command.
- Requires Vim 7.0 or higher.
- Requires the ingo-library.vim plugin (vimscript #4433), version 1.015 or
- Requires the CompleteHelper.vim plugin (vimscript #3914), version 1.11 or
- repeat.vim (vimscript #2136) plugin (optional)
For a permanent configuration, put the following commands into your vimrc:
Very short insertions are often just minor corrections and not worthwhile to
recall. The threshold number of inserted characters can be set via:
let g:PrevInsertComplete_MinLength = 6
The number of recorded insertions can be adjusted.
let g:PrevInsertComplete_HistorySize = 100
The recorded insertions can be kept and restored across Vim sessions, using
the viminfo file. For this to work, the "!" flag must be part of the
set viminfo+=! " Save and restore global variables.
By default, all recorded insertions are persisted. You can reduce the maximum
number of insertions to be stored via:
let g:PrevInsertComplete_PersistSize = 10
or completely turn off persistence by setting the variable to 0.
If you want to use different mappings, map your keys to the
<Plug>(PrevInsert...) mapping targets _before_ sourcing the script (e.g. in
imap <C-a> <Plug>(PrevInsertComplete)
nmap <Leader><C-a> <Plug>(PrevInsertRecall)
nmap <Leader><A-a> <Plug>(PrevInsertList)
Click on the package to download.
ip used for rating: 22.214.171.124