-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Remove folder name prefix in cd
tab autocompletion suggestions
#8618
Comments
This has previously been requested in #7883 (and @thithib's #8617) I think it's reasonable to special-case file completion here, because it's already special: we complete one path component at a time, not the entire token. This should probably be kept consistent with other completions of sub-tokens, like for Sadly it's not so easy to do the same for completions that recursively call I don't think we need a configuration option (in theory it's possible to write your own pager that parses |
I don't see how this helps. It's an inconsistency, for very little gain. You can see for yourself - the screenshot does use "half" of the space for the prefix, but why does it matter? It's still on one line! I'm not sure how the length of the ellipsized prefix is determined today and there might be room for improvement, but having this consistent across completions is nice. Having a marker "hey, this is where this differs, this is how it fits in" is nice.
This would be easy enough to do in general - just don't search the prefix. Note this would be annoying e.g. for git commit hashes, because you might not want to see where it differs and only type from there. |
So that I'm not creating a strawman of the problem, here's two screenshots, the first of fish, and the second of zsh, for something that roughly mirrors my Documents folder. Hopefully it's not too controversial to say that the first is objectively worse than the latter here. There's much more clutter, I find it much harder to see what's going on, particularly at speed, and it's now multiple lines which makes doing a scan more annoying at speed. Imagine this but with 3x the number of folders. I'm happy for it to be, and think it'd be reasonable for it to be, a special case for path completion, and not hold for other options, and for this to be disabled by default but enabled via a config flag. Seems very reasonable to me. That said, I'm not against a hack which allows me to set the colours such the initial text is barely visible and the actual contents are brightly coloured, though this is far from desirable. I'm also not against just making a fork of the repo with just this change which I maintain if it's not a difficult change and you don't want it in the main repo. I'm also not against doing the PR if you can give me suitable pointers to what to do. I'd honestly just assumed there was a built-in way to change it and I couldn't for the life of me find it. |
It is, I do not believe it is worse at all. The first is consistent with every other completion, and it makes it entirely clear that what is shown is only part of the token that will be used if you select it.
It would be semi-involved, I believe.
We don't really do config flags like this, as a philosophical point.
I would be against accepting such a PR. I do not believe this should be changed.
Set $fish_pager_color_prefix. E.g. |
I'm not arguing it's more, or even at all, consistent. I'm suggesting, if you ask the majority of people which they find easier to read, I expect the (clear) majority will come down on preferring the latter, as they won't have such philosophical convictions and 100% of the content is relevant, as opposed to less than 50% (with the irrelevant parts of it in bold and the relevant parts greyed out). Literally over 50% of it is the same duplicate text. I'm surprised you don't see any issue at all from the non-philosophical standpoint? I'm happy to break your philosophical convictions on my own branch if someone can give me the pointers to do so, if it's not too involved. That said, I do not believe I'll be even close to the only one that wants it. Thanks for the I'd be interested in what more people think on the desirability of this. |
Voting isn't a good way to make design decisions.
If you want to make a suggestion for a better way to figure out how much of the prefix to show, that's fine. I'm simply opposed to not showing anything at all. Why? Because for every other completion if it shows a thing that's what will be inserted. So when I see "Videos/", I expect it to insert "Videos/". So if I then select it and get "/home/alfa/Videos", that's surprising. So that now means I need to look up to see what is already in there, but only for the file or cd completions. That's the issue with the inconsistency! So showing even just This would presumably be done in pager.cpp, probably in print_max.
If you want to propose a better color for one or all of our colorschemes, that's fine, too. That's probably a good idea. |
But it's useless information that only clutters the pager.
As I said in #8617, this also applies to tokens that are not path components. What about allowing a different color for path prefixes, since they're already handled differently (truncated), with a new |
I agree. I'm just saying that the stance of 'it is [too controversial], I do not believe it is worse at all' is not all there is to this as I think a lot of other users will feel very similarly; at the end of the day the shell is for people to use, so it's good to take note of what many users would like.
I'm following (I believe). I think the issue is, shells such as zsh and bash don't separate what's left to complete from what's already written, but just give the entire set of choices to choose from (narrowed down if you've already included some). I'd love this behaviour, just for cd if nothing else. Could this setup be made as a plugin that modifies the
I don't suppose you know the name for setting the colour of the completion choices, as opposed to the above which was for the prefix? |
What about adding a configuration option for the length of the truncated path, that people could then set to 0?
You've already made path components a particular kind of prefix since you truncate them. So one could argue it's already inconsistent. Why did you make that choice initially? Plus, "what is already in there" is what you typed or selected just before, so why would you need to look it up? You are interested in the next path component that can be selected. |
I don't think you follow. What I mean is this: Our pager currently figures out how much of the prefix and the rest of the candidate to show, and ellipsizes the prefix accordingly. Since you keep saying things like "over 50% of it is the same duplicate text", well, why not fix that and change the pager so it shows less of it? Figure out when and how it should shorten this in a nicer way. Just be sure to leave a prefix to indicate there is more. This could even be given special knowledge of paths and deprioritize the prefix, as long as it leaves a
The cd function itself has no say here, it's the core completion logic.
$fish_pager_color_completion, see https://fishshell.com/docs/current/interactive.html#pager-color-variables.
Like I said: We don't do those. I realize this is quite a culture shock, coming from zsh which is all-the-options-all-the-time, but we try very very hard not to introduce configuration options, especially not for tertiary things like this.
We truncate everything after a certain length, not just paths. Also the main issue is showing no indicator that the given candidate isn't the full token.
I need to keep the context that there is more in my head. And if there is no indicator of that (not even a |
I'm happy with leaving the ellipsis prefix, but I figured that you'd still want some of the prefix for the currently completed result? Or is that treated separately and not considered the 'prefix' here? For example, if I just set the colour of the prefix to my background colour and I tab complete with some of the target already typed, I don't get my suggestions including what I've previously typed, e.g. Would this not actually be an issue with what you're suggesting, as it'll always keep the initial part of the match targets? Or did I indeed understand correctly?
Perfect, thanks.
To me, my suggestion doesn't seem much different from
I'm not against including an indicator. Having a preceding ellipsis doesn't make it more unreadable, which is my main concern.
Presumably this would be on the command line, though? This is how people get by in all other shells. |
I'm simply saying to find some shortening logic that always leaves some prefix, even if it is just "...". Mostly this involves making shortening more aggressive, especially when it's about paths (where it should probably be ".../"). But for simple cases where it's just "Documents/Backups" and "Documents/Videos" we could probably leave more. I.e. in your case it should probably leave something like ".../ba". Maybe the logic could be something like: If the completion either is a path (came from the file completion logic) or looks like one (i.e. has a slash), de-prioritize everything up to the last "/" of the prefix. If that's very long or we are in need of space, make it ".../".
Like I said, looking at the command line requires looking up, out of the pager. Hence leaving the indicator that there is something to look up for. I am aware that people get by in other shells, but they get by with a lot of other things we do differently as well. How other shells do it isn't all that important, to be honest. |
So at least you partially agree that there's too much redundant information currently?
Yes, I understand and I totally agree. FWIW I want to stop using zsh because I don't like relying on Oh My Zsh and zsh is just too much customizable for me to even start writing my own config. So I'm trying fish and I love it, it's almost perfect for me out of the box and I surely don't want it to gain lots of config options over the years. It was a bit hard to get used to your history search but now I truly love it. The autocompletion/pager is the last thing that bothers me and stops me from adopting fish: it doesn't expand globs (but I hope it will someday #751), it doesn't colorize files according to their types (I also hope it will someday since you don't seem entirely against it according to #8251 and #2868) which prevents me from quickly spotting a file I'm looking for (e.g. build artifacts, that are executable so colored in green by my zsh, images colored in magenta, directories in blue, fifos in yellow, libs in cyan, etc.) and lastly there's this prefix issue.
Well I respect that and I guess our brains just work differently then. I don't need to have context in the pager, I know I'm currently completing a path (because if there's a prefix it means I've already typed or selected the beginning of a path myself and I then hit One thing to satisfy us both and comply with your philosophy would be an additional color variable like |
Tbh... shortening seems like the better idea here. Having a second prefix color just for paths is awkward. This has one of the major downsides of options: You need to know about it. That improves things only for the people who went looking for it. It's a cop-out that leaves the responsibility for making things better with the user. |
It would just be an additional variable in this table… It would be as much discoverable as existing color variables. Regarding your point of shortening but only when it's too long, it doesn't fix the issue of allowing to rapidly spot e.g. the next character I can enter to filter completion candidates. Also, how would you feel about another symbol than ellipses? Something that would both make it obvious for you that there is context (and "that there is something to look up for", as you put it) but at the same time not make the next candidates less discernible? |
We currently use ellipses here and I don't see a good reason to change it. They are a good symbol for "there's more". |
I find the prefixes here visually and kinda cognitively noisy, I get where he is coming from. I think the other screenshots are easier to grok what is going on at a glance. If they truncated at exactly a path separator that seems better. As in
|
It seems everyone would be happy with this choice of having just If that's indeed the case, I'm wondering how we'd do it. I have no experience with the codebase; what's the best approach for it? I'm not against contributing to doing it if it's feasible for a new contributer, but I'd like to ensure it fits in philosophically with whatever would be needed to get the PR accepted. |
There's another side of this coin. If there are very few completions, the current ouput looks better IMO, especially for new users. (Also I think
Though of course with many completions and for more experienced users the proposed output is better. Overall I think the change is fine although I don't think it's a strict improvement. When implementing, look for Observe that
OK that doesn't look so good (it's a rough sketch) but I think it's worth exploring. Maybe Perhaps we should even remove the entire shared prefix, disregarding the /? (Or only if there are many completions).
|
I know I like the prefix just being And if some people (but not all) really don't agree with that, are we certain we don't want this to be configurable? Feels like it may be hard to reach a consensus on something so subjective, which will mean this ticket just stalls indefinitely and never gets fixed. |
Yes. This is not an option that people would really find. This is one of those side-options for a rather specific feature that most people don't care about but it clutters the list of options and is hard to know about for the people who would benefit from it. So we should not implement it. Pick the best setting and make that the only choice instead. And if that's the current way of doing things then so be it. Making it an option makes the person asking for the option feel good because they get to pick their favorite choice, but that's simply not the way we do things. |
Really, what we want is to avoid showing too much prefix for too little "suffix". Don't show So that means either specifically handle paths or path-looking things because those have components that you already know, and we can quickly skip to the last "/", or to look at the length of the prefix in relation to the "suffix" (i.e. the actual completion candidate). (I'm assuming the latter is untenable because it requires scanning through all the candidates before deciding on a prefix length) The issue with making it scale with the number of candidates is that it doesn't look at the relative length - that example with |
I'm also not a fan of making such a detail configurable. To me, that is like giving up. |
Good point, I agree that it's actually about the relative length
we we already look through all candidates and only truncate the prefix at the end. So that would work well. If that doesn't work, I think we agree that |
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
Hi, is there a solution for this? |
fish version. 3.3.1
OS. MacOS Monterey v12.1
Terminal. iTerm2 3.4.14
Behaviour persists on running
sh -c 'env HOME=$(mktemp -d) fish'
.When typing
cd
and going into a directory, using tab completion prefixes the last directory in front of all results, sometimes truncated and prefixed by...
. For example,bar
below is needlessly prefixed.I'm finding this very inconvenient when, for example, trying to tab complete at
~/Documents/
, which prefixes...ocuments/
in front of every result. More than half of the text returned is useless. It looks something like the below (but worse).How can I have fish only list the directory names?
The text was updated successfully, but these errors were encountered: