-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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: host completion improvements #3450
Comments
[0] With sorting by domains I mean e.g.
I.e. sorted reversely by each domain component, and within the same component one should again do alphabetical (or better natural) sort. The advantage of such a sorting is, that host that (possibly) "belong together" are sorted next to each other |
Thanks for the suggestion, but before we discuss the topic in detail I have to mention that I'm not particularly looking to improve/expand the shell features (key bindings and fuzzy completion) we provide here. They are intentionally kept simple (with minimal configuration knobs)
I believe extended versions of the scripts should be maintained as separate projects. https://github.com/Aloxaf/fzf-tab is a good example. A separate project focused on a specific shell doesn't have the problem of maintaining the same functionality across three different shells, so it should be easier to add more advanced features. It's going to be used by advanced users who know what they're doing so the maintainer can experiment, break, and fix things with more confidence. |
Well, while on one side I can see your points (especially keeping
I think bash-completion might serve as a good model:
Another possible way, that would help you to keep the That would be again similar to how things are handled in the
What's your opinion on that? Any beyond that, would you still accept code for the actual feature idea itself? |
btw: (Your) current implementation of So would be happy if you'd agree to get something like that merged. |
man fzf
)Info
Hey.
I think the current host completion has a number of areas where it could be improved:
_known_hosts_real()
, which is quite powerful and IIRC even checksssh_config
for other configuredGlobalKnownHostsFile
andUserKnownHostsFile
.fzf
’s current completion seems to ignore any host (which are more or less all of them) that I have in theGlobalKnownHostsFile
._known_hosts_real()
also has many more features, I think it can optionally use Avahi and ruptime.For (2), I think it would be best if
fzf
would simply use_known_hosts_real()
- why re-inventing the wheel, if bash-completion guys already maintain that properly?Based on the 0.42.0
fzf
, I tried roughly the following:and at a first glance it seemed to work:
sort-u
is necessary asCOMPREPLY
contained many duplicates (no idea why).-V
is just for sorting ... ideally this would be configurable,... plus I'd like a sort mode that sort by domains[0].Some open points:
_known_hosts_real()
available for sure? I mean bash-completion does load completions for commands dynamically (i.e. only when the command is actually completed), but I'd blindly guess that_known_hosts_real()
is always available and we don't need to "import" it first.COMPREPLY
is set. Haven't checked whether_known_hosts_real()
uses other non-local variables. As long as the function is called within process substitution<(…)
this shouldn't be a problem, but I've seen that in edfdcc8 you placed the printing code in a separate function, so if that would ever be called outside process substitution it might cause unwanted side effects._known_hosts_real()
, likeCOMP_KNOWN_HOSTS_WITH_AVAHI
? Should we just use them directly, or clean them and initialise them only by our own e.g.FZF_KNOWN_HOSTS_WITH_AVAHI
counterparts (so that people could configure bash-completion and fzf differently)?The text was updated successfully, but these errors were encountered: