Wednesday, February 21, 2018

Re: vimdiff - how to jump to next difference in long line - shortcut ]c does not work

2018-02-21 12:43 GMT+03:00 Igor Forca <igor2x@gmail.com>:
> @ZyX, I did:
> 1. Start-up Vim in clean:
> gvim -u NONE -N
>
> 2. Open the first file:
> :e file1.txt
>
> 3. Diff mode second file:
> :vert diffsp file2.txt
>
> 4. Do the mapping you suggested:
> nnoremap a ]c
>
> 5. Press the a key and nothing happens.
>
> So still a problem.
>
> By the way if mappings would be the problem then ]c shortcut should be working out of the box because I have run gVim in: "gvim -u NONE -N" clean environment.

(Environment would be clean with `-i NONE` as well. But it should not
matter here, I know no way for viminfo file to define a mapping.)

>
> Any other idea?

Some other ideas:

1. Check whether `c` is an ASCII `c` by using `ga` with cursor over it
(first typing that in some file, of course). Same for `]`. If keyboard
is actually a problem then typing `]c` when defining mapping is just
as good as just typing `]c`. Though I do not see any problems in your
email.
2. Based on my observations a "change" is "block of changed lines not
interleaved with non-changed lines". E.g. when I did `vimdiff` on
README.md and CMakeLists.txt from Neovim repository I saw that Vim
registered only two changes there: first line (README)/first two lines
(CMakeLists.txt) and everything else (the only non-changed line in
this case was a blank second (README)/third (CMakeLists) line). In the
example `]c` is only capable of jumping from the first few lines and
from nowhere else. Also `]c` will not bring you to the first change if
current change is the last one: it does not wrap.

This problem should be immediately visible though.
3. Check what other diff command do in your case. Specifically, what
`:diffget` changes, maybe it will yield some hints.

Also AFAIK Windows may have some problems with diff.exe availability,
but it is supposed to be shipped with Vim and you would definitely see
the problem just after `:diffsplit` if that was the case.

>
> --
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment