!NnQHxJZKXmKATWReSC:matrix.org

LF File Manager

27 Members
https://github.com/gokcehan/lf3 Servers

Load older messages


SenderMessageTime
20 Jan 2024
@omniguy:matrix.orgomniguyI also noticed after some tests that both sixels and kitty protocol aren't working, only symbols. 12:27:28
@omniguy:matrix.orgomniguyThe problem seems to be with chafa. Since ctpv also uses it to preview the images, that explains why it shows the same problem. Downgrading to chafa 1.12.4-3 solves the issue 12:39:33
@omniguy:matrix.orgomniguy * The problem seems to be with chafa. Since ctpv also uses it to preview the images, that explains why it shows the same problem. Downgrading to chafa 1.12.4-3 solves the issue in Archlinux. Better open an issue on Chafa's github notifying the problem12:41:10
@max:nymtech.chat@max:nymtech.chat left the room.15:09:26
@omniguy:matrix.orgomniguyFor anyone on ArchLinux that's having problems with the image previewer showing random characters instead of the image, just add the chafa option '--polite on' in your previewer script. 18:20:08
@omniguy:matrix.orgomniguy *

For anyone on ArchLinux that's having problems with the image previewer showing random characters instead of the image, just add the chafa option '--polite on' in your previewer script.

My image previewer function in the previewer script:

image() {
	geometry="$(($2-2))x$3"
    chafa "$1" -f sixels -s "$geometry" --animate false | fold -w 65535
}
18:21:16
@omniguy:matrix.orgomniguy *

For anyone on ArchLinux that's having problems with the image previewer showing random characters instead of the image, just add the chafa option '--polite on' in your previewer script.

My image previewer function in the previewer script:

image() {
	geometry="$(($2-2))x$3"
    chafa "$1" --polite on -f sixels -s "$geometry" --animate false | fold -w 65535
}
18:21:31
2 Mar 2024
@soispha:vhack.euSoispha joined the room.15:01:23
16 Mar 2024
@asynthe:matrix.orgfangsIs anyone running lf + ueberzugpp image preview on nixos?20:09:03
18 Mar 2024
@levietdat:matrix.org@levietdat:matrix.org joined the room.14:17:56
@levietdat:matrix.org@levietdat:matrix.org 14:18:26
@levietdat:matrix.org@levietdat:matrix.org left the room.14:20:33
6 Apr 2024
@subterranean.chick:matrix.orgsubterranean.chick joined the room.04:40:36
8 Apr 2024
@promitheas:matrix.orgpromitheas

Hello all. I've written a command which should add all selected files to my chezmoi source state. From a regular terminal the command is as such: chezmoi add myfile

In my lfrc I have the following:

cmd chezmoi_add %{{
    set -f
    for i in $fx do
        chezmoi add $i
    done
}}

map ac chezmoi_add

However whenever I try to use it on a file I get the following in the bottom left corner of lf:

--: -c: line 4: `              chezmoi add $i'

Can anyone shed some light into what I am doing wrong?

20:03:30
@promitheas:matrix.orgpromitheas *

Hello all. I've written a command which should add all selected files to my chezmoi source state. From a regular terminal the command is as such: chezmoi add myfile

In my lfrc I have the following:

cmd chezmoi_add %{{
    set -f
    for i in $fx do
        chezmoi add $i
    done
}}

map ac chezmoi_add

However whenever I try to use it on a file I get the following in the bottom left corner of lf:

--: -c: line 4: `              chezmoi add $i'

Can anyone shed some light into what I am doing wrong?

EDIT: Figured it out. The solution was to put the do on the next line. This is strange because I had other commands with for loops in them and they worked even when the do was on the same line as the for

20:41:04
@promitheas:matrix.orgpromitheas
In reply to @promitheas:matrix.org

Hello all. I've written a command which should add all selected files to my chezmoi source state. From a regular terminal the command is as such: chezmoi add myfile

In my lfrc I have the following:

cmd chezmoi_add %{{
    set -f
    for i in $fx do
        chezmoi add $i
    done
}}

map ac chezmoi_add

However whenever I try to use it on a file I get the following in the bottom left corner of lf:

--: -c: line 4: `              chezmoi add $i'

Can anyone shed some light into what I am doing wrong?

EDIT: Figured it out. The solution was to put the do on the next line. This is strange because I had other commands with for loops in them and they worked even when the do was on the same line as the for

New question: How can I use the unselect command after my chezmoi add $i line so that once the file is added to chezmoi it is no longer selected?
20:54:59
9 Apr 2024
@soispha:vhack.euSoispha
In reply to @promitheas:matrix.org

Hello all. I've written a command which should add all selected files to my chezmoi source state. From a regular terminal the command is as such: chezmoi add myfile

In my lfrc I have the following:

cmd chezmoi_add %{{
    set -f
    for i in $fx do
        chezmoi add $i
    done
}}

map ac chezmoi_add

However whenever I try to use it on a file I get the following in the bottom left corner of lf:

--: -c: line 4: `              chezmoi add $i'

Can anyone shed some light into what I am doing wrong?

EDIT: Figured it out. The solution was to put the do on the next line. This is strange because I had other commands with for loops in them and they worked even when the do was on the same line as the for

For loops need a semicolon before the do (or a newline, which you used)
05:21:06
@promitheas:matrix.orgpromitheas
In reply to @soispha:vhack.eu
For loops need a semicolon before the do (or a newline, which you used)
I see, but i have other commands with for loops that I made sure to check if they have either a newline or semicolon and they didnt (i updated them after figuring it out just to be safe)
05:38:13
@soispha:vhack.euSoispha
In reply to @promitheas:matrix.org
New question: How can I use the unselect command after my chezmoi add $i line so that once the file is added to chezmoi it is no longer selected?
I think you can just clear ~/.local/share/lf/some_file or some path like that
07:24:48
@promitheas:matrix.orgpromitheas
In reply to @soispha:vhack.eu
I think you can just clear ~/.local/share/lf/some_file or some path like that
Could you please explain that a bit? Do you mean I just add a shell command after adding files to chezmoi, which will delete a certain file? How can I know which is the right file to delete?
16:50:47
@promitheas:matrix.orgpromitheas

Separate question: How can I pass arguments to shell commands? I read through the manual and found the shellopts section, which if I understood it correctly sais that I need to pass them as a string after the shell command. I am extending the open function to edit files with neovim, because somefiles without extensions would open a blank neovim buffer instead of the actual file:

cmd open %{{
	$alacritty '--hold -e nvim' $f
}}

I would like a new window to be created instead of neovim to open within lf, hence why I am trying to spawn an alacritty window which will execute the neovim command.

18:12:56
@soispha:vhack.euSoispha
In reply to @promitheas:matrix.org
Could you please explain that a bit? Do you mean I just add a shell command after adding files to chezmoi, which will delete a certain file? How can I know which is the right file to delete?

Unix ~/.local/share/lf/files
Windows C:\Users<user>\AppData\Local\lf\files

That's the file that contains the current selection. If you delete it in your mapping (rm ...), all files will be unselected

20:25:45
@soispha:vhack.euSoispha* Unix ~/.local/share/lf/files Windows C:\Users<user>\AppData\Local\lf\files That's the file that contains the current selection. If you delete it in your mapping (rm ...), all files will be unselected. (It's in the `Configuration` section of the doc (`lf -doc`)) 20:26:31
@soispha:vhack.euSoispha
In reply to @promitheas:matrix.org

Separate question: How can I pass arguments to shell commands? I read through the manual and found the shellopts section, which if I understood it correctly sais that I need to pass them as a string after the shell command. I am extending the open function to edit files with neovim, because somefiles without extensions would open a blank neovim buffer instead of the actual file:

cmd open %{{
	$alacritty '--hold -e nvim' $f
}}

I would like a new window to be created instead of neovim to open within lf, hence why I am trying to spawn an alacritty window which will execute the neovim command.

Lf should allow you to just write normal shell code in there. So opening a new window should be:

