wfxr / minimap.vim

📡 Blazing fast minimap / scrollbar for vim, powered by code-minimap written in Rust.
MIT License
1.2k stars 24 forks source link

Support for Other Version Control Systems #158

Closed djvolz closed 2 years ago

djvolz commented 2 years ago

Would it be possible to pull diff ranges from a plugin like vim-signify? This would enable the mini map to display diff info for a variety of version control systems beyond git (including custom file diffs that aren't version controlled at all).

Alternatively you could allow users to define their own custom git call overriding git diff -U0 --.

let g:minimap_diff_cmd = "hg diff --color=never --config aliases.diff= --nodates -U0 -- %f"

Here is vim-signify's default VCS cmd list for reference:

let s:default_vcs_cmds = {
      \ 'git':      'git diff --no-color --no-ext-diff -U0 -- %f',
      \ 'yadm':     'yadm diff --no-color --no-ext-diff -U0 -- %f',
      \ 'hg':       'hg diff --color=never --config aliases.diff= --nodates -U0 -- %f',
      \ 'svn':      'svn diff --diff-cmd %d -x -U0 -- %f',
      \ 'bzr':      'bzr diff --using %d --diff-options=-U0 -- %f',
      \ 'darcs':    'darcs diff --no-pause-for-gui --no-unified --diff-opts=-U0 -- %f',
      \ 'fossil':   'fossil diff --unified -c 0 -- %f',
      \ 'cvs':      'cvs diff -U0 -- %f',
      \ 'rcs':      'rcsdiff -U0 %f 2>%n',
      \ 'accurev':  'accurev diff %f -- -U0',
      \ 'perforce': 'p4 info '. sy#util#shell_redirect('%n') . (has('win32') ? ' &&' : ' && env P4DIFF= P4COLORS=') .' p4 diff -du0 %f',
      \ 'tfs':      'tf diff -version:W -noprompt -format:Unified %f'
      \ }

Great work on the plugin, love it!

ZNielsen commented 2 years ago

I like this suggestion! There's a few kinks to work out, the biggest one being the current implementation is tied to git — we parse a returned string, so the coupling is pretty strong. We might be able to make this work by having a configurable parsing function in addition to a configurable command, so people could write their own pair for whatever diffing method they want to use. We would probably want to have a list of common diff methods that can be specified so people aren't reinventing the wheel, and we would want to make adding to that section an easy PR.

Questions to mull over

New settings/global variables

I haven't had time to sit down and work on this plugin in a while — this seems like a fun one so I'll try to get to this in my next minimap binge.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

djvolz commented 1 year ago

I'm still interested in this issue if you end up with time for it.

If I find time, I can try to implement this and file a PR.