How do I see Git diff markers in the sign column?
Answer
vim-gitgutter plugin
Explanation
vim-gitgutter shows git diff markers in the sign column next to line numbers. Added lines show +, modified lines show ~, and deleted lines show -.
How it works
- Install the plugin and signs appear automatically
+in the gutter marks added lines~marks modified lines-marks deleted lines- Updates asynchronously as you edit
Example
After modifying a git-tracked file, the gutter shows:
1 unchanged line
+ 2 newly added line
~ 3 modified line
4 unchanged line
- 5 (line was deleted after this)
Tips
- Install:
Plug 'airblade/vim-gitgutter' ]c/[cjump between hunks:GitGutterPreviewHunkpreviews the change at cursor:GitGutterStageHunkstages the hunk under cursor:GitGutterUndoHunkreverts the hunklet g:gitgutter_enabled = 0disables by default