lf
lf copied to clipboard
[Feature request]: Allow arguments to `mark-save`
This issue is solved by the programs current capabilities, however it would still be nice.
~~I want to be able to use the builtin copy command to copy a given file from its absolute path.~~
I've tried the following:
cmd copy-realpath ${{
local origin
origin="$(realpath -- "$fx")"
lf -remote "send $id copy '$origin'"
}}
~~However, when using the builtin copy command, it will either copy the current file selection or it will copy the file that is under the cursor. It would be much easier to allow an argument instead of having to clobber the $XDG_DATA_HOME/lf/files file to get this to work.~~
Editing to say that it would also be nice to have mark-save take an argument by doing something like the following:
lf -remote "send $id mark-save 'a'"
As well as these
cmd ... :{{
mark-save 'a'
mark-load 'a'
mark-remove 'a'
tag 'a'
}}
The reasoning for this is that I would like to create a script that will create a mark for the initial directory that lf is opened in. I tend to use lfcd every time I use lf, and instead of using jump-prev to get back to the opening directory, I'd just like to mark the initial directory and get back to it in 2 keypresses.
I don't fully get what you are trying to do, but I believe this is what you want:
cmd cpath ${{
printf "Add file(s) to clipboard from path: "
read -e cpath
lf -remote "send $id toggle ${cpath}"
lf -remote "send $id copy"
}}
map <some_key> cpath
As for the second part of your post, why don't you just do this?
map <some_key> cd /path/to/directory
This doesn't seem to be an issue with lf though, so it should probably have been asked under discussions instead.
@Joyje Yes that does work. However, allowing arguments to mark-save, etc. would be nice. I'll change the title of the issue.
Editing just to put my exact issue in here:
Right now I am doing this:
map ma mark-save
cmd startup-mark &{{
lf -remote "send $id push ma\""
}}
startup-mark
# lf -remote "send $id mark-save -- [A]"
# lf -remote "send $id mark-save 'A'"
This works on startup most of the time. However, if I open lf and start hitting keys to quickly, my cursor ends up getting caught in the command, causing my cursor to focus on the command line. While not a big issue, it would be nice to allow saving marks like what you are able to do with tag.
To get around this and use commands that don't take arguments like they do take arguments, you could just create a bunch of keybindings that you wouldn't use. Like, map @@__1 cmd1 .. etc. and then just use the method above.
If I have time, I will try to implement some of the things I want and make pull requests.