Closed is0n closed 2 years ago
Just to make sure i'm understanding, so what you would like to see is if I were in FM's directory tree, press lets say W
for example purposes, it would write whatever file is selected's path to a file that you could then type in? So that file you write to would contain whatever content it had along with the string of where the selected files path is?
Kind of...
fm
command with the selected file's path.E
.fm -selection-path /tmp/tempfile
.Sorry I dont think im following yet. So I would launch fm with fm -selection-path /tmp/tempfile
what file would I assume is being opened to write its path to tempfile?
If fm
is called with -selection-path
followed by a path to a file (the file doesn’t have to exist), then whenever the user opens a file with E
instead of doing something like…
$ $EDITOR /path/to/opened/file
it writes /path/to/opened/file
to the file specified in the command.
Ok I think I am getting it now. So if I open FM fm
with -selection-path
then instead of opening the file with E
it will write that selection-path
to the file that is currently selected. So for example I have a file called test.txt
currently highlighted in the tree, if I press E
, it wont open in the $EDITOR, it will write /path/to/some/file
to it?
Seems good!
Cool, that seems doable, will take a swing at it
@is0n take a look at #59 and let me know if that's what your looking for
Just compiled fm with the new updates and I have found that when opening a file with E
, the opened file gets overwritten with the file path specified in fm --selection-path
.
As mentioned before, the path of the opened file (in the case of the video, those files would be LICENSE
or Makefile
) would be written to the file specified in the command (in the case of the video, that would be /tmp/tempfile
). What happened instead was that /tmp/tempfile
replaced the contents of the opened files.
I would also like to mention that fm should close once it opens a file when --selection-path
is used.
So your saying that the selection-path file should be created, and then the path of the selected file would be written to that newly created file, in your case, /tmp/tempfile
would be created, and the paths would get appended to that file any time you press E
and then each time you press E
, it writes the path and then exits?
So your saying that the selection-path file should be created
The file should only be created after the file is opened, not before so that if no file is opened, there isn't an empty file lying around.
the paths would get appended to that file any time you press E and then each time you press E, it writes the path and then exits?
The path to the opened file would replace the contents of /tmp/tempfile
once E
is used and after that happens, fm would close.
Ok I think I get it now, I’ll take another swing at it
@is0n if you want to give that branch another go I updated it with what I believe to be the correct logic
It works perfectly! I've just updated the plugin to use your file manager.
Awesome! Will cut a release
Lf for example has this feature that instead of opening files, it writes the path of the selected file onto a specified file.
For example, when using this Lf, if
lf -selection-path /tmp/tempfile
is used, then instead of doing something like...when opening a file, it writes the file's path to the file specified after
-selection-path
...This is an excerpt from the
lf --help
...I request this feature as I really like your file manager and would like to use it with my neovim plugin called fm-nvim.