sponsor Vim development Vim logo Vim Book Ad

changesPlugin : indicate changes of a buffer

 script karma  Rating 65/42, Downloaded by 4546  Comments, bugs, improvements  Vim wiki

created by
Christian Brabandt
 
script type
utility
 
description
PLEASE RATE THIS PLUGIN, IF YOU LIKE IT!

For a screenshot of the plugin see http://www.256bit.org/~chrisbra/changes.png

Follow this plugin at github:
http://github.com/chrisbra/changesPlugin

1. Functionality

This plugin was written to help visualize which lines have been changes since
editing started for a file. The plugin was inspired by so called changed-bars,
available at other editors, such as Embarcadero C++ Builder (there it is
called Change Bars, see:
http://edn.embarcadero.com/article/33453#6PersonalDeveloperProductivity)
or Visual Studio where it is called indicator margin (see
http://blog.eveningcreek.com/?p=151).

ChangesPlugin.vim uses the |diff|-feature of vim and compares the actual
buffer with it's saved state. In order to highlight the indicator signs at the
first column, its using |signs|. For newly added lines, the first column will
be displayed with a leading '+' and highlighted using the DiffAdd highlighting
(see |hl-DiffAdd|), deleted lines will be indicated by a '-' with a
DiffDelete highlighting (see |hl-DiffDelete|) and modified lines will be
displayed using '*' and a DiffChange highlighting (see |hl-DiffChange|).

This means, that in order to use this plugin you need a vim, that was built
with |+signs|-support and |+diff|-support and you also need an executable diff
command. If neither of these conditions are met, changePlugin.vim will issue a
warning and abort.

*:EnableChanges*
By default the plugin is not enabled. To enable it enter >
    :EnableChanges
When you run this command, changesPlugin.vim diffs the current file agains
its saved file on disk and displays the changes in the first column.

*:DisableChanges*
If you want to disable the plugin, enter >
    :DisableChanges

==============================================================================
*changesPlugin-Config*
2. Configuring changesPlugin.vim

There are basically four different configuration options available.

2.1 Highlighte the whole line
By default, changesPlugin.vim will only indicate a change in the first column.
Setting g:changes_hl_lines to 1 will highlight the whole line. By default this
variable is unset (which is the same as setting it to 0).
If you'd like to have this, set this variable in your |.vimrc| >
    :let g:changes_hl_lines=1

2.2 Auto-refresh the changes
By default changesPlugin.vim will not automatically update the view. You can
however configure it to do so. This will use an |CursorHold| autocommand to
update the indicator signs after |'updatetime'| seconds in Normal mode when
no key is pressed. To enable this feature, put this in your |.vimrc| >
    let g:changes_autocmd=1

2.3 Show what the indicator signs mean.
By default, whenever you run |:EnableChanges|, changesVim will print a short
status message, what each sign means. If you don't want this, put this in your
|.vimrc| >
    :let g:changes_verbose=0

2.4 Specify different colors.
changesVim uses the highlighting used for |diff| mode to indicate the change
in a buffer. This is consistent, since when you're already used to |vimdiff|
you'll probably also know the highlighting. If for any reason you do not like
the colors, you have to define your own highlighting items.
If for example you want the DiffAdd highlighting to be displayed like White on
a Blue background, you can define it as follows in your |.vimrc| >

    :hi DiffAdd term=bold ctermbg=4 guibg=DarkBlue

In the same way, you can change DiffDelete for indicating deleted lines and
DiffChange for indicating modified lines. You can also specify your favorite
highlighting colors using your own build |colorscheme|.

==============================================================================
3. changesPlugin History *changesPlugin-history*
    0.2: Apr 11, 2010: Added Documentation
created an autoload version
    0.1: Apr 10, 2010: First working version
 
install details
This plugin comes as vimball, which makes it really easy to install it into the right place.
1) Edit changes.vba with your vim (:e changes.vim)
2) From within vim, simply source the file using
:so %
3) Restart vim to autoload the plugin and the documentation
:q
4) Read the help at :h changesPlugin.txt

