BufferPersist : Save certain buffers somewhere when quitting them.
script karma |
Rating 0/0,
Downloaded by 1226 |
Comments, bugs, improvements
|
Vim wiki
|
created by |
Ingo Karkat |
|
script type |
utility |
|
description |
DESCRIPTION
This plugin automatically persists (parts of) certain buffers when Vim is done
editing the buffer, regardless of whether is was saved to a file or discarded.
In this way, this is related to the built-in persistent-undo functionality,
but rather meant for building a history of file contents to allow browsing and
recall, especially for things like commit messages, where Vim is invoked as
the editor from an external tool.
SEE ALSO
This plugin is used by:
MessageRecall (vimscript #4116): Browse and re-insert previous (commit,
status) messages.
USAGE
The plugin is completely inactive until you set it up for a particular
buffer through the following function; you'll find the details directly in the
.vim/autoload/BufferPersist.vim implementation file.
BufferPersist#Setup( BufferStoreFuncref, ... )
EXAMPLE
Let's store the first three lines of each edited text file in the temp
directory, using the text file's filename prefixed with "preview-":
function! BufferStore( bufNr )
return $TEMP . '/preview-' . fnamemodify(bufname(a:bufNr), ':t')
endfunction
autocmd BufNew,BufRead *.txt call BufferPersist#Setup(
\ function('BufferStore'),
\ {'range': '1,3'}
\) |
|
install details |
INSTALLATION
This script is packaged as a vimball. If you have the "gunzip" decompressor
in your PATH, simply edit the *.vba.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 BufferPersist.vba.gz
:so %
To uninstall, use the :RmVimball command.
DEPENDENCIES
- Requires Vim 7.0 or higher. |
|
script versions (upload new version)
Click on the package to download.
BufferPersist-1.10.vmb.gz |
1.10 |
2024-10-03 |
7.0 |
Ingo Karkat |
- ENH: Offer definition of a buffer-local command to persist the current buffer state on demand, via a:options.writeCommandName.
- Minor: Make substitute() robust against 'ignorecase'.
- Don't clobber the search history with the a:options.range (if given and using a /{pattern}/ address).
- Add dependency to ingo-library (vimscript #4433). *** You need to separately install ingo-library (vimscript #4433) version 1.044 (or higher)! *** |
BufferPersist.vba.gz |
1.00 |
2012-06-25 |
7.0 |
Ingo Karkat |
Initial upload |
ip used for rating: 142.132.191.50
|