Skip to content

Conversation

@mmrwoods
Copy link
Member

This allows other plugins or custom functions to be used for devicons,
e.g. for vim-nerdfont let g:fuzzyy_devicon_func = 'nerdfont#find'

Note: vim-nerdfont does not follow the typical pattern for vim plugins
to set a "g:plugin_loaded" variable, and only uses autoloaded functions,
so there is no easy way for fuzzyy to check if it has been loaded.

Technical note: Fuzzyy measures the byte width for a single glyph and
assumes all glyphs returned by the devicon function are the same width
(this is almost certainly true, they should all be in the same Unicode
private use area so should use the same number of bytes in utf8, but
if you run into some weirdness with a custom function, could be this)

@mmrwoods
Copy link
Member Author

@Donaldttt I'm not sure about the name for this option, I went for fuzzyy_devicon_func because it's a function that gets a single devicon glyph, but arguably it should be fuzzyy_devicons_func because it's an option in the devicons script / feature area. Could use fn or function as the suffix, but I went for func just after a quick helpgrep of my own plugins to see what was in use and func seems common for something that gets turned into a Funcref

@Donaldttt
Copy link
Collaborator

I prefer the name fuzzyy_devicons_func, but I think both names are fine and resonable.

@mmrwoods mmrwoods force-pushed the vim-nerdfont-compatibilty branch from d353657 to 86ce348 Compare February 20, 2025 09:58
@mmrwoods mmrwoods changed the title Option to set custom devicon function, e.g. 'nerdfont#find' Allow devicons to be customised (use other nerdfont compatible plugins for glyphs and colors) Feb 20, 2025
Allows other plugins or custom functions to be used for devicons, e.g.
for vim-nerdfont `let g:fuzzyy_devicons_glyph_func = 'nerdfont#find'`

Note: vim-nerdfont does not follow the typical pattern for vim plugins
to set a "g:plugin_loaded" variable, and only uses autoloaded functions,
so there is no easy way for fuzzyy to check if it has been loaded.

Technical note: Fuzzyy measures the byte width for a single glyph and
assumes all glyphs returned by the devicon function are the same width
(this is almost certainly true, they should all be in the same Unicode
private use area so should use the same number of bytes in utf8, but
if you run into some weirdness with a custom function, could be this)
Allows other plugins or custom functions to be used to colorize
devicons, e.g.`let g:fuzzyy_devicons_color_func = 'glyph_palette#apply'`

I wanted this so I could have the same colors in NERDTree and Fuzzyy

Possible TODO: set filetype to allow highlighting of the menu using
syntax matches rather than matchadd(), e.g. `after/syntax/fuzzyy.vim`
(would also allow highlighting to be applied via FileType autocmd).
@mmrwoods mmrwoods force-pushed the vim-nerdfont-compatibilty branch from 86ce348 to 4c0f7db Compare February 20, 2025 10:33
@mmrwoods mmrwoods merged commit 4c5b5fb into main Feb 20, 2025
@mmrwoods mmrwoods deleted the vim-nerdfont-compatibilty branch February 20, 2025 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants