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
Add statfmt
option
#1288
Add statfmt
option
#1288
Conversation
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.
I'm still on the fence about changing the default, but I guess we can just undo it if people complain.
Thanks!
Thanks @joelim-work for the patch and thanks @ilyagr for the feedback. A few points below:
|
Yes, I'm perfectly fine with this approach, although initially I wanted it to be displayed the same way as :shell-pipe works, i. e. the info string is set to the output of a shell script. I'm not sure if there were any issues with this approach, but whatever works best, any coloring is good to have. |
@Lassebq This might already be possible with the use of
Though I don't think this is usable in practice as it flickers at each change. This is why you usually want to have these things as builtins. |
@gokcehan To answer some of your points:
For the purposes of this PR, I have made the changes you requested, please let me know if there is anything else. |
@joelim-work It looks good, thanks again for the patch. |
…-arm64 (#1298) * Create CI job to run `gen/xbuild.sh`, adjust `xbuild.sh` to make it possible This reworks the gen/xbuild.sh script to exit with a failure if any of the targets don't compile. It also adds a CI job to try cross-compiling for every platform on every pull request. The new check is a little slow and compute-expensive, but I am hoping it's well within the quota. See #1299 for a demo of how the CI would have failed after #1288 and before #1295. Screenshot: https://github.com/gokcehan/lf/assets/4123047/3d7a6b7c-8642-4d4c-a98a-c8b886c0b184 Thanks to @joelim-work for numerous improvements and an alternate implementation I heavily borrowed from (https://github.com/joelim-work/lf/blob/ci/gen/xbuild.sh) * Refactor xbuild.sh some more to decrease repetition I can remove this commit if people prefer. * Generate darwin-arm64 binaries as we have users using it Arm Macs are becoming popular. We have at least one user: #1294. It seems lf works fine there.
@joelim-work I realized with the new
With the new
So it results in a slight misalignment for the size and time. It's not too important, but I think it would be better to keep the alignment. Sometimes it can be useful when you are looking for a difference (e.g. year) by juggling through the file list. I'm aware, it would still not be a perfect alignment since hardlink counts and user/group infos can also be different, though such differences are often rare in practice within the same directory. If you agree, an easy fix is to do this directly in diff --git a/misc.go b/misc.go
index 8199697..f5b0ae5 100644
--- a/misc.go
+++ b/misc.go
@@ -223,7 +223,7 @@ func readPairs(r io.Reader) ([][]string, error) {
// This should be fine for most human beings.
func humanize(size int64) string {
if size < 1000 {
- return fmt.Sprintf("%dB", size)
+ return fmt.Sprintf("%3dB", size)
}
suffix := []string{
@@ -242,7 +242,7 @@ func humanize(size int64) string {
if curr < 10 {
return fmt.Sprintf("%.1f%s", curr-0.0499, s)
} else if curr < 1000 {
- return fmt.Sprintf("%d%s", int(curr), s)
+ return fmt.Sprintf("%3d%s", int(curr), s)
}
curr /= 1000
} |
Hi @gokcehan changing the size to have a width of 4 sounds to maintain alignment sounds fine to me. However I would suggest not changing the diff --git a/ui.go b/ui.go
index 7abe1a7..0520d48 100644
--- a/ui.go
+++ b/ui.go
@@ -742,7 +742,7 @@ func (ui *ui) loadFileInfo(nav *nav) {
replace("%c", linkCount(curr))
replace("%u", userName(curr))
replace("%g", groupName(curr))
- replace("%s", humanize(curr.Size()))
+ replace("%s", fmt.Sprintf("%4s", humanize(curr.Size())))
replace("%t", curr.ModTime().Format(gOpts.timefmt))
replace("%l", curr.linkTarget) Do you think it's better to apply this change to the |
@joelim-work Changing it at the UI level sounds perfectly fine. I also don't mind to see a separate placeholder for this. I agree the default should be the same as before. |
Add a new
fileinfofmt
statfmt
option to customize the file info in the bottom left corner.In addition, I changed the default behaviour so that the file permissions is colored cyan to match the behaviour or
ranger
, this is a breaking change. Let me know if you don't want this and I'm happy to undo the color change.Example:
set statfmt "\033[7;31m %p \033[32m %c \033[33m %u %g \033[34m %s \033[35m %t \033[36m %l \033[0m"