-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Find file (space .) #2412
base: master
Are you sure you want to change the base?
Find file (space .) #2412
Conversation
It's not clear to me what this is, it's showing a list of files? The idea is that it allows you to open directories? |
Yes, it's like So it is more of like |
Isn't this already the default behavior of |
Woops, yup I'm dumb sorry about that |
Yes, so this is more like it's always in insert mode. In other terms, more like file picker, but per directory. The main benefit I see for this currently is sometimes I want to quickly edit new file on the same directory, I can just I tried the file tree, doesn't seemed to work like what I expected. I tried
Also, behavior for file tree I find it weird, I don't quite know how to use it, have to try it a couple of times to figure out the behavior, for the find file in doom emacs, although I never used it before, I can easily get used to it in no time. |
You type |
.into_owned() | ||
+ "/"; | ||
*picker.picker.prompt.prompt_mut() = Cow::Owned(prompt); | ||
picker.picker.prompt.prompt_style_fn = Box::new(|theme| Some(theme.get("blue"))); |
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.
Not sure why this blue isn't working, I even tried palette.blue
.
Although not done yet but should be good for review now given that most of the functionality is in place, the only big thing left is file metadata. |
ogham/exa#851 seemed like it would be good if exa could have exported some stuff as library rather than copy pasting code from exa. Not sure what @ariasuni think, just sharing one use case. |
c00334c
to
66bcd58
Compare
Well, as said in the issue, I don’t think it’s likely that exa will ever have the listed features as library. I don’t think we’re doing that in the most efficient way, and the code is quite tied to exa’s internal as far as I know. Actually, the other way round, I would be happy to use one such library in exa if it existed and was more ergonomic/performant than what we do right now. |
Not sure how old the screenshot is, but I can see the |
I wanted to do that but that requires changing how the current rendering works, probably need to duplicate quite some stuff. |
8e9d3e5
to
a5cf088
Compare
The only thing I'd say this was missing after playing with the explorer in the other pr is instead of 'no files found' when hovering a directory, it should show the directory contents. But other than that, nice and very handy |
I know it will probably be out of scope for this pr (or for the editor itself) but maybe in a future this popup can provide a minimal file manage capabilities as well. |
Interesting, never thought of that. |
With directory, but now the code seemed even worse, I think a cleanup is definitely needed. I am thinking of adding two lines to the top to align the start of directory so when user navigate back and forth directory they won't feel like the position keep switching, also it needs some memoization if they enter the directory to not read the stuff twice, I feel bad that the quick implementation to try this out I just put the output as string.
Not quite sure what I want to put up there in the empty space preview. @cossonleo @Termina94 any opinion on this? I think I probably need to create And one thing here to note is that when user type in something to search but the file isn't present, then they press enter, it will create (open without save) that file, not sure how to make this feature more discoverable, with this user can easily create a file within the same directory as the opened file. |
What about the absolute file path?
If the file doesn't exist, you could have the default selected suggestion be a prompt to create the file, something like:
I'd highlight the create prompt a different colour and I don't know what to put as the permissions, just whatever it would be by default if Helix created it. As for the preview you could just put |
Nice idea, or maybe we can put that to the right side?
It works but is redundant with the information on the prompt, I wonder if anything is useful for users browsing directory, I can think of a couple of extra stuff:
|
introduced helper mod to reduce duplicate code
@lazytanuki @pickfire hi, this thread is pretty long so I did not read all the discussion, but I really want to mention this nvim plugin which seems to me the gold standard of file pickers (and we probably may learn something from them). It can do all sorts of stuff including moving, copying and deleting files. |
I've checked out this PR, built it, ran and find it quite good in terms of how it looks like, but there is a minor problem (bug):
when I try to backspace upper than my home directory (home/user) and upper. I think cases where directory does not exist should be handled more gracefully than panic on unwrap. |
@adsick Thanks, looks like that was due to broken link on my machine, I fixed that. Rebased the PR but looks like @sudormrfbin changes to remove |
Based on doom emacs find-file but also wanted to show an alternative to file explorer helix-editor#2377.
Will this pr be updated in the future? |
Yes, but lately I haven't have time to work on this yet. I will probably do |
Based on doom emacs find-file but also wanted to show an alternative to
file explorer #2377.
@cossonleo this is what I mean, just got some motivation to do a draft to show you what I meant, but maybe this complement the tree explorer, this is more of a per directory navigation like
:o <complete>
but with a picker / on steriods.Still missing some basic stuff that I wanted to see
format_fn
back to preview like shown as in imageThings not gonna be done in this pull request since they need more thoughts and can be done in separate pull request I believe
Compared to doom emacs
The code seemed kinda hard to read now, might need some cleanup. Also, some code are stolen without much changes, didn't really go and tweak it to make it look nice (and count the characters) since the rendering may change later once we add color.