I'd like to do a diff on the current file / buffer compared to the git repository.
Ideally a single function that could be called, or binded to a keyboard shortcut.
Firstly, make sure you're aware of https://stackoverflow.com/a/17799517
If you want a Magit diff buffer for the current file, you can call
magit-diff-buffer-file directly, or use the "diff" option (d) in
(global-set-key (kbd "C-c m d") 'magit-diff-buffer-file) (global-set-key (kbd "C-c m f") 'magit-file-popup)
You can alternatively invoke
vc-diff with C-xv=