Skip to content

chrisgrieser/cmp-nerdfont

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cmp-nerdfont

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).

Usage

Nerdfont completion is triggered via :, like emojis.

Setup

require'cmp'.setup {
  sources = {
    { name = 'nerdfont' }
  }
}

Performance

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).

Source Nerdfont icons

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

Credits