In my vimrc I have <C-H>
, <C-J>
, <C-K>
and <C-L>
mapped to navigate between split windows in normal mode. When I use diff mode I only ever have windows in vertical splits, so I'd like to re-purpose <C-J>
and <C-K>
to jump to the previous/next diff.
:help diff
mentions &diff
when using vimdiff to determine whether you are in diff mode. It looks like this also gets set when you start a diff from an existing vim session, so I assume I should leverage this somehow to re-set the mappings, but I'm not exactly sure how. Based on my 2 second test just before posting this, I tried checking &diff
in my vimrc and performing the mapping as needed, but as I suspected the vimrc doesn't get read in again when going into diff mode from an existing vim session.
What would be the best way to detect going to/from diff mode and re-setting the mappings accordingly?