On Jul 10, 9:02 am, Ben Fritz <[email protected]> wrote:
> I may run with this for a while, though I imagine it might get
> annoying because of the auto-diffupdate firing after using commands
> like dp and do...maybe I'll add mappings for those commands to update
> the old_changedtick as well.
Here's the mappings I ended up with:
nnoremap <silent> do do:let b:old_changedtick = b:changedtick<CR>
nnoremap <silent> dp dp<C-W>w:if &modifiable && &diff \| let
b:old_changedtick = b:changedtick \| endif<CR><C-W>p
The dp mapping is interesting. From :help :diffput:
When [bufspec] is omitted and there is more than one other
buffer in diff mode where 'modifiable' is set this fails.
Since dp acts like :diffput with no range or bufspec, I tried to make
it somewhat smart about whether or not to do a diffupdate, but it's
still not going to work in many situations. It cycles to the next
window, checks if the buffer in that window is both modifiable and in
diff mode, and if so updates the old_changedtick variable. Then it
switches back to the original window.
So basically, the dp mapping will only work properly if you have
exactly two windows in diff mode, or if the next window in <C-W>w
order just happens to be the "one other buffer in diff mode where
'modifiable' is set"
Since I normally only ever diff 2 windows in Vim (for three-way diff I
tend to use external tools) this works fine for me, but YMMV.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---