-
Notifications
You must be signed in to change notification settings - Fork 82
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
Limit file search to directory under cursor if it has a trailing slash #75
Conversation
Co-authored-by: imr0 <[email protected]>
Thanks for the feedback in #70! My preferences for why using completion this way have basically been summarized by @paddor in #70 (comment), but I will also reiterate them here:
|
Sorry for the slow turnaround time, been a heck of a day at work...and will continue to be for a while so please be patient. Anyway, for now, I'm not sold on this. Why? It's not that I don't like the idea. But there are serious downsides when considering the plugin holistically
Sorry for i'm being harsh. I hate that you already put in the work. But I won't merge it as is. However, I am open to a compromise. Maybe if we use a key bind to reload fzf's input list with the contents of the directory in the query? e.g. |
We can add a little check here. If there is no other match in the currect directory, we will use the entered directory as a base. |
I don't think this is that complex, but yeah, I'm not the one to say it.
We are not building a file manager. This is a file picker after all, any only recently it got addition so it can be used for quickly navigating to folders. Third-party program can't intergrate with Fish at this level (unless you would like to keep the program open), which means this function will never become useless.
That is not a mode, we only save the user from typing I agree with the rest of narration. This PR is not meant to be accepted as-is, I'm just throwing in my thoughts. |
I just made a change which gives a compelling reason why this will be a nice addition with no cost. The base directory will only be changed to the token under cursor if:
Why I call this a compelling reason? Because when you open the search with And I want to provide a real life usage for @imr0's forth point:
As you may know macOS has a large |
Just tested. The file previews broke :( |
@PatrickF1 I have fixed the preview (which is easier than I expect). |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah you're right--it works again now--not sure what I did wrong.
Just noticed fzf does this in their own Fish plugin: https://github.com/junegunn/fzf#fish-shell |
Nice, I'm glad we added it though it's causing quite a bit of maintenance and documentation pain. |
…atrickF1#75) This new behavior allows the user to control the directory in which the search file feature initiates its search. If the current token is a directory and it has a trailing slash (e.g. functions/<CURSOR>), then we assume the user wants to search for files in that directory. This can be useful when in a directory containing large subdirectories (e.g. on macOS, the home directory contains ~/Library which is very large). Moreover, it also allows searching a parent or sibling directory by using ../ (e.g. ../Downloads/<CURSOR>. What's great is that this new behavior is that it complements tab completion. When a user wants to access a file in a subdirectory, they may start typing the name of the directory and hit TAB. When tab completion writes out the directory's path, it will already append a trailing slash for the user, allowing the user to quickly execute the search files feature and search within that directory.
Derived from #70 (comment)