Skip to content

Instantly share code, notes, and snippets.

@qstrahl
Last active December 21, 2015 13:09
Show Gist options
  • Save qstrahl/6310563 to your computer and use it in GitHub Desktop.
Save qstrahl/6310563 to your computer and use it in GitHub Desktop.
Better, default-compatible mappings for diff mode
"" Override default diff normal commands to allow count specifying which diffed window to target
nno do :<C-U>exe 'diffget' v:count ? get(filter(tabpagebuflist(), 'getbufvar(bufname(v:val), "&diff")'), v:count) : '' '<Bar> diffupdate'<CR>
nno dp :<C-U>exe 'diffput' v:count ? get(filter(tabpagebuflist(), 'getbufvar(bufname(v:val), "&diff")'), v:count) : '' '<Bar> diffupdate'<CR>
"" Add a shortcut to :diffupdate
nnoremap du :<C-U>diffupdate<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment