nvim-cmp
source for nerdfont icons.
Over 9000 Nerdfont icons, obsolete icons already
excluded.
Includes the news Neovim Nerdfont icon (requires Nerdfont v3.1.0).
Nerdfont completion is triggered via :
, like emojis.
require'cmp'.setup {
sources = {
{ name = 'nerdfont' }
}
}
Due to the large number of icons, these source can cause some lagging. If you
experience such issues, you should tweak the cmp
performance settings (:help cmp-config.performance
).
The dataset (items.lua) can be recreated by running the following command in the shell:
source="https://raw.githubusercontent.com/loichyan/nerdfix/main/src/cached.txt"
echo "return function() return {" > items.lua
echo "$(curl -s "$source" | tail -n+2 | grep -v "obsolete$" | sed 's/(.*) (.*)/\{ word = ":\1"; label = "\\u\2 \1"; insertText = "\\u\2"; filterText =":\1" };/')" >> items.lua
echo "}" >> items.lua
To create the .csv
containing simply names and icons, run:
source="https://raw.githubusercontent.com/loichyan/nerdfix/main/src/cached.txt"
echo "$(curl -s "$source" | grep -v "obsolete$" | sed -E 's/(.*) (.{4,5})/\1;\\u\2/')" > nerdfonts.csv
- Except for Nerdfont icons instead of emojis, this is simply a copy of
hrsh7th/cmp-emoji, so all credit for
this plugin goes to
hsrsh7th
. - Thanks to @loichyan for nerdfix, from where I got the list of nerdfont names and their codepoints.