Convert Figma logo to code with AI

mhinz logovim-signify

:heavy_plus_sign: Show a diff using Vim its sign column.

2,707
107
2,707
17

Top Related Projects

A Vim plugin which shows git diff markers in the sign column and stages/previews/undoes hunks and partial hunks.

fugitive.vim: A Git wrapper so awesome, it should be illegal

Git integration for buffers

Git Blame plugin for Neovim written in Lua

Quick Overview

vim-signify is a Vim plugin that shows version control system (VCS) changes in the sign column. It supports various VCSs including Git, Mercurial, and SVN, providing real-time indicators for added, modified, and removed lines in your code.

Pros

  • Fast and lightweight, with minimal impact on Vim's performance
  • Supports multiple version control systems
  • Customizable signs and colors for different types of changes
  • Integrates well with other Vim plugins and workflows

Cons

  • Requires Vim 7.3 or higher with signs feature compiled in
  • May have occasional conflicts with other sign column plugins
  • Limited functionality compared to full-fledged Git integration plugins

Code Examples

  1. Basic configuration in your .vimrc:
" Enable signify
let g:signify_enable = 1

" Set custom signs for different change types
let g:signify_sign_add               = '+'
let g:signify_sign_delete            = '_'
let g:signify_sign_delete_first_line = '‾'
let g:signify_sign_change            = '~'
  1. Customizing colors:
" Set custom colors for signify signs
highlight SignifySignAdd    ctermfg=green  guifg=#00ff00 cterm=NONE gui=NONE
highlight SignifySignDelete ctermfg=red    guifg=#ff0000 cterm=NONE gui=NONE
highlight SignifySignChange ctermfg=yellow guifg=#ffff00 cterm=NONE gui=NONE
  1. Mapping keys for navigation:
" Jump between hunks
nmap <leader>gj <plug>(signify-next-hunk)
nmap <leader>gk <plug>(signify-prev-hunk)

" Hunk-add and hunk-revert for chunk staging
nmap <leader>ga <plug>(signify-hunk-add)
nmap <leader>gr <plug>(signify-hunk-revert)

Getting Started

  1. Install vim-signify using your preferred Vim plugin manager. For example, with vim-plug:
Plug 'mhinz/vim-signify'
  1. Add basic configuration to your .vimrc:
let g:signify_enable = 1
let g:signify_sign_add               = '+'
let g:signify_sign_delete            = '_'
let g:signify_sign_delete_first_line = '‾'
let g:signify_sign_change            = '~'
  1. Restart Vim or source your .vimrc file.

  2. Open a file in a version-controlled directory, and you should see signs in the sign column indicating changes.

Competitor Comparisons

A Vim plugin which shows git diff markers in the sign column and stages/previews/undoes hunks and partial hunks.

Pros of vim-gitgutter

  • Focused specifically on Git, providing a more streamlined experience for Git users
  • Offers additional features like staging/unstaging hunks and undoing hunks directly from the sign column
  • Generally faster performance for Git-specific operations

Cons of vim-gitgutter

  • Limited to Git version control system only
  • May have a slightly higher learning curve for users new to Git-specific features

Code comparison

vim-gitgutter:

let g:gitgutter_sign_added = '+'
let g:gitgutter_sign_modified = '~'
let g:gitgutter_sign_removed = '-'
let g:gitgutter_sign_removed_first_line = '^'
let g:gitgutter_sign_modified_removed = '~-'

vim-signify:

let g:signify_sign_add = '+'
let g:signify_sign_delete = '-'
let g:signify_sign_delete_first_line = '^'
let g:signify_sign_change = '~'

Summary

vim-gitgutter is a specialized plugin for Git users, offering Git-specific features and potentially better performance for Git operations. vim-signify, on the other hand, supports multiple version control systems, making it more versatile for developers working with different VCS. The choice between the two depends on whether you exclusively use Git or require support for multiple VCS. Both plugins offer similar core functionality for displaying version control information in the sign column, with slightly different configuration options as shown in the code comparison.

fugitive.vim: A Git wrapper so awesome, it should be illegal

Pros of vim-fugitive

  • Comprehensive Git integration with Vim, offering a wide range of Git commands and operations
  • Seamless integration with Vim's interface, allowing for Git operations without leaving the editor
  • Extensive documentation and community support

Cons of vim-fugitive

  • Steeper learning curve due to its extensive feature set
  • May be overkill for users who only need basic Git status information
  • Slightly higher performance overhead compared to lighter alternatives

Code comparison

vim-fugitive:

:Git add %
:Git commit
:Git push
:Gstatus
:Gdiff

vim-signify:

" No direct Git commands, focuses on displaying changes
let g:signify_sign_add = '+'
let g:signify_sign_delete = '_'
let g:signify_sign_change = '~'

vim-fugitive provides a full Git command interface within Vim, while vim-signify focuses on displaying version control changes in the sign column. vim-fugitive offers more comprehensive Git integration, but vim-signify is lighter and faster for showing basic file status information.

Git integration for buffers

Pros of gitsigns.nvim

  • Designed specifically for Neovim, leveraging its features for better performance
  • Offers more granular control over sign placement and appearance
  • Provides built-in support for staging hunks and navigation between changes

Cons of gitsigns.nvim

  • Limited to Neovim, not compatible with Vim
  • May have a steeper learning curve due to more configuration options

Code Comparison

vim-signify:

let g:signify_sign_add               = '+'
let g:signify_sign_delete            = '_'
let g:signify_sign_delete_first_line = '‾'
let g:signify_sign_change            = '~'

gitsigns.nvim:

require('gitsigns').setup {
  signs = {
    add          = {hl = 'GitSignsAdd'   , text = '+'},
    change       = {hl = 'GitSignsChange', text = '~'},
    delete       = {hl = 'GitSignsDelete', text = '_'},
    topdelete    = {hl = 'GitSignsDelete', text = '‾'},
    changedelete = {hl = 'GitSignsChange', text = '~'},
  },
}

Both plugins offer similar functionality for displaying git status in the sign column, but gitsigns.nvim provides more advanced features and customization options specifically for Neovim users. vim-signify, on the other hand, offers broader compatibility across Vim and Neovim.

Git Blame plugin for Neovim written in Lua

Pros of git-blame.nvim

  • Focused specifically on Git blame functionality, providing a more streamlined experience for this use case
  • Integrates well with Neovim's built-in LSP features
  • Offers virtual text support for inline blame information

Cons of git-blame.nvim

  • Limited to Git blame functionality, lacking broader version control integration
  • Requires Neovim, not compatible with standard Vim
  • Less mature project with potentially fewer features and less community support

Code Comparison

vim-signify:

let g:signify_sign_add               = '+'
let g:signify_sign_delete            = '_'
let g:signify_sign_delete_first_line = '‾'
let g:signify_sign_change            = '~'

git-blame.nvim:

require('gitblame').setup {
    enabled = true,
    message_template = '<author> • <date> • <summary>',
    date_format = '%r',
    message_when_not_committed = 'Not committed yet'
}

While vim-signify offers broader version control integration with support for multiple VCS systems and provides visual indicators for changes in the gutter, git-blame.nvim focuses specifically on Git blame functionality with inline virtual text support. vim-signify is more versatile and works with both Vim and Neovim, while git-blame.nvim is Neovim-specific but offers a more tailored experience for Git blame information.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

vim-signify


Signify (or just Sy) uses the sign column to indicate added, modified and removed lines in a file that is managed by a version control system (VCS).


  • Supports git, mercurial, darcs, bazaar, subversion, cvs, rcs, fossil, accurev, perforce, tfs, yadm.
  • Asynchronous execution of VCS tools for Vim 8.0.902+ and Neovim.
  • Preserves signs from other plugins.
  • Handles nested repositories controlled by different VCS.
  • Provides mappings for navigating hunks ("blocks of changed lines").
  • Provides an operator that acts on hunks.
  • Preview changes in the current line in a popup window.
  • Show all changes in diff mode.
  • Alternative workflow: Disable the plugin by default and toggle it per buffer on demand.
  • Optional line highlighting.
  • Optional skipping of filetypes/filenames.
  • Optional stats in the statusline.
  • Works out of the box, but allows fine-grained configuration.
  • Great documentation and handsome maintainers!

Similar plugin for git: vim-gitgutter

Installation

The master branch is async-only and thus requires at least Vim 8.0.902. Use the legacy tag for older Vim versions.

Using your favorite plugin manager, e.g. vim-plug:

if has('nvim') || has('patch-8.0.902')
  Plug 'mhinz/vim-signify'
else
  Plug 'mhinz/vim-signify', { 'tag': 'legacy' }
endif

Configuration for async update

" default updatetime 4000ms is not good for async update
set updatetime=100

Demo

Example:signify in action

Author and Feedback

If you like this plugin, star it! It's a great way of getting feedback. The same goes for reporting issues or feature requests.

Contact: Twitter

Co-maintainer: @jamessan