-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH-70 - Add git sidebar coloring support #72
Conversation
call s:set_range_color(a:winid, a:startpos, a:endpos, g:minimap_diffremove_color, g:minimap_rem_matchid) | ||
endfunction | ||
function! s:set_diff_range(winid, startpos, endpos) abort | ||
call s:set_range_color(a:winid, a:startpos, a:endpos, g:minimap_diff_color, g:minimap_diff_matchid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These functions (set_diff(add|remove|)_range
) aren't actually used. I used them for a bit, but then went with the dictionary solution above. I left them in because they seemed like nice convenience functions, but they can be removed with no repercussions if desired.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested this on my Windows. Since I use g:minimap_auto_start_win_enter
, it's actually s:open_window
which is called to open the minimap, and not s:toggle_window
as is default. The one change I requested should fix this case; beyond that everything else works and looks great to me.
- Move definition of `g:id_list` to `s:open_window()` (from `s:toggle_window()`) - Change default highlight groups to ones that ship with vim
- Change double quoted strings to single quoted strings
I'm not sure when Wenxuan will be able to see this, so I hope I'm not being presumptuous by merging this. I didn't encounter any problems with normal functionality using the branch (if there is a problem, the pr can be reverted and adjusted without incidence), and the added feature works great. Great work, and thank you for the significant contribution! |
@rabirabirara That's OK! I just tested this feature and it looks pretty. Thank for your great work @ZNielsen ! |
Check list
Description
This implements GH-70 - Adding git coloration to the minimiap. New feature is disabled by default, so users should not notice a difference unless the feature is explicitly enabled.
Implementation details
The git diff is retrieved for the current file, and the diff blobs are parsed to determine the range and types of changes. Unfortunately, I did not see a way to retrieve just the diff blobs. In an effort to cut down the amount of text parsed, the
-U0
option is passed to git, requesting just the changes with no additional context.A list of IDs is created when coloring each section. The list needs to be kept around so we can clear out the IDs the next time the minimap is updated. The list just increments to the next ID - I don't have a whole lot of experience with id matching to know if that will cause a problem, but it seemed to work just fine during my testing.
Type of change
Test environment