felix
felix copied to clipboard
[FEATURE REQUEST] File chooser mode
Just a possibility, but something like yazi's --chooser-file
(or ranger
's --choosefiles
) flag would be very useful. This just writes the selected file(s) to a given file path instead of opening them directly. My use case is for using it in a Neovim plugin, such as others I have in my plugin tfm.nvim.
Hi, could you let me understand this a little bit more?
I think this is similar to this issue of joshuto https://github.com/kamiyaa/joshuto/issues/96 .
This feature would enable fx --chosefiles=/file/path
command, and after the launch, the path of a file executed in felix would be added to /file/path
text file with \n
, right?
For example, if I open ~/.config/felix/config.yaml
with --choosefiles=~/sample.txt
option, the full path of config.yaml
would be written to ~/sample.txt
.
I'd be appreciate if you teach me how this would work with the vim plugin.
Sure yeah.
So for example when run with felix --choosefiles=~/sample.txt
, I would want it to open felix normally, but when selecting a file, instead of opening it, just write it's path to ~/sample.txt
, so that the selected file can be opened by something else. Hence it's just being used in a kind of file picker/chooser mode.
As a side note, is there currently a way of passing just a file path and having that file path focused when opening felix
? Either it's own flag or just accepting any path instead of just directories. yazi
just accepts the path to the file, and ranger
has a --selectfile
flag.
By the way - very cool project, thanks for making it
Sorry for the late reaction.
#262 implements --choosefiles=/path/to/textfile
option.
It'd be great if you check the behavior.
Edit: Oh, and the selectfile option is another story -- It might be worth considering, so I'll create a new issue about it.
No problem, thanks for implementing this!
Checked it out and just 2 things (my opinion):
- If the file doesn't exist, it should just create it
- I believe it would be better to close the program once a file is selected. That's how other terminal file managers tend to do it
The use case for me is:
- Open
felix
insideneovim
, and have it focus the file that was being edited (this is where that other feature would be useful) - Select a different file from within
felix
, which writes this path to a file and closes, bringing you back toneovim
- A plugin can then read that path and open the file in
neovim
I think it will be more ergonomic to first select a bunch of files in fx
and enter :w /path/to/write/to
in fx
to write the selected files (or create another command instead of :w
). That way you don't have to manually type fx --choosefiles="/some/path"
to start fx
.
Then use can quit normally with :q
. You can have also have a config option called exit-after-choosefiles
or optionally ask the user to quit after choosing files, though the latter might get annoying if the user wants to "choose files" multiple times.
Could be an option I guess, though hopefully --choosefiles
would still be available
- If the file doesn't exist, it should just create it
- I believe it would be better to close the program once a file is selected. That's how other terminal file managers tend to do it
@Rolv-Apneseth Fixed #262 in this way.
Awesome, thank you.
Would it make more sense to override the file with the new path rather than just append the path to the existing file? It wouldn't make a difference for my use case though so for me it's fine as it is.
One more potential feature for this, how about being able to output multiple files with linewise visual mode? Absolutely not necessary but it would be nice. This could potentially be a separate feature, as, correct me if I'm wrong, but I don't think there's a way to open multiple files to edit at the same time right now?
OK, I'll fix it to open in non-append mode.
And about the linewise visual mode, it could be easy to add the feature to "open" multiple files with choosefiles option.
In other options e.g. just fx
, though, I might disable that feature because felix is just a tui file manager, and while it's completely normal to, e.g., open multiple images with macOS' preview, terminals are not created for that use case IMO.
@Rolv-Apneseth Ok, fixed. Now
-
--choosefiles
option always create or truncate an text file. - In linewise visual mode, if
--choosefiles
option is on, you can output multiple file paths byEnter
,l
or right arrow key.
That's awesome, works great!
Merged to develop
. It'll be published to crate.io and other package repositories after adding some other features.
Nice, thanks for implementing this. I'll also subscribe to #263 and once that's done I'll be sure to include felix
in tfm.nvim
#263 implemented in #272.
Awesome, thank you. Sorry for the late reply, I've been away.
I have a couple of issues/suggestions (only if you have time of course - if you don't let me know and perhaps I could have a go):
-
fx temp.txt
doesn't work butfx ./temp.txt
does, I think the./
should be assumed if not given -
fx --choosefiles="temp.txt" ./temp.txt
doesn't work, unfortunately this is the exact use case I need for the plugin. I noticed it doesn't work with./
either so I'm guessing--choosefiles
is blocking it in some way. Sorry for not catching that earlier. - Just a suggestion, but I believe when focusing on a file with
fx ./temp.txt
, it shouldn't have the file at the very top of the view, maybe just center it on the file so you can see folders etc. above it - This one is very minor but for the
--choosefiles
option, would it be possible to also have it work like this:fx --choosefiles temp.txt
or would that complicate things?
Ah.. This one is becoming a kind of yak-shaving, you might also know. While I'm positive for implementing an useful feature for users, I'm kind of doubtful now that if many of them actually touch this. I should have asked that, how many hackers do use your plugin?
Yep fair enough, no need to do anything else if you don't want. I completely understand.
As for the plugin - no idea how many use it. Probably not all that many.
I will say though, these features are nice to have for being able to easily integrate this file manager into other programs, and the other major terminal file managers have these options. Realistically, if you want to leave it here, it is good enough as it is since choosefiles
works and selecting the file is just a nice-to-have.