• Stars
    star
    246
  • Rank 164,726 (Top 4 %)
  • Language
    Vim Script
  • Created over 14 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Plugin to show a diff, whenever recovering a buffer

Recover.vim adds a diff option when Vim finds a swap file Say Thanks!

When you open a file in Vim but it was already open in another instance or not closed properly in a past edit, Vim will warn you, but it won't show you what the difference is between the hidden swap file and the regular saved file. Of all the actions you might want to do, the most obvious one is missing: compare, that is, see a diff.

Installation

We recommend installing with a plugin manager (there are several).

Alternatively, download the plugin (either the stable or unstable version), edit it with Vim (vim Recover.vmb), then source it (:so %), and finally restart Vim. You can check successful installation by opening the help file (:h RecoverPlugin).

How to use

Recover.vim adds a new first entry to the list of actions, like this:

Found a swap file by the name "test/normal/.testfile.swp"
        owned by: chrisbra   dated: Wed Nov 28 16:26:42 2012
        file name: ~chrisbra/code/git/vim/Recover/test/normal/testfile
        modified: YES
        user name: chrisbra   host name: R500
        process ID: 4878 [not existing]
While opening file "test/normal/testfile"
            dated: Tue Nov  6 20:11:55 2012
Please choose:
[C]ompare, (O)pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort, (D)elete:

Also, in the case that an active process has the swap file open, Recover.vim adds the relevant process ID to the dialog to make that easier to find.

If you choose the new [C]ompare option, you'll see a vertical split buffer. On the left side, you'll see the file as it is stored on disk. On the right side, you'll see the diff from the recovered swap file.

You can then use the usual Vim merge commands if you want to copy the contents from the swap buffer. When you are finished, you can close the diff version and close the window, by issuing :diffoff! and :close in the window that contains the on-disk version of the file. Be sure to save the recovered version of your file.

To delete the no-longer-needed swap file when in the recovered window, use the command :FinishRecovery. That will delete the swapfile, close the diff window, and end the diff/merge process. Alternatively, you can use the command :RecoverPluginFinish.

The command :RecoverPluginHelp show a small message on what keys can be used to move to the next different region and how to merge the changes from one window into the other.

If your Vim was built with +balloon_eval, Recover.vim will also set up an balloon expression that shows you which buffer contains the recovered version of your file and which buffer contains the unmodified on-disk version of your file, if you move the mouse of the buffer.

If you have setup your statusline, Recover.vim will also inject some info about which buffer contains the on-disk version and which buffer contains the modified, recovered version. Additionally, the read-only buffer will have a filename of something like original file (on disk-version). If you want to save that version, use :saveas.

Get more help via :h RecoverPlugin-manual

How to enable or disable Recover.vim

Once installed, Recover.vim is enabled by default.. To disable it, use :RecoverPluginDisable. To enable it again, use :RecoverPluginEnable.

When enabled, you can also do a one-time skip of the Recover.vim dialog with Ctrl-C. Then, the default Vim dialog (without the [C]ompare option) will be shown.

License & Copyright

The Vim License applies. See :h license © 2009 - 2017 by Christian Brabandt

NO WARRANTY, EXPRESS OR IMPLIED. USE AT-YOUR-OWN-RISK

More Repositories

1

csv.vim

A Filetype plugin for csv files
Vim Script
1,266
star
2

NrrwRgn

A Narrow Region Plugin for vim (like Emacs Narrow Region)
Vim Script
673
star
3

Colorizer

color hex codes and color names
Vim Script
544
star
4

unicode.vim

A Vim plugin that provides a completion function for Unicode glyphs
Vim Script
451
star
5

vim-diff-enhanced

Better Diff options for Vim
Vim Script
357
star
6

vim_faq

The Vim FAQ from http://vimdoc.sourceforge.net/ (outdated), updates available at:
HTML
144
star
7

changesPlugin

A Vim Plugin for indicating changes as colored bars using signs.
Vim Script
106
star
8

SudoEdit.vim

Edit Files using sudo or su or any other tool
Vim Script
64
star
9

matchit

The matchit plugin from Vim
Vim Script
61
star
10

vim-zsh

Official Vim Runtime Files for Zsh
Vim Script
41
star
11

improvedft

An improved ft command for Vim
Vim Script
39
star
12

vim-autosave

autosave your work
Vim Script
38
star
13

histwin.vim

A Vim Plugin for browsing the undo tree
Visual Basic
38
star
14

vim-autoread

Use tail -f on a buffer and append new content
Vim Script
36
star
15

wikipedia2text

A commandline tool for querying the Wikipedia
Shell
32
star
16

Replay

A plugin for vim that enables you to replay your editing Session
Vim Script
32
star
17

DynamicSigns

Using Signs for displaying various things
Vim Script
31
star
18

CheckAttach

Check for attachments when writing mails with mutt
Vim Script
28
star
19

vpager

Pipe input from Vims terminal directly back into Vim
Shell
25
star
20

vim-mq-patches

private MQ Patches for Vim
C
23
star
21

vim_dotfiles

my personal vim config
Vim Script
18
star
22

DistractFree

DistractFree
Vim Script
17
star
23

vim-sh-indent

Vim Shell Indent Repository
Shell
15
star
24

vim-show-char

Vim Plugin for displaying whitespace
Vim Script
14
star
25

vim-xml-runtime

Vim filetype plugin for XML files
Vim Script
11
star
26

BufTimer

Time your editing duration
Vim Script
10
star
27

youtube2audio

A downloader that converts youtube videos into music using mplayer and clive/youtube-dl
Shell
6
star
28

mutt

official Mutt Mirror from gitlab https://gitlab.com/muttmua/mutt/
C
6
star
29

vim-commentary

Comment some stuff
Vim Script
4
star
30

vim-appimage

Appimage builds for GVim
Shell
4
star
31

vim-history

C
4
star
32

BackgroundColor.vim

A Simple Plugin for Defining A Background Color for your Vim using Signs
Vim Script
4
star
33

SaveSigns.vim

A Vim Plugin to Save and Restore your Signs
Vim Script
4
star
34

vim-sqloracle-syntax

Oracle SQL Syntax files for Vim
Vim Script
3
star
35

Join

Improved algorithm for joining large files
Vim Script
3
star
36

chrisbra

3
star
37

vim-rc-syntax

Vim RC Syntax files
Vim Script
2
star
38

zugferd

a sample repository on how to create ZUGFeRD pdf files
XSLT
2
star
39

vim-kconfig

kconfig runtime files for Vim
Vim Script
2
star
40

chrisbra.github.com

Personal Webpage
2
star
41

vim-misc

miscellaneous Vim functions
Vim Script
2
star
42

ftpbackup

A simple backup for your ftp-share
Perl
2
star
43

Calendar_CSV_DACH

Create a Calendar in CSV format for Germany, Austria, Switzerland
Perl
2
star
44

xmlformat

A Vim plugin for formatting XML files
Vim Script
2
star
45

vim-PowerCenter-syntax

syntax file for Informatica PowerCenter Logfiles
Vim Script
1
star
46

vim-ci

1
star
47

vim-tex-indent

official Vim indent file for tex
Vim Script
1
star
48

git-omni-deployment

A tool for a slightly better deployment experience when using IBIs Omni-Gen
Shell
1
star
49

vimcrypt

Encode/Decode Vims Sodium encryption
C
1
star
50

Terraform_Test

HCL
1
star
51

vim-screencasts

Some Screencasts
1
star
52

CleverPut

pasting easily (and adjust Whitespace)
Vim Script
1
star
53

ci_configuration

testing some boring ci config stuff. Nothing to see here.
1
star
54

ism_ci

Make iSM/iIT demo for CI
Shell
1
star
55

putty

PuTTY SSH and Telnet client with TrueColor patch
C
1
star
56

vim-search_escape

Convert regexp patterns
Vim Script
1
star