doc: add note to plugin authors to check before calling setup

This commit is contained in:
Alexander Courtis 2024-05-14 09:38:01 +10:00 committed by GitHub
parent cfde423c67
commit 5b1e78d22f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -106,6 +106,20 @@ require'nvim-web-devicons'.setup {
}
```
#### Note To Plugin Authors
Please check that nvim-web-devicons has not already been setup first, to prevent clobbering user's overrides e.g.
```lua
local has_devicons, devicons = pcall(require, "nvim-web-devicons")
if has_devicons then
if not devicons.has_loaded() then
devicons.setup()
end
---
```
### Get Icon
Get the icon for a given file by passing in the `name`, the `extension` and an _optional_ options `table`.