5

I enjoy using Vim and like it better than IDEs on most points. One common IDE feature that I miss, though, is inline diff highlighting:

Changed lines highlighted in blue, new lines in green
In this example changed lines are highlighted in blue and entirely new lines in green. Red for removed lines and beige for lines with changed whitespace are also common colorings. I know of tools that can show a diff in two windows, but is there any feature or plug-in that can do it like this? Preferably compared to version control.

7

You can do this with the vim-gitgutter plugin. If you're not using git, then Signify has a similar feature.

After installing vim-gitgutter, you can switch the highlighting on and off with the following commands:

turn on with :GitGutterLineHighlightsEnable
turn off with :GitGutterLineHighlightsDisable
toggle with :GitGutterLineHighlightsToggle.

Or, to enable highlighting by default, add the following line to your .vimrc:

let g:gitgutter_highlight_lines = 1

You can also customize the colours used by specifying the highlighting for the following groups:

GitGutterAddLine          " default: links to DiffAdd
GitGutterChangeLine       " default: links to DiffChange
GitGutterDeleteLine       " default: links to DiffDelete
GitGutterChangeDeleteLine
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.