-
Notifications
You must be signed in to change notification settings - Fork 136
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
bug: default icons not working as expected #381
Comments
You want to give all files the same icon, ignoring what we get back from nvim-devicons? For what purpose? If you want you could create a custom column for this. local constants = require("oil.constants")
local FIELD_TYPE = constants.FIELD_TYPE
local FIELD_META = constants.FIELD_META
require("oil.columns").register("simple_icon", {
render = function(entry, conf)
local field_type = entry[FIELD_TYPE]
local meta = entry[FIELD_META]
if field_type == "link" and meta then
if meta.link_stat then
field_type = meta.link_stat.type
end
end
local icon, hl
if field_type == "directory" then
icon = "🚀"
hl = "OilDirIcon"
else
icon = "🚀"
end
return { icon, hl }
end,
parse = function(line, conf) return line:match("^(%S+)%s+(.*)$") end,
}) |
Sorry I literally missed your response, I'll read it asap and eventually continue the conversation or closing the issue. Thanks for your patience 🙏 |
Yeah, if you just want the same icon for all files you can use the snippet I posted above and replace your |
All right, this is working great. I created a new col as suggested keeping the directory option business logic and defaulting files to my favorite icon. I love this simple look and feel. BTW I believe this could be turn into a feature in order to avoid all that "boilerplate", what do you think? Based on my noob understanding I believe that the business logic is already greatly encapsulated here and we could have a new option like in here to override the file icon. Let me know your thoughts! Maybe it's just a dumb idea. In this case feel free to "Close with comment" this issue. Thx again for the plugin and the support! |
I think this is a relatively niche use case; most people either don't want icons or they want the filetype icons provided by the icon plugins. If a larger demand for this appears I'll consider it, but for now I think it's best to leave it as user config. |
Did you check the docs and existing issues?
Neovim version (nvim -v)
v0.9.5
Operating system/version
MacOS 14.4.1 (23E224)
Describe the bug
Hello and thank you for your hard work!
I just started my nvim customization journey and I'm quite new to nvim, lua etc. so I could be definitely wrong.
Based on my understanding I should be able to set the default folder icon and a fallback icon for all those files "not recognized" by NerdFont like follows:
So I would expect to see the rocket icon as folder icon and "unknown" files
If it is just me not understanding how it works I would be happy to understand how I can achieve my goal which is having a custom icon especially for files regardless its extension.
Plus, based on the above my feeling is that
default_file
can be misleading as property name for its "fallback" purpose.I would really love to end up with something like the following:
The base folder icon and the same icon for all kind of files.
Thank you in advance!
What is the severity of this bug?
minor (annoyance)
Steps To Reproduce
Just apply the configuration with custom icons for directory and file
Expected Behavior
Displays the icons when
nvim .
Directory structure
No response
Repro
Did you check the bug with a clean config?
nvim -u repro.lua
using the repro.lua file above.The text was updated successfully, but these errors were encountered: