-
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
Consider reinstating implicit cd in some form #22
Comments
I regularly use implicit cd, but I have set CDPATH to . because I found the results of combining the two confusing. I'd suggest either (1), with changing CDPATH a sufficient degree of configurability, or (2). |
Regardless of what you do, please don't make it configurable. Zero configurability is one of my favorite features of fish. It's super convienient to be able to just install it and not worry about configs. |
Agree with shamrin regarding not making it configurable. |
Any update on this? |
So far I'm happy with the current behavior, which is that implicit cd works only for paths starting with one of ./~ I'm leaving this open to encourage piling-on. |
This is the biggest point I feel uncomforable since I switched fish to fish-shell. I don't know why I have to type a |
In fact, ./ allows to browse the directory tree as if it were a GUI, through autocompletion. and, if you write configurable CDPATH is also very convenient |
@levantis That's not the reason we make it forced. You can still use like that even if we make cd implicit. |
Well, if it's program-folder name collisions, you can always write it explicitly, so forcing does nothing here, either. Is it something else? I couldn't find it on the web... |
Either 3️⃣ It looks reasonable and I can't think of any ways it could collide with anything else. or 5️⃣ Typing Why not 1️⃣, 2️⃣ or 4️⃣? 1️⃣ and 2️⃣ introduces some strange variable/setting and as user-friendly shell user I want to know nothing about it. 4️⃣ is something in between 3️⃣ and 5️⃣ and is inconsistent. Because then you'd be already writing cd everywhere else and why should |
@simukis I don't think we can type three characters When use
@ridiculousfish |
If we reintroduce #1, then command completions will cease to be globally unique, depending on which directory you are in. For example, say you are used to typing 'zipc' to get 'zipcloak'; introducing this change would mean that if a directory 'zipcar' happens to be present, it would break your muscle memory. I also remember finding the sheer number of (low-quality) completions overwhelming in the original fish. Of course having ~ in CDPATH didn't help. Lastly, I think it's confusing that under #1, you can "execute" any directory with a relative path, and execute any program with a relative path that contains a directory, but not execute a program with a relative path; i.e.:
PATH does not contain '.' by design, and it seems strange to make it so, but only for directories. That's my thinking at least. |
For me, it's worth to lose some user-friendly completion unexpectly sometimes, instead of typing So can we make it configurable? We have And I don't think the |
I'm with iven on this. Fish looks really cool but I'm sticking with oh-my-zsh for now because of implicit cd. Really the usability of implicit cd should be much better in fish anyway because you can see before you complete what's gonna happen. |
I'm with @ridiculousfish on this. Let's look at how execution of files acts. Your directory structure is:
You're in the
I like the idea that autocd works just like program execution. It's not like you can ever execute a directory anyway. What if whenever you try to execute a directory, fish Note that because this works:
this would also work:
However, fish fails to autocomplete this case. Observe:
Even though Fish should autocd just like it executes programs: whenever a user tries to execute a directory, Conversely, full autocd should come with automatic execution, for consistency. It's silly and inconsistent to allow If any configurability is added I suggest an auto execution option, of which autocd is a subset. Some people might find that really useful. I, for one, would hate it: especially if it made autocomplete work differently depending upon my location. |
@Soares Autocd without ./~ is as you say inconsistant with non-auto-execute without ./~. But why be hung up over consistency? Consistency is a tool used to increase usability, discoverability, memorization, etc. It is not a goal in itself. All things being equal consistency should always lose out to usability, discoverability and ease of memorization if they are actually in conflict. |
@Soares Note that we should have autoexecution of Just think about the omni bar in Google Chrome. Do you think we should have to type |
It's for security but it's also for usability. Let's say you have a file named Yes, it's more "dangerous" to execute a file than it is to cd to a directory, but from a user perspective it's quite surprising to have different behavior for directories and files. (And that's ignoring symlinks and other edge cases where things get wishy washy.) Keep in mind that I'm advocating we do autocd to a directory when you just type it's name, we just don't autocomplete it (which is how programs are currently executed). Commands on the |
Soares and ridiculousfish are spot on here, 3 is imo the way to go. |
I'd like to throw in that I think this is a fine feature as it is, but it should be better documented. I spent quite a lot of time reading the extensive documentation on I'd personally never used zsh but seen my coworkers do so frequently, so perhaps I am an edge case. Or perhaps I just need better search-fu. Cheers. |
Not true if you touch-type with qwerty or dvorak. True for colemak though. You can always make a custom
or perhaps
The latter will look bad with syntax highlighting but saves one key stroke (enter). I wanted to make it ctrl-enter but seems you can't bind |
@dag Thanks for the tip. However, I'd like implicit cd to follow $CDPATH, so this does not work for me. I'm currently using a version modified by myself to have implicit cd, working well so far: https://aur.archlinux.org/packages/fish-shell-implicit-cd-git/ |
@iven Another idea would be to use a |
@dag The reason why you can't bind If your terminal allows you to setup keys, you could specify that |
Ah. |
+1 for this feature. I would love to have the implicit cd back. If it's something that there is no agreement, at least add a way to enable it for the people that use it. |
I've through of something else. No magic (well, ok, feature itself is magical, but the method I propose is logical), good error messages, and stuff like that.
So, well, the idea is that if you end command with Alternatively, it could apply to any path containing |
I like @glitchmr 's idea. I never liked implicit cd but this one seems to be usable for me. So +1 |
I like it @glitchmr, could even work with |
The reason why tab doesn't show slash for single dot is related to |
IMHO, implicit cd should work:
I like the idea of having both. Currently, Also, I think that |
I agree with you and GlitchMr on this, because: From
Most programs obey this, for example mv:
For bash, trailing slash on the executable is mission impossible to begin with, since it has no notion of executing directories. Yet, bash will honor the trailing slash, and verify for you that the executable is a directory:
Note also that by the «contains slash» rule, |
This is an experimental feature, proposed in the issue #22. #22 (comment)
I decided to experiment with this feature, and pushed it (for now) to the fish code, in commit 6c82e7a, just to get feedback about this feature (considering the support for it). The feature is partially implemented, but basic things (like tab completion and feature itself should work). Needs documentation, and better error messages, but that will be added when it will be confirmed that this feature will appear in fish 2.1.0. |
My main concern here is tab completion. Will we find that tab completing commands instead accidentally completes directories? How does (should) this relate to CDPATH? I guess time will tell. |
@ridiculousfish: I wouldn't worry too much about tab completion. Before improving tab completion (and tab completion was improved after 2.0), tab completion could complete directories. Besides, I don't expect directories to have lots of directories, so it's unlikely things would break too much in many cases. As for |
Changing my view on this: I think that this should require a |
IMHO Either solution 1 or 2 would be good.
👍 This would be a great idea. |
The second is already implemented in fish right now. |
But autocompletion doesn't work for this? |
@iven it does? |
By autocompletion, do you mean tab completion or autosuggestions? What's not working specifically? |
@ridiculousfish |
I think we deliberately do not respect CDPATH for implicit cd. |
... which is a very good choice IMO! |
@ridiculousfish But when I type the whole |
Well then maybe I'm wrong :) |
3 works just fine. |
@berkus 👍, I agree. |
Is this still an issue? For me, typing "directory/" works and respects CDPATH. |
The current rules are that it has to lead with dots, a slash, or have a trailing slash. |
From the docs for the
I'm not sure where else it should be documented, so I'm closing this now. |
It would be nice if the following worked:
|
This bug tracks reinstating implicit cd in some form. Implicit cd is where you can switch to a directory by just typing its path, without explicitly typing cd. It's as if you execute the directory.
In decreasing order of implicitness:
There's also potential to make this configurable in some way.
Feel free to pile on with your desires / perspectives.
The text was updated successfully, but these errors were encountered: