New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: history-word-search-*? #10364
Comments
One conceptual question that comes up is: It hardly seems unlikely that I should want to complete successive parts of the full argument (eg |
Interesting. Useful, but kind of hard to implement and navigate. Consider this: On keypress, how to know whether to search for a longer or different word in history, opposed to appending the next part of the matching token? Also, which token? It's likely for a word to appear in many tokens. I would rather limit this feature to completing and reverse searching for the typed word prefix:
I would also leave it up to the user to append the separator, which can be space, comma, slash, period (... more?) So for your example it would be:
Type -> |
The token you already selected (if it is not clear which this is: AFAICS it must be the token in the most recent item within the history that matched the word). I'm trying to point out that you are selecting a subset of a token already, so the user can logically ask 'why can't I just complete even more (incrementally) of this token which is already selected?' (analogous to how you can use Tab-completion to complete part of a filename, type a bit to cut down options, and then Tab again to select the final completion) I'd also add that your original proposal already implicitly incorporates assumptions about separator ( Again, I'm not saying 'I totally want this thing that is a logical extension of your proposal'; I'm agnostic on whether that would be good. I'm just saying 'If your proposal was implemented, why would the user not expect the functionality to generalize to further words within the token?' |
Just typing Actually, I can refine my previous post: The moment the user confirms the selection with a separator, the same function could progress the completion with matching tokens:
assuming Hit hotkey again
So, grab all tokens matching the previous word (infix search), suggest the next word of the most recent token, scroll back in history when repeating hotkey. To incorporate your suggestion, the remainder of the matched token could be printed in gray (just like current history autosuggestion), and partially be accepted in the same way ( If computationally viable, the autosuggestion for token completion could always be shown. So:
or:
But also, assuming
The keybinds Edit: when full line autosuggestion is found, it would have precedence. |
The
history-token
functions search the list of previously used arguments as they were passed to executed commands. This is great! There is one use-case, though, where I keep thinking "maybe there could be a better way":in history:
ansible-playbook all.yml --limit first-host,second-host,third-host
later:
$ ansible-playbook all.yml --limit sec
+history-token-search-backward
result:
$ ansible-playbook all.yml --limit first-host,second-host,third-host
What happens: the argument
first-host,second-host,third-host
is auto completed. This is great for auto completing arguments, but not partial arguments, which is what I frequently need, too. So I proposenew:
$ ansible-playbook all.yml --limit sec
+history-word-search-backward
result:
$ ansible-playbook all.yml --limit second-host
also:
$ ansible-playbook all.yml --limit third-host,sec
+history-word-search-backward
result:
$ ansible-playbook all.yml --limit third-host,second-host
The text was updated successfully, but these errors were encountered: