feat(cli): support key=val commandline options by dezza · Pull Request #21078 · vim/vim · GitHub
Skip to content

feat(cli): support key=val commandline options - #21078

Draft
dezza wants to merge 3 commits into
vim:masterfrom
dezza:fix-cmdopts-keyval
Draft

dezza wants to merge 3 commits into
vim:masterfrom
dezza:fix-cmdopts-keyval

Conversation

@dezza

@dezza dezza commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Confusing that we don't support the common practise of

vim --option=val in addition to vim --option val

This can lead to not immediately obvious mistaken parsing such as:

 # socket -- parsed as positional argument buffer 1
gvim --servername=gvim --clientserver socket
/usr/bin/vim -Es --servername=test --clientserver socket \
+'redir! > /dev/stdout' \
+'echo "sname:" .. v:servername' \
+'echo "initialbufname:" .. bufname()' +'qall!'

sname:
initialbufname:socket

If anyone knows a good reason why we wouldn't, let me know, right now I'm not seeing it.

@dezza
dezza force-pushed the fix-cmdopts-keyval branch from c2d4413 to df9336c Compare August 18, 2026 04:44
@h-east

h-east commented Aug 18, 2026

Copy link
Copy Markdown
Member

@dezza

dezza commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

#21088

I think key=val commandline is so adopted that I can't think of any other program not supporting it, that would be some odd builtin or little used software.

@dkearns

dkearns commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

I think key=val commandline is so adopted that I can't think of any other program not supporting it, that would be some odd builtin or little used software.

[doug] /tmp % python3 --check-hash-based-pycs=default
unknown option --check-hash-based-pycs=default
usage: python3 [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.
[doug] /tmp % python3 --check-hash-based-pycs default
Python 3.10.12 (main, Jun 22 2026, 18:55:27) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
[doug] /tmp % curl example.com --silent --output=outfile
curl: option --output=outfile: is unknown
curl: try 'curl --help' or 'curl --manual' for more information
[doug] /tmp % curl example.com --silent --output outfile
[doug] /tmp %

Ubiquity is not a strong argument. Are there any ambiguous option combinations that this would fix?

@dezza

dezza commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

This works here, must be an older version.

[doug] /tmp % curl example.com --silent --output=outfile
curl: option --output=outfile: is unknown
curl: try 'curl --help' or 'curl --manual' for more information
[doug] /tmp % curl example.com --silent --output outfile
[doug] /tmp %

Ubiquity is not a strong argument. Are there any ambiguous option combinations that this would fix?

Its easier to read.

@dkearns

dkearns commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

They were just the first two that I used after reading your PR and being non-GNU thought they might not support the =.

This works here, must be an older version.

For reference: https://daniel.haxx.se/blog/2025/07/31/option-parsing-in-curl/

I don't have a strong objection to adding this but it would be nice to have a real functional justification and skimming :help startup-options I can't see one. One advantage of = is that it disambiguates optional values from arguments but that doesn't seem to apply in our case as optional values require no intervening whitespace or a + prefix.

@dezza

dezza commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

@dezza dezza changed the title cli: support key=val commandline options feat(cli): support key=val commandline options Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants