Friday, July 25, 2014

Colored diffs with mutt


I cannot stand reviewing patches with gmail or any GUI e-mail client. I use mutt. On my last post I explained how you can apply patches directly from within mutt onto a git tree with a few shortcuts without leaving the terminal. This small post provides the next step to allow you to grow a mustache... I mean, get you to enjoy your mutt experience even more when reviewing patches by getting you colored diffs to match the same colors provided to you by good 'ol 'git diff'. Edit your .muttrc file and add these.

# Patch syntax highlighting                                                    
color   normal  white           default                                        
color   body    brightwhite     default         ^[[:space:]].*                 
color   body    brightwhite     default         ^(diff).*                      
color   body    white           default         ^[\-\-\-].*                    
color   body    white           default         ^[\+\+\+].*                    
color   body    green           default         ^[\+].*                        
color   body    red             default         ^[\-].*                        
color   body    brightblue      default         [@@].*                         
color   body    brightwhite     default         ^(\s).*                        
color   body    brightwhite     default         ^(Signed-off-by).*             
color   body    brightwhite     default         ^(Cc)