sponsor Vim development Vim logo Vim Book Ad

MessageRecall : Browse and re-insert previous (commit, status) messages.

 script karma  Rating 7/4, Downloaded by 286    Comments, bugs, improvements  Vim wiki

created by
Ingo Karkat
 
script type
utility
 
description
DESCRIPTION
This plugin automatically persists (parts of) buffers used for the editing of
commit (or other) messages, where Vim is invoked as the editor from an
external tool. In these buffers, it sets up mappings and commands to iterate
through stored past messages, and recall the contents 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.

SEE ALSO
This plugin is used by:
VcsMessageRecall (vimscript #4117): Browse and re-insert previous VCS commit
                                    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/MessageRecall.vim implementation file.

MessageRecall#Setup( messageStoreDirspec, ... )

INSIDE THE CURRENT MESSAGE BUFFER
After setup, the following mappings and commands are available in the current
message buffer:

CTRL-P, CTRL-N          When the buffer has no unsaved changes: Replace the
                        edited message with a [count]'th previous / next
                        stored message.
                        When the buffer is modified: Open the [count]'th
                        previous / first stored message in the preview window.
                        When the buffer is modified and a stored message is
                        already being previewed: Open the [count]'th previous
                        / next stored message there.

:[count]MessageView
                        View the [count]'th previous stored message in the
                        preview-window.
:MessageView {message}|{filespec}
                        View {message} (auto-completed from the message store
                        directory) or any arbitrary {filespec} contents
                        in the preview-window.

:[count]MessageRecall[!]
                        Insert the [count]'th previous stored message below
                        the current line.
:MessageRecall[!] {message}|{filespec}
                        Insert {message} (auto-completed from the message
                        store directory) or any arbitrary {filespec} contents
                        below the current line.

                        When the existing message consists of just empty
                        lines (originating from the message template that the
                        tool invoking Vim has put there), the inserted message
                        replaces those empty lines. With [!]: Replace an
                        existing message with the inserted one.

INSIDE A MESSAGE PREVIEW WINDOW
CTRL-P, CTRL-N          Go to the previous / next stored message.

:MessageRecall          Insert the previewed stored message below the current
                        line in the buffer from which the message preview was
                        opened.
 
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 MessageRecall*.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.018 or
  higher.
- Requires the EditSimilar plugin (vimscript #2544), version 2.40 or higher.
- Requires the BufferPersist plugin (vimscript #4115).

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

If you want to use different mappings, first disable the default key mappings
in your vimrc:
    map <Plug>DisableMessageRecallPreviewPrev <Plug>(MessageRecallPreviewPrev)
    map <Plug>DisableMessageRecallPreviewNext <Plug>(MessageRecallPreviewNext)
    map <Plug>DisableMessageRecallGoPrev      <Plug>(MessageRecallGoPrev)
    map <Plug>DisableMessageRecallGoNext      <Plug>(MessageRecallGoNext)
Since there's no common filetype for this plugin, User events are fired for
each message buffer. You can hook into these events to define alternative
mappings:
    autocmd User MessageRecallBuffer  map <buffer> <Leader>P <Plug>(MessageRecallGoPrev)
    autocmd User MessageRecallBuffer  map <buffer> <Leader>N <Plug>(MessageRecallGoNext)
    autocmd User MessageRecallPreview map <buffer> <Leader>P <Plug>(MessageRecallPreviewPrev)
    autocmd User MessageRecallPreview map <buffer> <Leader>N <Plug>(MessageRecallPreviewNext)
 

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
MessageRecall-1.03.vmb.gz 1.03 2014-04-16 7.0 Ingo Karkat - Adapt to changed EditSimilar.vim interface that returns the success status now. Abort on error for own plugin commands. *** You need to update to EditSimilar.vim (vimscript #2544) version 2.40! ***
MessageRecall-1.02.vmb.gz 1.02 2013-11-21 7.0 Ingo Karkat - CHG: Only replace on <C-p> / <C-n> in the message buffer when the considered range is just empty lines. I came to dislike the previous replacement also when the message had been persisted.
- CHG: On <C-p> / <C-n> in the original message buffer: When the buffer is modified and a stored message is already being previewed, change the semantics of count to be interpreted relative to the currently previewed stored message. Beforehand, one had to use increasing <C-p>, 2<C-p>, 3<C-p>, etc. to iterate through stored messages (or go to the preview window and invoke the mapping there).
- ENH: Allow to override the default <C-p> / <C-n> mappings.
- Add dependency to ingo-library (vimscript #4433). *** You need to separately install ingo-library (vimscript #4433) version 1.012 (or higher)! ***
MessageRecall.vba.gz 1.01 2012-07-12 7.0 Ingo Karkat BUG: Script error E486 when replacing a non-matching commit message buffer.
MessageRecall.vba.gz 1.00 2012-06-25 7.0 Ingo Karkat Initial upload
ip used for rating: 54.161.203.23

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