Why don't :diffget and :diffput allow completion after hitting <Tab> or <C-D>?

197 views
Skip to first unread message

jair...@etca.com.ve

unread,
Dec 28, 2019, 7:51:30 AM12/28/19
to vim...@googlegroups.com
Hello Vim community,

This is what the documentation in :help E787 says:

> The [bufspec] argument above can be a buffer number, a pattern for a buffer
> name or a part of a buffer name. Examples:
>
> :diffget Use the other buffer which is in diff mode
> :diffget 3 Use buffer 3
> :diffget v2 Use the buffer which matches "v2" and is in
> diff mode (e.g., "file.c.v2")


It would be nice if it can allow completion like the :buffer command currently
does; specially when dealing with merge conflicts as described here:
https://stackoverflow.com/questions/14904644/how-do-i-use-vimdiff-to-resolve-a-git-merge-conflict

Maybe I'm missing something, so I wonder why <Tab> and <C-D> doesn't work in
:diffget and :diffput.

Thanks in advanced.


Dominique Pellé

unread,
Dec 28, 2019, 8:06:29 AM12/28/19
to Vim List
Completion could indeed be improved for diffput & diffget.
But ideally, it should not be like :buffer, as :diffput :diffget
should only complete to buffer which are in diffmode and
also not complete the buffer name from which the diffput
or diffget originates.

Regards
Dominique

jair...@etca.com.ve

unread,
Dec 28, 2019, 10:00:22 AM12/28/19
to vim...@googlegroups.com
Thanks Dominique for your answer :-)

> Completion could indeed be improved for diffput & diffget.
Did you mean something like creating custom commands, like :Diffget
and :Diffput, that behave in that way?

jair...@etca.com.ve

unread,
Dec 28, 2019, 10:00:22 AM12/28/19
to vim...@googlegroups.com
Thanks Dominique for your answer :-)

> Completion could indeed be improved for diffput & diffget.

Did you mean something like creating custom commands, like :Diffget
and :Diffput, that behave in that way?

Dominique Pellé

unread,
Dec 29, 2019, 7:16:53 AM12/29/19
to Vim List
jair...@etca.com.ve wrote:

> Thanks Dominique for your answer :-)
>
> > Completion could indeed be improved for diffput & diffget.
>
> Did you mean something like creating custom commands, like :Diffget
> and :Diffput, that behave in that way?

No. I meant we could add completion to the Vim :diffget
and :diffput commands. I just created a pull request
with this new feature:

https://github.com/vim/vim/pull/5409

Can you try it and provide feedback?

With this proposed change, `:diffget` and `:diffput`
complete to file names which are diff mode and which
are different than the current buffer. No completion
when current buffer is not in diff mode. No completion
either in vim tiny/small where FEAT_DIFF is not enabled.

Regards
Dominique

jair...@etca.com.ve

unread,
Dec 29, 2019, 10:09:47 AM12/29/19
to vim...@googlegroups.com
> I just created a pull request
> with this new feature:

Cool! I think it's already "merged". Thank you Dominique for your pull
request!
I'll test it when I have a chance.

Happy holidays!


Reply all
Reply to author
Forward
0 new messages