Re: [PATCH/RFC] completion: complete all possible -no-<options>
From: Eric Sunshine <hidden>
Date: 2018-04-23 05:36:24
On Tue, Apr 17, 2018 at 2:13 PM, Nguyễn Thái Ngọc Duy [off-list ref] wrote:
The problem with completing --no- form is that the number of
completable options now usually doubles, taking precious screen space
and also making it hard to find the option you want.
So the other half of this patch, the part in git-completion.bash, is
to uncomplete --no- options. When you do "git checkout --<tab>",
instead of displaying all --no- options, this patch simply displays
one item: the --no- prefix. If you do "git checkout --no-<tab>" then
all negative options are displayed. This helps reduce completable
options quite efficiently.
After all this "git checkout --<tab>" now looks like this
> ~/w/git $ git co --
--conflict= --orphan=
--detach --ours
--ignore-other-worktrees --patch
--ignore-skip-worktree-bits --progress
--merge --quiet
--no- --recurse-submodules
--no-detach --theirs
--no-quiet --track
--no-track
I haven't looked at the implementation, so this may be an entirely
stupid suggestion, but would it be possible to instead render the
completions as?
% git checkout --<tab>
--[no-]conflict= --[no-]patch
--[no-]detach --[no-]progress
--[no-]ignore-other-worktrees --[no-]quiet
--[no-]ignore-skip-worktree-bits --[no-]recurse-submodules
--[no-]merge --theirs
--[no-]orphan= --[no-]track
--ours
This would address the problem of the --no-* options taking double the
screen space.
It's also more intuitive than that lone and somewhat weird-looking
"--no-" suggestion.