See also the help available for vimballs at :h vimball-intro
 

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
changes.zip 15 2015-01-15 7.4 Christian Brabandt NF: use TextChanged autocommand to update signs faster
NF: use new utf8 symbols
NF: Hide SignColumn
NF: include some nice looking icons for gvim
BF: Code cleanup
BF: resolve symlinks
NF: airline integration
NF: :CF
NF: :CT
BF: only draw at most one deleted sign, if a range of several consecutive lines have been deleted
NF: only place newly changed lines (instead of always removing all previous signs and adding them again)
NF: if g:changes_linehi_diff is set, tries to highlight changes within a line by overlaying CursorColumn highlighting over that parts.
BF: try to skip expensive TextChanged calls if possible.
BF: detect other signs correctly (didn't work with non-english locale)
BF: do not try to detect changes on vim help files and read only files
BF: calling :DC twice would cause an error
BF: Make use of patch 7.4.341
BF: When undefining signs and starting the gui, make sure no '[Deleted]' signs are left over
BF: Clear SignColumn before linking it to Normal group
BF: Make sure a warning message is shown for :EC
BF: Catch E255 when defining signs
BF: prevent recursively calling FocusGained autocommand on windows
NF: ChangesPlugin-Signcol
BF: if vim-gitgutter is installed and the current buffer is handled by vim-gitgutter, let gitgutter handle the current buffer (issue https://github.com/chrisbra/changesPlugin/issues/12, reported by Gray-Wind, thanks!)
NF: g:changes_fast variable (to enable more correct at the cost of being possibly slower placement of signs).
BF: when updating signs, make sure that the first line of a consecutive number has the correcty type
NF: In insert mode, when <CR> is pressed, update the signs immediately
NF: InsertEnter/Leave autocommands to update signs
NF: Stage hunks for git
NF: Ignore special buffers (help window, quickfix buffer, command line window..)
BF: Make :CL only add the first line of each hunk to the location list.
(automatically uploaded)
changes-0.14.vmb 14 2013-08-14 7.3 Christian Brabandt BF: Exception not caught (reported by Marco, thanks!)
        BF: Prevent flickering by resetting SignColumn on
    updates (reported by Marco, thanks!)
        BF: parse diff output instead of relying on vimdiff
    and parsing the syntax items (prevents flickering
    since no window needs to be split)
        BF: avoid error messages, when buffer is ignored
    (https://github.com/chrisbra/changesPlugin/issues/6>     reported by mpfusion, thanks!)
        BF: avoid error messages, using |DC|
    (
https://github.com/chrisbra/changesPlugin/issues/7>     reported by mpfusion, thanks!)
        BF: don't mess with the |alternate-file|
    (
https://github.com/chrisbra/changesPlugin/issues/8>     reported by mpfusion, thanks!)
        NF: |ChangesPlugin-preview|
        NF: |ChangesPlugin-Maps|
            [h/]h move to previous/next changed line
(automatically uploaded)
changes-0.13.vmb 13 2013-02-16 7.3 Christian Brabandt BF: Plugin used :EnableDisplayChanges, but documentation talked about EnableChanges (same for DisableChanges)
BF: Don't load the autoload script when sourcing the plugin (reported by Sergey Kholev, thanks!)
(automatically uploaded)
changes-0.12.vmb 12 2012-01-31 7.3 Christian Brabandt NF: Fix issue #3 from github (check changes against
    any file, suggested by Alessio Bolognino, Thanks!)
BF: Fix E117 error (patch by Mate Gabri, Thanks!)
BF: Check, that the current file is readable, before
    diffing (patch by Mate Gabri, Thanks!)
BF: Sometimes, the previous Window is not accessible
    anymore
    (http://github.com/chrisbra/changesPlugin/issues/5
    by
Mate Gabri, Thanks!)
(automatically uploaded)
changes-0.11.vba 0.11 2010-05-04 7.0 Christian Brabandt BF: Document, that |InsertLeave| autocommand is used as autocommand
BF: generate the help file with 'et' set, so that the README at github looks prettier
BF: When staying in diff mode, don't reset 'fdm' and apply syntax coloring to scratch buffer
BF: the check for the diff executable does not work as expected (Reported by Sergey Khorev), additionally outputting the Warnings did not work in that case
changes.vba 0.10 2010-04-28 7.0 Christian Brabandt Fixed Issue 1 from github (http://github.com/chrisbra/changesPlugin/issues/1/find)
changes.vba 0.9 2010-04-24 7.0 Christian Brabandt 0.9: Apr 24, 2010:  
NF: You can now use different VCS Systems for each buffer you are using.
NF: Stay in diff mode
BF: Fix the display of deleted signs
BF: Undefining old signs, so that changing g:changes_hl_lines works
BF: Some more error handling.
NF: Show an overview for changed lines in location-list (|:CL|)
NF: Show what each sign means using |:CC|

0.8: Apr 22, 2010:  NF: Renamed the helpfile, to make it more obvious, that it refers to a plugin
NF: Outputting name of checked file, if checking against VCS
BF: Don't check for empty files.
BF: Reworked the Message function
BF: Don't try to place signs, if there are no differences (unreleased, VCS successfully tested with git, hg, svn, cvs, bzr)
0.7: Apr 19, 2010:  
NF: Check against a file in a VCS (unreleased, first working version, needs to be checked for each VCS)
changes.vba 0.6 2010-04-13 7.0 Christian Brabandt BF: also take care of DiffText from diff-mode (see :h hl-DiffText)
changes.vba 0.5 2010-04-12 6.0 Christian Brabandt BF: error when trying to access b:diffhl in the scratch buffer. This should be fixed now (thanks Jeet Sukumaran!)
BF: Use the correct highlighting groups (thanks Jeet Sukumaran!)
changes.vba 0.4 2010-04-12 7.0 Christian Brabandt NF: |ToggleChangesView|
NF: The autocommand checks, if the buffer has been modified, since the last time.
BF: Do not mess with signs, that have not been placed by changesPlugin.vim
BF: CleanUp was seriously messed up (sorry, I must have been asleep, when writing that)
BF: Take care of 'foldcolumn' setting, which would be overwritten by the signs-column
changes.vba 0.3 2010-04-11 7.0 Christian Brabandt BF: redraw, so that the diff window will not be displayed
NF: enabled GLVS (see |GLVS|)
changes.vba 0.2 2010-04-11 7.2 Christian Brabandt Initial upload
ip used for rating: 44.200.39.110

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.
   
Vim at Github