Skip to content

Sort bash completions in dir nesting order #35

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

Open
stacktracer opened this issue Apr 16, 2017 · 3 comments
Open

Sort bash completions in dir nesting order #35

stacktracer opened this issue Apr 16, 2017 · 3 comments

Comments

@stacktracer
Copy link

stacktracer commented Apr 16, 2017

Currently completions are ordered alphabetically. Would be nice if there were an option to sort them in the order in which they appear in the path -- so if current working dir is /home/user/Desktop/stuff/, then autocomplete would go:

$ bd <tab-key><tab-key>
home user Desktop
@stacktracer
Copy link
Author

stacktracer commented Apr 16, 2017

Not sure how this would handle duplicate entries (e.g. if working dir is /home/USER/Desktop/USER/stuff).

@stacktracer
Copy link
Author

This turns out to be pretty trivial. In the bash-completion file, just add -o nosort:

_bd()
{
    ...
}
complete -o nosort -F _bd bd

@stacktracer
Copy link
Author

Duplicate entries are simply shown more than once in the list -- which is fine with me.

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

No branches or pull requests

1 participant