1

If I have a block of contiguous flagged lines in vimdiff, then it treats them as if they were a single diff, and pressing 'dp' sets the other buffer the same for the entire block.

Is it possible to have it limit any diff to only the current cursor line?

2
  • Why not just copy paste? It would more easier to do that than try to select the ranges correctly
    – balki
    Feb 14 at 14:28
  • @balki Thanks, that's a simpler solution, and when the entire block is correct in one buffer, I can use vimdiff as is to accept the block. Best of both worlds. Feb 15 at 23:49

2 Answers 2

1

Try v:diffgetEnter or v:diffput Enter; these are like do and dp but accept arbitrary ranges. You could probably bind a simple operator pair, too, if you wanted to avoid visual mode.

1
  • I don't understand what 'bind a simple operator pair' means, not that familiar with technical terminology, so did it another way. Feb 14 at 1:04
0

On the strength of balki's suggestion above, I now use these 4 mappings

nmap <F6>1 yy<Ctrl-w>wddP<Ctrl-w>t]c  " use current cursor line
nmap <F6>2 dp<Ctrl-w>t]c              " use current block
nmap <S-F6>1 <Ctrl-w>w<F6>1           " use other cursor line
nmap <S-F6>2 <Ctrl-w>w<F6>2           " use other block

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.