Skip to content
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

Deduplicate argument history suggestions #4795

Closed
mqudsi opened this issue Mar 9, 2018 · 3 comments
Closed

Deduplicate argument history suggestions #4795

mqudsi opened this issue Mar 9, 2018 · 3 comments

Comments

@mqudsi
Copy link
Contributor

@mqudsi mqudsi commented Mar 9, 2018

Currently, argument history iteration is a huge chore because it is extremely naïve as currently implemented and suggests literally every argument in the history that matches the current prefix, regardless if it's already been suggested or not.

Consider the following history items:

cp file1 file2
rm file1
touch file4
touch file1
mv file1 file3
cp file<UP>

The suggestions on repeated <UP> will be file3, file1, file4, file1, and finally file2 (which is what I want). While these arguments are taken from deduplicated history entries, the completion arguments themselves are duplicates of previous suggestions. If I bypassed file1 the first time, there's no reason to suggest it the second time.

@mqudsi mqudsi changed the title Deduplicate argument history iteration Deduplicate argument history suggestions Mar 9, 2018
@faho faho added this to the fish-future milestone Mar 13, 2018
@zx8
Copy link

@zx8 zx8 commented Aug 10, 2018

@ridiculousfish I know it's a long shot, but since you're currently poking around the completion/suggestion code (looking at recent commits on master), any chance you could take a stab at this? 🙏

It's super annoying to have the same argument suggested over and over after I've skipped it the first time!

Loading

@ridiculousfish
Copy link
Member

@ridiculousfish ridiculousfish commented Aug 11, 2018

I think this is about token history search (alt-up). Yes this should be easy to fix.

Loading

@ridiculousfish ridiculousfish removed this from the fish-future milestone Aug 12, 2018
@ridiculousfish ridiculousfish added this to the fish-3.0 milestone Aug 12, 2018
@zx8
Copy link

@zx8 zx8 commented Aug 15, 2018

Edit: Raised as a separate issue here: #5150


@ridiculousfish e51e854 is awesome, but has ever so slightly changed/broken the traversal order of history arguments (i.e. history-token-search-backward):

Prior/expected behaviour:

$ echo foo bar baz
foo bar baz
# alt-.
$ baz
# alt-.
$ bar
# alt-.
$ foo

Current/unexpected behaviour:

$ echo foo bar baz
foo bar baz
# alt-.
$ echo
# alt-.
$ foo
# alt-.
$ bar

Would it be possible to reinstate the old traversal order? More often than not, whenever I press alt-. it's to recall the last argument of the previous command. This would also be consistent with bash.

Loading

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants