The documentation on icons in lf file manager is pretty vague:
first column is filetype or filename pattern
and the example icons file currently states
# file patterns (vim-devicons) (patterns not supported in lf)
so, patterns are not supported in lf as of 2024-07-07.
However, by looking at the source code, we can see that some kind of very basic "pattern" support is present:
func (im iconMap) get(f *file) iconDef {
// ...
if val, ok := im.icons[f.Name()+"*"]; ok {
return val
}
if val, ok := im.icons["*"+f.Name()]; ok {
return val
}
if val, ok := im.icons[filepath.Base(f.Name())+".*"]; ok {
return val
}
if val, ok := im.icons["*"+strings.ToLower(f.ext)]; ok {
return val
}
if val, ok := im.icons["fi"]; ok {
return val
}
return iconWithoutStyle(" ")
}
first, the files are tested for being in one of the "icon categories" of lf, given in the documentation:
ln, or, tw, ow, st, di, pi, so, bd, cd, su, sg, ex
If they are not, then the files are matched against "patterns". Note that this doesn't do any wildcard expansion, but simply matches the keys from the icons file literally with the file name or extension with the character * prepended or appended.
Unfortunately, the conclusion seems to be that configuring icons for all files beginning with a dot based on a pattern is currently (2024-07-07) not possible in lf. At most one could add individual files in the icons file:
.gitignore* π
.vimrc* π
# and so on...
or
*.gitignore π
*.vimrc π
# and so on...
and even that provided they don't fall into one of the categories which are tested for before taking into account the "patterns". For example, if .vimrc is a symbolic link (or executable, etc.), the icon will be that of a symbolic link, etc.
Edit 2024-07-08: Since full pathname match is done before checking if the file belongs to one of the "icon categories" in the linked source code, to override lf assigning the icon from the "icon category" to the file which is a symbolic link (or executable, etc.), pathnames must be specified with absolute path; the pathnames are affected by tilde expansion, however:
~/.bashrc π
~/.vimrc π
# and so on...
ifinstead oflf; possibly because of your earlier mention offiwhich is often used to close anif. My fault, not yours, but I made an edit to clarify in case anyone else has the same dumb problem.