sponsor Vim development Vim logo Vim Book Ad

VcsMessageRecall : Browse and re-insert previous VCS commit messages.

 script karma  Rating 4/1, Downloaded by 296    Comments, bugs, improvements  Vim wiki

created by
Ingo Karkat
 
script type
utility
 
description
DESCRIPTION
This plugin automatically persists commit messages from Git, Mercurial,
Subversion (and potentially other version control systems) when Vim is invoked
as the commit message editor. It sets up mappings and commands to iterate
through stored past messages, and recall the contents (without the boilerplate
text at the bottom of each message) for use in the currently edited message.
This way, you automatically collect a history of (committed or aborted) past
messages, and can quickly base your current message on contents recalled from
that history.

USAGE
See MessageRecall-message-usage for the available mappings and commands.

The commit messages are stored separately for each repository, no matter from
which subdirectory of the repository you're committing. The location of the
message store is
    {.git,.hg,.svn}/commit-msgs/
As repositories typically contain totally different projects, it's unlikely
that you need to recall messages from a different repository, but if you need
to, you can still pass that path to the :MessageRecall command, or even
reconfigure the plugin to use a single, global message store.

EXAMPLE
You commit a set of changes via "git commit". Vim is invoked on the
.git/COMMIT_EDITMSG file, which so far just shows the boilerplate comments at
the bottom of the file.
You press CTRL-P to recall the previous commit message, because this commit is
related to it, and you want to re-use parts of its description. The previous
commit message is inserted above the boilerplate.
Was it that message? You browse through some more via CTRL-P and CTRL-N, then
start editing. Oh, there also was some useful information in the third last
commit. A 3_CTRL-P opens that message in the preview window (because your
current message is now modified, and therefore won't be replaced).
From there, you yank and paste the sentence into your current commit message.
You could have also incorporated the entire message via :3MessageRecall,
either from the preview window, or directly inside the current message.

Finally, you finish your message. But DUH! you actually forgot to fix
something. You bail out via :cquit!, and Git aborts the commit. Nothing is
lost, though. On the next try, a simple CTRL-P or :MessageRecall will retrieve
your carefully crafted text.
 
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 VcsMessageRecall.vba.gz
    :so %
To uninstall, use the :RmVimball command.

DEPENDENCIES
- Requires Vim 7.0 or higher.
- Requires the EditSimilar plugin (vimscript #2544), version 2.00 or higher.
- Requires the BufferPersist plugin (vimscript #4115).
- Requires the MessageRecall plugin (vimscript #4116).
 

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
VcsMessageRecall.vba.gz 1.02 2012-07-12 7.0 Ingo Karkat - FIX: Typo in function name breaks Subversion support.
- FIX: Avoid determining message store location when a stored message is edited.
- Split off VcsMessageRecall#Setup() to consolidate the setup duplicated for each VCS and to introduce error handling. Exceptions should not reach the user, as this aborts the opening of the file. Rather, just print out the error and continue.
- Revise range regexp again to also match an empty line above the boilerplate; this will be discarded by BufferPersist, anyway. We need a match in that case to properly replace a just-opened, otherwise empty commit message via CTRL-P or :MessageRecall.
VcsMessageRecall.vba.gz 1.01 2012-06-28 7.0 Ingo Karkat Revise range regexp to avoid capturing an empty line before (more empty lines before) the boilerplate, and to avoid capturing the first line of the boilerplate when at line 1.
VcsMessageRecall.vba.gz 1.00 2012-06-25 7.0 Ingo Karkat Initial upload
ip used for rating: 54.163.70.249

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