Giter Club home page Giter Club logo

changesplugin's Introduction

Changes plugin Say Thanks!

A Vim plugin for displaying changes in a buffer

This plugin was written to help visualize which lines have been changed since editing started for a file. The plugin was inspired by so called changed-bars, available in other editors, such as Embarcadero C++ Builder (there it is called Change Bars or Visual Studio where it is called indicator margin.

ChangesPlugin.vim uses the diff feature of vim and compares the actual buffer with its saved state (or possibly against a state in a VCS repository). It displays signs in the signcolumn to indicate any changes, with optional line highlighting.

See also the following screencast showing several of the features available: screencast of the plugin

Note, that a '-' indicates that at least one line was deleted between that particular line and the following line.

Features:

  • Shows signs for added, modified, and deleted lines
  • Quick jumping between changed blocks ("hunks")
  • Tries to update signs as fast as possible
  • Optional line highlighting
  • Customisable
  • Many different Commands (fold all non changed lines, show changed lines in Quickfix window, opens a diff split...)
  • Preserves signs from other plugins
  • Built-in integration with vim-airline
  • Good documentation
  • Quick response
  • Nice icons for gvim
  • Uses Vim 8's async feature for parsing the diff

Why another git-gutter/vim-signify clone?

To be fair, there were a lot of other vim plugins that offered the same functionality as those two. They just didn't get the same attention as those two. ChangesPlugin was one of those plugins.

Installation

Vim 8 comes with package support. Simply clone it into your packpath like this:

cd ~/.vim/pack/custom/start/
git clone https://github.com/chrisbra/changesPlugin.git

(Remember to run :helptags ALL after restarting Vim to regenerate the help files)

Other installation methods:

Plugin Manager Install with...
Pathogen git clone https://github.com/chrisbra/changesPlugin ~/.vim/bundle/changesPlugin
Remember to run :Helptags to generate help tags
NeoBundle NeoBundle 'chrisbra/changesPlugin'
Vundle Plugin 'chrisbra/changesPlugin'
Plug Plug 'chrisbra/changesPlugin'
VAM call vam#ActivateAddons([ 'changesPlugin' ])
Dein call dein#add('chrisbra/changesPlugin')
minpac call minpac#add('chrisbra/changesPlugin')
manual copy all of the directories into your ~/.vim directory (preserve existing directories)

Other package managers work similarly, please refer to their documentation.

Usage

Once installed, take a look at the help at :h ChangesPlugin

Here is a short overview of the functionality provided by the plugin:

Ex commands:

:EC  - Activate the plugin (display indicators of changes for the current buffer)
:DC  - Disable the plugin
:TCV - Toggle the plugin
:CC  - Show a small help window
:CL  - Open the Quickfix window with all changes for the current buffer
:CD  - Open a diff view for the current buffer
:CF  - Fold away all non-changed lines
:CT  - Toggle how the highlighting is displayed

Mappings

]h   - Moves forward to the next changed line
[h   - Moves backwards to the previous changed line
ah   - Selects the current hunk (TextObject)
<Leader>h - Stage the hunk that the cursor is on (works only for git)

Configuration

g:changes_autocmd (default: 1) - update the signs automatically using InsertLeave and TextChanged autocommands.

g:changes_vcs_check (default: 0)

g:changes_vcs_system (default: '') - Check against a version in a repository (e.g. git/mercurial) and specify VCS to use (if not specified, will try to autodetect).

g:changes_diff_preview (default: 0) - Display diff in the preview window

g:changes_respect_SignColumn (default 0) - If set, will use the SignColumn Highlighting group, else uses the Normal Highlighting group

g:changes_sign_text_utf8 (default 1) - If set, will display nice little utf-8 signs.

g:changes_linehi_diff (default: 0) - If set, will overlay the text with highlighting for the difference in the line.

g:changes_use_icons (default: 1) - If set, will display graphical icons if support is available.

g:changes_add_sign (default: '+') - If set, will display custom sign

g:changes_delete_sign (default: '-') - If set, will display custom sign

g:changes_modified_sign (default: '*') - If set, will display custom sign

g:changes_utf8_add_sign (default '➕') - If set, will display nice little utf-8 plus signs.

g:changes_utf8_delete_sign (default '➖') - If set, will display nice little utf-8 minus signs.

g:changes_utf8_modifed_sign (default '★') - If set, will display nice little utf-8 star signs.

Similar Work

vim-gitgutter Only works for git.

vim-signify Supports several VCS, only updates the sign on write.

License & Copyright

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

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

changesplugin's People

Contributors

andrewferrier avatar aq2 avatar bad-ptr avatar bryanchow avatar chrisbra avatar msp301 avatar scout3r avatar technicaldc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

changesplugin's Issues

g:changes_linehi_diff - wont initalize correctly

If I understand correctly enabling changes_linehi_diff will switch to second changes higlight style - where it higlight whole line, but it seems to not work for me.
I can use 'CT' - to jump to next change style mode, but it would be cool if user could setup line highlight as default style mode.

Also option to disable left column signs would be cool (right now they override gitsigns plugin plug markers) . Cool pluging @chrisbra

diffhl not defined with vim-latex plugin

Dear chrisbra,

I'm not sure this issue is related to your script, but i've come across a strange issue. Using vim-latex (http://vim-latex.sourceforge.net/) plugin your plugin throws this error during activation only when i'm editing a tex file (other files are ok):

Error detected while processing function changes#GetDiff:
line 45:
E121: Undefined variable: b:diffhl

I've tried to debug it and found out the following. Without the vim-latex plugin, during the MakeDiffs function, the diffhl variable works as expected. But with the vim-latex plugin after the diffing, just before executing line 367 the diffhl variable is missing from the buffer. I'm a noob in vimscripts so i won't try to guess the cause, but i'm sure that the vim-latex plugin does something to the buffer during the MakeDiffs function.

Thank You for your time!

Best regards,
Mate

`:EnableChanges` throws E155

Executing :DisableChanges followed by :EnableChanges results in

Error detected while processing function changes#GetDiff..<SNR>18_PlaceSigns:
line   10:
E155: Unknown sign: add

Working with vim-gitgutter together

I use vim-gitgutter for marking changes on git projects and it is pretty useful for me. But I want to use this plugin on files that are out of version control. Is there a way to disable ChangesPlugin with git projects?

BufWritePost

Why not update the view on this event as well?

seems not working in neovim

I installed the plugin in neovim (0.9) in mac.

With :EC I got a message like this:

Changes.vim: overwrite /var/folders/ct/gbl89k5s7s74t2p7s_x_ywp80000gn/T/nvim.chunxuan/14AHWL/1.old.txt? (y/n [n]) not over
written

More info with :CC

Error detected while processing function changes#Output:
line    6:
E731: using Dictionary as a String
line    7:
E731: using Dictionary as a String
line    8:
E731: using Dictionary as a String

The inidicator are not shown. Any ideas for potential issues?

Errors when showing diffs

I get the following errors every time I do :TCV or :EC:

Error detected while processing function changes#TCV..changes#GetDiff..24_MakeDiff:
line 44:
E121: Undefined variable: vcs
E15: Invalid expression: vcs=='cvs'
Error detected while processing function changes#TCV:
line 9:
E171: Missing :endif

Plugin breaks function “Edit the alternate file”

Steps to reproduce

  1. open up two files under git control foo.h and foo.c
  2. make a change in foo.h and save
  3. switch to the next buffer foo.c with :bn
  4. switch to the alternate file with ctrl-^

Result

The current buffer is a temporary file /tmp/somethingrandom/1.

Expected result

The current buffer is the alternate file foo.h.

changesPlugin forces signcolumn to be shown, even in terminal mode

With NVIM v0.5.0-d46c400 (although I think/assume this applies to regular Vim, and other versions), I find that changesPlugin always forces the signcolumn to be shown (i.e. extra characters to the left of the buffer), even for terminal buffers. For terminal buffers, I would argue that changesPlugin is basically irrelevant; they are constantly changing, and have no saved state, so changesPlugin should probably be ignoring them.

I've put a workaround into my own fork of changesPlugin: https://github.com/andrewferrier/changesPlugin/commit/2f0d82d911adaac4aff9d1f6e2546195961323d6. It's probably not the most elegant, but it would be great if you could incorporate something like this into changesPlugin itself.

Thanks for all your work on this great plugin, I find it really helpful!

vim-airline conflicts with changesPlugin

From vim-airline/vim-airline#2107

environment

let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1

if you are using Neovim:

  • does it happen in Vim: NO. Everything works in Neovim (I'm using VimR)

actual behavior

If I start vim with changesPlugin plugin enabled, then the cursor gets stuck in the top leftmost corner, blinking as a mad, and it's not possible to move it or to do anything.

So I either have to disable the changesPlugin or to pin airline to vim-airline/vim-airline@185bcc5

Here is the configuration for the changesPlugin

let g:changes_use_icons=0
let g:changes_linehi_diff=1

Error installing changesPlugin

I tried to install changesPlugin and I'm using pathogen but I've encountered the following error.
Do you have any idea how to resolve it?

% vim ~/.vimrc
Error detected while processing /Users/kjee/.vim/bundle/changesPlugin/plugin/changesPlugin.vim:
line   80:
E227: mapping already exists for <nowait>

Thanks a lot for your help!

Can't get changesPlugin working on Gvim.

Sorry for my poor English. First, I would like to thank you for creating such an awesome plugin.

Unfortunately, I have an issue with the plugin.

Problem:
There are no signs appearing.

I installed changesPlugin on my system with pathogen.

I can see see it is available on my system. When I type :Enable and press [tab], I see :EnableChanges appearing. When I pressed enter, nothing showings up. I changed somewhere in my code, delete some lines but I don't save it yet, and run the command again. But nothing is showing up.

Then I deleted all the plugins, except changesPlugin. But there are still no signs appearing. But no error too.

Environment Information

  • OS: Windows 7 x64
  • Vim version: 7.4 (Gvim) with +sign enables

I use Harroogan's Vim

Maybe you have some advice how this issue could be caused?

Thanks in advance.

Feature request: check against any file

I really like this plugin, but sometimes I wish I could use it as a standard diff-mode, would it be possible to extend this plugin to match difference against another file and not just against its saved state?
Maybe it could be another plugin altogether, but I guess it could share most of the code.

Error 484

Hi, I'm working on windows and when a try to Enable Changes on a file it says it cant open
"C:\Users\myUserName\AppData\Local\Temp\VIA4396.tmp"

Thanks

ChangesSignTextDummyCh question

Hi, thanks for your useful plugin!

I've successfully configured my own colours, but what are the ChangesSignTextDummyCh and ChangesSignTextDummyAdd highlight groups for?

no change signs displayed if path contains spaces

If the path contains spaces, no change signs are displayed. Furthermore, the command :DisableChanges throws a bunch of errors:

Error detected while processing function changes#CleanUp..<SNR>18_UnPlaceSigns:
line    5:
E121: Undefined variable: s:sign_prefix
line    8:
E121: Undefined variable: s:sign_prefix
E15: Invalid expression: id == s:sign_prefix.'0' && !a:force
line   12:
E159: Missing sign number
Error detected while processing function changes#CleanUp:
line    3:
E121: Undefined variable: s:signs
E116: Invalid arguments for function keys(s:signs)
E15: Invalid expression: keys(s:signs)

override key mapping

I have leader-hl mapped to :nohl, so your leader-h mapping interferes with this.

I've worked out a horribly hacky way of overriding this:

nnoremap <Leader>hl :nohl<CR>
nunmap <Leader>hl
autocmd VimEnter * nnoremap <leader>hl :nohl<CR>

This works fine when I first start vim, but breaks if I need to reload any vimrc files

I've read elsewhere that I could use an /after/plugin folder to make my mapping work after your plugin loads.

Or is there some hidden option that I could change to disable your mapping?

Or any other method?

Thanks again.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.