https://github.com/chrisgrieser/cmp-nerdfont
nvim-cmp source for nerdfont icons
https://github.com/chrisgrieser/cmp-nerdfont
nerdfont nvim-cmp
Last synced: about 1 month ago
JSON representation
nvim-cmp source for nerdfont icons
- Host: GitHub
- URL: https://github.com/chrisgrieser/cmp-nerdfont
- Owner: chrisgrieser
- Created: 2022-10-12T18:50:52.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-27T15:59:33.000Z (5 months ago)
- Last Synced: 2025-03-17T22:19:38.144Z (about 1 month ago)
- Topics: nerdfont, nvim-cmp
- Language: Lua
- Homepage:
- Size: 810 KB
- Stars: 50
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cmp-nerdfont
`nvim-cmp` source for [nerdfont icons](https://www.nerdfonts.com/cheat-sheet).
Over 9000 Nerdfont icons, [obsolete icons already
excluded](https://www.reddit.com/r/neovim/comments/122f5ro/announcing_nerdfix_a_checker_for_obsolete_nerd/).
Includes the news Neovim Nerdfont icon (requires Nerdfont v3.1.0).## Usage
Nerdfont completion is triggered via `:`, like emojis.## Setup
```lua
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](./lua/cmp_nerdfont/items.lua)) can be recreated by
running the following command in the shell:```bash
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:
```bash
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
- Except for Nerdfont icons instead of emojis, this is simply a copy of
[hrsh7th/cmp-emoji](https://github.com/hrsh7th/cmp-emoji), so all credit for
this plugin goes to `hsrsh7th`.
- Thanks to
[@loichyan](https://www.reddit.com/r/neovim/comments/122f5ro/announcing_nerdfix_a_checker_for_obsolete_nerd/)
for [nerdfix](https://github.com/loichyan/nerdfix), from where I got the [list
of nerdfont names and their
codepoints](https://github.com/loichyan/nerdfix/blob/main/src/cached.txt).