I have been using vimdiff in its vimdiff1
layout, where it opens side by side the two buffer of LOCAL and REMOTE. The reason I preferred this layout over the other standard layout is the two shortcuts do
and dp
for getting and putting diff chuncks respectively.
------------------------------------------
| | |
| | |
| | |
| LOCAL | REMOTE |
| | |
| | |
| | |
------------------------------------------
Yet, recently I came across the scenario in which I often had do take a mixture of the two chuncks, for which manual editing to the MERGED file has been easier.
Now, I would like to switch to a LOCAL,MERGED,REMOTE
layout, and I was wondering if it's possible to define custom keybinding only for vimdiff.
Namely, I'd like to define two gl
and gr
shorcuts for :diffget LOCAL
and :diffget REMOTE
.
------------------------------------------
| | | |
| | | |
| LOCAL | MERGED | REMOTE |
| | | |
| | | |
------------------------------------------
Is there a way to define a keybinding only for the vimdiff 'mode'? Or alternatively, are there already standands keybindings which I'm not aware of? For reference: https://git-scm.com/docs/vimdiff/en
Of course, I could set these to be global keybindings with:
noremap gl :diffget LOCAL<CR>
noremap gr :diffget REMOTE<CR>
But this would apply them globally to the normal mode.