sponsor Vim development Vim logo Vim Book Ad

vim-signify : Advanced plugin for showing VCS diffs in the SignColumn

 script karma  Rating 67/21, Downloaded by 5635  Comments, bugs, improvements  Vim wiki

created by
Marco Hinz
 
script type
utility
 
description
NOTE: Get the latest updates via github: https://github.com/mhinz/vim-signify

If you like this plugin, star it on github!


# vim-signify

Or just: __sy__

Sy shows all added, deleted and modified lines since the last commit via Vim its
sign column. It __supports several version control systems__.

It's __fast__, __highly configurable__ and __well documented__.

Features:

- supports git, mercurial, darcs, bazaar, subversion, cvs, rcs
- quick jumping between changed lines
- apart from signs there is also optional line highlighting
- fully configurable through global variables (options and mappings)
- optional preserving of signs from other plugins
- you can toggle the plugin per buffer
- exception lists for filetypes and filenames
- good documentation

- quick developer response! :-)

Limits exist only in your mind!

## What about vim-gitgutter?

To be honest, I don't understand why people always compare plugins like Sy to
vim-gitgutter. I understand that it is by far the most known one, but primarily
because it was featured on the Hacker News frontpage.

Don't get me wrong, I don't intend to badmouth gitgutter, I even contributed to
it once. (Granted, it was only a small fix.) And I'm glad about everyone
contributing to the Vim community, but there are two important facts one should
consider:

1. There were other plugins providing the same functionality as gitgutter years
   before its creation.

1. Sy provides a superset of gitgutter.

So here is the short answer: The main difference is Sy its support for version
control systems other than git. Moreover, two of its design goals are speed and
high configurability.

## Sign explanation

`+`

A new line was added. The sign is shown on the same line as the new line.

`_`

A line was deleted. The sign is shown on the line above the deleted line. Special case: The first line was deleted. In this case the sign is shown on the same line.

`!`

A line was changed. Something was changed, but the amount of lines stayed the same. The sign is shown on the same line.

`!_`

A line was changed and one or more of the lines below were deleted. A combination of **!** and **_**. The sign is shown on the same line.

## Longer introduction

#### supports several version control systems

This plugin is based on the diffing features of the supported version control
systems. Since not all VCS support the same options, sometimes we have to fall
back to the 'diff' executable.

Current the following VCS are supported:

- git
- mercurial (hg)
- bazaar (bzr)
- darcs
- subversion (svn)
- cvs
- rcs

#### quick jumping between changed lines

There are mappings for jumping forth and back between changed lines (so-called
hunks). The following example shows the default mappings and how to change them:

```vim
let g:signify_mapping_next_hunk = '<leader>gj'
let g:signify_mapping_prev_hunk = '<leader>gk'
```

Note: In case you don't know about the mapleader, have a look at `:h mapleader`.
The default is the '' button.

#### apart from signs there is also optional line highlighting

Sy shows you signs for changed lines. Moveover, you can enable highlighting of
the concerned lines:

```vim
let g:signify_mapping_toggle_highlight = '<leader>gh'
```

You can also change the highlighting classes for these lines. The defaults are:

```vim
let g:signify_line_color_add    = 'DiffAdd'
let g:signify_line_color_delete = 'DiffDelete'
let g:signify_line_color_change = 'DiffChange'
```

#### you can toggle the plugin per buffer

In case you want to disable the plugin for the current buffer, you can toggle
it:

```vim
let g:signify_mapping_toggle = '<leader>gt'
```

#### exception lists for filetypes and filenames

If you want to disable Sy for certain kinds of filename or file types,
you explicitely have to create exception lists:

Example:

```vim
let g:signify_exceptions_filetype = [ 'vim', 'c' ]
let g:signify_exceptions_filename = [ '.vimrc' ]
```

#### good documentation

You should know by now!

## Documentation

`:h signify`

## Configuration

For more info: `:h signify-options`

__NOTE__: The shown assignments are only examples, not defaults.

```vim
let g:signify_vcs_list = [ 'git', 'hg' ]

let g:signify_mapping_next_hunk = '<leader>gn'
let g:signify_mapping_prev_hunk = '<leader>gp'

let g:signify_mapping_toggle_highlight = '<leader>gh'
let g:signify_mapping_toggle           = '<leader>gt'

let g:signify_exceptions_filetype = [ 'vim', 'c' ]
let g:signify_exceptions_filename = [ '.vimrc' ]

let g:signify_sign_overwrite = 1

let g:signify_sign_add               = '+'
let g:signify_sign_delete            = '-'
let g:signify_sign_change            = '*'
let g:signify_sign_delete_first_line = '‾'

let g:signify_sign_color_guifg_add      = '#00ff00'
let g:signify_sign_color_guifg_delete   = '#ff0000'
let g:signify_sign_color_guifg_change   = '#ffff00'
let g:signify_sign_color_guibg          = '#111111'

let g:signify_sign_color_ctermfg_add    = 2
let g:signify_sign_color_ctermfg_delete = 1
let g:signify_sign_color_ctermfg_change = 3
let g:signify_sign_color_ctermbg        = 0

let g:signify_sign_color_group_add    = 'MyAdd'
let g:signify_sign_color_group_delete = 'MyDelete'
let g:signify_sign_color_group_change = 'MyChange'

let g:signify_line_color_add    = 'DiffAdd'
let g:signify_line_color_delete = 'DiffDelete'
let g:signify_line_color_change = 'DiffChange'

let g:signify_enable_cvs = 1

let g:signify_cursorhold_normal = 1
let g:signify_cursorhold_insert = 1
```

## Author

Marco Hinz `<mh.codebro@gmail.com>`

## License

Copyright © 2013 Marco Hinz. Revised BSD license.
 
install details
I suggest using tpope's pathogen:

- https://github.com/tpope/vim-pathogen

Afterwards, just clone vim-signify into ~/.vim/bundle/.
 

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
vim-signify-1.9.tar.gz 1.9 2013-07-04 7.0 Marco Hinz - new option: g:signify_disable_by_default
- improved hunk jumping code
- color are set by groups only now (:h signify-colors)
- add showcolors.bash
- indicate number of deleted lines
- various fixes
- improved docs
- update gif
vim-signify-1.8.tar.gz 1.8 2013-06-07 7.0 Marco Hinz - new option: g:signify_difftool
- autocmd event juggling for improved sign redrawing
- improved sanity checks
- g:signify_update_on_bufenter = 0 per default now
- CONTRIBUTING.md added
- small fixes
vim-signify-1.7.tar.gz 1.7 2013-04-16 7.0 Marco Hinz support for Fossil SCM, much improved cursorhold, remove ]c and [c mappings for non-VCS files, improved doc, lots of fixes and refactoring
vim-signify-1.6.tar.gz 1.6 2013-04-07 7.0 Marco Hinz fix sign overwriting, fix sign text options, handle return values of bzr properly
vim-signify-1.5.tar.gz 1.5 2013-04-04 7.0 Marco Hinz New options for handling the default behaviour of line highlighting and updating signs on entering a buffer; a lot of refactoring
vim-signify-1.4.tar.gz 1.4 2013-04-02 7.0 Marco Hinz handle files with conflict markers, many cosmetic changes
vim-signify-1.3.tar.gz 1.3 2013-04-01 7.0 Marco Hinz fix important signmode bug
vim-signify-1.2.tar.gz 1.2 2013-03-27 7.0 Marco Hinz Windows support, various bugfixes
vim-signify-1.1.tar.gz 1.1 2013-03-26 7.0 Marco Hinz changed handling of exception lists, corrected CVS support, new mappings [c and ]c, etc.
vim-signify-1.0.tar.gz 1.0 2013-03-25 7.0 Marco Hinz Initial upload
ip used for rating: 34.230.84.106

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