Closed TheodorRene closed 1 year ago
Just like in the shell, arguments in the vim command line are whitespace separated. Thus - just like in the shell - if your arguments contain whitespace, it needs to be escaped with a backslash (\
):
:DiffviewOpen develop...HEAD@{1\ days\ ago}
You would have to do the same thing in a shell unless you quote your args (something that is not supported natively by the vim command line):
$ git log --oneline develop...HEAD@{1\ days\ ago}
That makes sense. Do you prefer the current behaviour? We are not limited by Vims arguments parsing in theory, but it might be more consistent to keep the same behaviour as in the shell.
How do you suggest we change it?
Make
:DiffviewOpen develop...HEAD@{1 days ago}
or
:DiffviewOpen develop...HEAD@"{1 days ago}"
equivalent to:
:DiffviewOpen develop...HEAD@{1\ days\ ago}
The first form you suggest is a really bad idea. It's unclear how you intend for arguments to be separated in this form, if not by non-escaped whitespace. And regardless, it would break with conventions of every command line I have ever seen.
However, I'm in favor of supporting quoted args. In fact I have a local branch where I am already experimenting with this.
Sounds good to me 👍
Man page from git-rev-parse:
:DiffviewOpen develop...HEAD@{1 days ago}
will not work. From what I gather its because the parsing of symmetric diffs is only based on the first argument of a whitespace split diff.GitAdapter:rev_parse
takesdevelop...HEAD@{1
sinceGitAdapter:diffview_options
gives it onlyargs[0]
. The best would be some custom logic to parse the arguments instead of solely on whitespace. I might have a crack at this over the weekend, I'm just a bit unsure where this should be placed.It could either be mashed in here, not passing
state.fargs
, but a list after some custom split logic:or here: