Skip to content
项目

关于

Neovim sign gutter, designed to be mostly VCS agnostic

开发工具

这些数字如何统计

可以做什么

  • Shows diffs compared to your current buffer, instant feedback.
  • Easy switching of the target commit for the diff.
  • Folding of non-diff areas.
  • Navigating between hunks.

实测星标增长

24小时
0
7天
0
15天
0
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

VCSigns.nvim

[!WARNING] While I use this heavily for personal and work use, but notably that only involves linux systems, so behavior on other systems could have issues. Fixes for such issues are welcome!

VCS agnostic vcs signs for your sign gutter, heavily inspired by vim-signify.

This plugin only relies on being able to ask for file contents at a specific commit to be able to construct a diff, this means that adding new vcs definitions should be straightforward.

Currently definitions for jujutsu, git and mercurial are included. The jujutsu one is the most well tested, but since very little logic of the vcs is depended on the core machinery should be robust across all of them.

Features

  • Showing diff signs in your sign gutter.
    • Shows diffs compared to your current buffer, instant feedback.
  • Easy switching of the target commit for the diff.
  • Folding of non-diff areas.
  • Navigating between hunks.
  • Undoing the hunk under the cursor.
  • Showing inline diffs (plus lines and minus lines) for hunks, with fine grained diffs within hunks.
  • Side-by-side diff view in a new tabpage with quickfix navigation.

Not yet implemented

  • Custom fold text.

Example config

For a documented default config, have a look inside init.lua.

Lazy

{
  'algmyr/vcsigns.nvim',
  dependencies = {
    "algmyr/vclib.nvim",
    "lewis6991/async.nvim",
  },
  config = function()
    require('vcsigns').setup {
      target_commit = 1,  -- Nice default for jj with new+squash flow.
    }

    local function map(mode, lhs, rhs, desc, opts)
      local options = { noremap = true, silent = true, desc = desc }
      if opts then options = vim.tbl_extend('force', options, opts) end
      vim.keymap.set(mode, lhs, rhs, options)
    end

    map('n', '[r', function() require('vcsigns.actions').target_older_commit { steps = vim.v.count1 } end, 'Move diff target back')
    map('n', ']r', function() require('vcsigns.actions').target_newer_commit { steps = vim.v.count1 } end, 'Move diff target forward')
    map('n', '[c', function() require('vcsigns.actions').hunk_prev { count = vim.v.count1 } end, 'Go to previous hunk')
    map('n', ']c', function() require('vcsigns.actions').hunk_next { count = vim.v.count1 } end, 'Go to next hunk')
    map('n', '[C', function() require('vcsigns.actions').hunk_prev { count = 9999 } end, 'Go to first hunk')
    map('n', ']C', function() require('vcsigns.actions').hunk_next { count = 9999 } end, 'Go to last hunk')
    map('n', '<leader>su', function() require('vcsigns.actions').hunk_undo() end, 'Undo hunks under cursor')
    map('v', '<leader>su', function() require('vcsigns.actions').hunk_undo() end, 'Undo hunks in range')
    map('n', '<leader>sd', function() require('vcsigns.actions').toggle_hunk_diff() end, 'Show hunk diffs inline in the current buffer')
    map('n', '<leader>sv', function() require('vcsigns.actions').diffview() end, 'Open native side-by-side diff view')
    map('n', '<leader>sf', function() require('vcsigns.actions').toggle_fold() end, 'Fold outside hunks')
  end,
}

As per https://lazy.folke.io/packages dependencies are specified in lazy.lua.

Screenshots

Screenshots are with my own theme vim-wombat-lua
which has highlight groups overridden.

Gutter signs and lualine stats

Gutter signs and lualine stats

Fold around diffs

Fold around diffs

Inline diff view

Inline diff view

探索相关项目

加载中…