PrevInsertComplete : Recall and insert mode completion for previously inserted text.
script karma |
Rating 5/5,
Downloaded by 2112 |
Comments, bugs, improvements
|
Vim wiki
|
created by |
Ingo Karkat |
|
script type |
utility |
|
description |
DESCRIPTION
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.
SEE ALSO
- Check out the CompleteHelper.vim plugin page (vimscript #3914) for a full
list of insert mode completions powered by it.
USAGE
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. |
|
install details |
INSTALLATION
The code is hosted in a Git repo at
https://github.com/inkarkat/vim-PrevInsertComplete
You can use your favorite plugin manager, or "git clone" into a directory used
for Vim packages. Releases are on the "stable" branch, the latest unstable
development snapshot on "master".
This script is also 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 PrevInsertComplete*.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.015 or
higher.
- Requires the CompleteHelper.vim plugin (vimscript #3914), version 1.11 or
higher.
- repeat.vim (vimscript #2136) plugin (optional)
CONFIGURATION
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
'viminfo' setting:
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
your vimrc):
imap <C-a> <Plug>(PrevInsertComplete)
nmap <Leader><C-a> <Plug>(PrevInsertRecall)
nmap <Leader><A-a> <Plug>(PrevInsertList) |
|
script versions (upload new version)
Click on the package to download.
ip used for rating: 35.172.193.238
|