cmd open &{{
alacrity --hold -e "nvim '$f'"
}}
20:29:46
@soispha:vhack.euSoispha(I also changed the '%' to a '&' to allow you to use lf while the window is open, nut sure if you intend lf to be usable or actually wanted to block it until you close the window again)20:31:15
@promitheas:matrix.orgpromitheas
In reply to @soispha:vhack.eu
(I also changed the '%' to a '&' to allow you to use lf while the window is open, nut sure if you intend lf to be usable or actually wanted to block it until you close the window again)

Yes, I missed that about the &.

So far here is what I have. I modified the example from the manual for opening text files based on their mime-type with vi and all other files with xdg-open, and it works sort of. The only issue is that when I exit nvim, the terminal that it was running in remains open until I manually close it.

cmd open &{{
	case $(file --mime-type -Lb $f) in
		text/*)
			parent_pid=$$;
			alacritty --hold -e nvim $f & wait $!;
			kill -9 $parent_pid;;
		*)
			for f in $fx;
				do xdg-open $f > /dev/null 2> /dev/null &
				done;;
	esac
}}

I have a suspicion that kill -9 is not actually working from within the script, because if I run the following command then manually kill the resulting process id it does actually kill it.


kill -9 pid_printed_after_running_in_background
21:53:03
@promitheas:matrix.orgpromitheas
In reply to @soispha:vhack.eu
(I also changed the '%' to a '&' to allow you to use lf while the window is open, nut sure if you intend lf to be usable or actually wanted to block it until you close the window again)
*

Yes, I missed that about the &.

So far here is what I have. I modified the example from the manual for opening text files based on their mime-type with vi and all other files with xdg-open, and it works sort of. The only issue is that when I exit nvim, the terminal that it was running in remains open until I manually close it.

cmd open &{{
	case $(file --mime-type -Lb $f) in
		text/*)
			parent_pid=$$;
			alacritty --hold -e nvim $f & wait $!;
			kill -9 $parent_pid;;
		*)
			for f in $fx;
				do xdg-open $f > /dev/null 2> /dev/null &
				done;;
	esac
}}

I have a suspicion that kill -9 is not actually working from within the script, because if I run the following command then manually kill the resulting process id it does actually kill it.

alacritty --hold -e neofetch

kill -9 pid_printed_after_running_in_background
21:53:32
@promitheas:matrix.orgpromitheas *

Yes, I missed that about the &.

So far here is what I have. I modified the example from the manual for opening text files based on their mime-type with vi and all other files with xdg-open, and it works sort of. The only issue is that when I exit nvim, the terminal that it was running in remains open until I manually close it.

cmd open &{{
	case $(file --mime-type -Lb $f) in
		text/*)
			parent_pid=$$;
			alacritty --hold -e nvim $f & wait $!;
			kill -9 $parent_pid;;
		*)
			for f in $fx;
				do xdg-open $f > /dev/null 2> /dev/null &
				done;;
	esac
}}

I have a suspicion that kill -9 is not actually working from within the script, because if I run the following command then manually kill the resulting process id it does actually kill it.

alacritty --hold -e neofetch &

kill -9 pid_printed_after_running_in_background
21:53:43
10 Apr 2024
@soispha:vhack.euSoispha You should be able to use exec to run nvim, resulting in alacritty's lifetime being tied to neovim's. 05:12:04
20 Apr 2024
@promitheas:matrix.orgpromitheas
In reply to @soispha:vhack.eu
You should be able to use exec to run nvim, resulting in alacritty's lifetime being tied to neovim's.

Just going to post this here in case anyone can use the info. I got it working but not by using exec as that is a shell builtin and as i understand it there are some tricky stuff with calling it from a script(?). Instead I now have this in my lfrc:

cmd open &{{
	case $(file --mime-type -Lb $f) in
		text/*)
			alacritty -e sh -c "nvim \"$fx\"";;
			# parent_pid=$$;
			# alacritty -e nvim $f & wait $!;
			# kill -9 $parent_pid;;
		*)
			for f in $fx;
				do xdg-open $f > /dev/null 2> /dev/null &
				done;;
	esac
}}

I used sh -c to execute the neovim command to open the file (wrapped in double quotes), and the trick to pass the lf variable $fx to it was to properly escape the double quotes.

18:48:27

There are no newer messages yet.


Back to Room ListRoom Version: