gokcehan / lf

Terminal file manager
MIT License
7.5k stars 320 forks source link

There should be an option that mirror's the -F/--classify option for ls #1476

Open gokcehan opened 9 months ago

gokcehan commented 9 months ago

Discussed in https://github.com/gokcehan/lf/discussions/1464

Originally posted by **jmcantrell** October 9, 2023 This is a common (ls, exa, tree, ranger, probably others) option that I think is very helpful when scanning the listing. Depending on the path, a character is appended (with the default foreground color) depending on what the path is: - `@` means symbolic link (or that the file has extended attributes) - `*` means executable - `=` means socket - `|` means named pipe - `>` means door (not sure I've ever encountered this) - `/` means directory This is similar to icons, but a simpler alternative for those that just want a simple classification that's good enough without thinking about font support or every type of file that could be encountered. Please consider this 🙏
joelim-work commented 9 months ago

I am somewhat worried this feature will conflict with truncating long filenames. Given a long directory name foobarbaz..., does the classifier character go before or after the truncation character (e.g. foobarbaz...@~ or foobarbaz...~@)? I am not sure which one is better, but the former approach might result in additional questions, for instance, do you ever allow the classifier character to be chopped off.

Edit: It also makes the default reverse-color cursor look a bit strange, if the classifier character uses the default foreground color.

There is also the question of how necessary this feature is, especially when there are already two different ways (colors and icons) of displaying file types. To add a third one means accepting that the existing methods are lacking in some way.

Regarding font support for icons, there is no obligation to use anything fancy like nerdfonts, and you can just normal ASCII characters:

ln  @
ex  *
so  =
pi  |
di  /

Overall I'm not completely against adding this feature, but I'm also not convinced that it brings enough value to justify introducing additional complexity into the UI code.

gokcehan commented 8 months ago

I think I agree with @joelim-work in that this feature is too similar to icons. To be honest, I never thought about using these characters as icons before. By the way, these could be much better alternatives to what we have as the default icons. I doubt if anyone is using the current default icons, so feel free to send a patch to change the default icons to these ones if it makes sense.