Skip to content

2KAbhishek/nerdy.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

72 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

License People Stars Forks Watches Last Updated

Find Nerd Glyphs Easily πŸ€“πŸ”­

nerdy.nvim in action
nerdy.nvim in action

Do you like Nerd fonts? but don't like going over to their site to fetch a glyph for your pretty terminal? Well, me too!

Introducing nerdy.nvim, a super handy plugin that lets you search, preview and insert all nerd font glyphs straight from neovim!

✨ Features

  • Fuzzy search nerd glyphs, by name and unicode
  • Preview glyphs before inserting
  • Super lightweight
  • Can auto generate new icons from source
  • Get nerd glyph by name programmatically

Setup

⚑ Requirements

  • You have installed the latest version of neovim
  • snacks.nvim picker β€” for prettier select UI

πŸš€ Installation

-- Lazy
{
    '2kabhishek/nerdy.nvim',
    dependencies = {
        'folke/snacks.nvim',
    },
    cmd = 'Nerdy',
},

-- Packer
use '2kabhishek/nerdy.nvim'

πŸ’» Usage

nerdy.nvim adds these commands:

  • Nerdy - Browse all nerd font icons
  • NerdyRecents - Browse recently used icons

You can add your custom bindings for the commands:

vim.keymap.set('n', '<leader>fn', ':Nerdy<CR>', { desc = 'Browse nerd icons' })
vim.keymap.set('n', '<leader>fr', ':NerdyRecents<CR>', { desc = 'Browse recent nerd icons' })

check :help nerdy for more details.

NOTE: By default there are no configured keybindings.

πŸ”­ Telescope Extension

Nerdy also comes with a Telescope extension, to use it add the following to your telescope configs.

require('telescope').load_extension('nerdy')

And then call

:Telescope nerdy
:Telescope nerdy_recent
" or
:lua require('telescope').extensions.nerdy.nerdy()
:lua require('telescope').extensions.nerdy.nerdy_recent()

πŸ“š Recent Icons

Nerdy automatically tracks your recently used icons for quick access:

  • Recent icons are stored persistently across Neovim sessions
  • Access recent icons with :NerdyRecents command or :Telescope nerdy_recent
  • Recent icons appear in order of most recent usage
  • Configure maximum number of recent icons to remember

βš™οΈ Configuration

You can configure nerdy.nvim by calling the setup function:

require('nerdy').setup({
    max_recent = 20,  -- Maximum number of recent icons (default: 30)
})

πŸ“ Get Icons by Name Programmatically

You can also get nerd font icons programmatically using the nerdy.get() function:

local nerdy = require('nerdy')

-- Get a specific icon by name
local lua = nerdy.get('seti-lua')              -- Returns ''
local neovim = nerdy.get('dev-neovim')         -- Returns 'ξ Ί'

-- Handle cases where icon doesn't exist
local unknown_icon = nerdy.get('non-existent') -- Returns '' and shows warning

-- Use in your own functions
local function get_language_icon(language)
    local icon_name = 'md-language_' .. language
    return nerdy.get(icon_name)
end

The function returns an empty string if the icon name is not found or if nil is passed as input. Recent icons are only tracked when using the UI commands (:Nerdy, :NerdyRecents) or Telescope extensions.

πŸ’‘ This is particularly useful when configuring Neovim statuslines, file trees, tab bars, or any plugin that needs consistent nerd font icons without hardcoding Unicode characters.

-- Example: Use in statusline configuration
local function get_git_icon()
    return nerdy.get('dev-git') .. ' '
end

-- Example: Use in nvim-tree or neo-tree configuration
local file_icons = {
    lua = nerdy.get('seti-lua'),
    js = nerdy.get('seti-javascript'),
    py = nerdy.get('seti-python'),
}

πŸ”„ Fetch New Icons

Running the python scripts/generator.py command will automatically fetch new icons from source and update the icons.

Behind The Code

🌈 Inspiration

I love nerd font glyphs, and I use them anywhere I can! but I was wasting a lot of time going back and forth between nerd font site and neovim, also the copy feature was super buggy for me on the site, so I made nerdy!

πŸ’‘ Challenges/Learnings

  • Making the generated icon table with vim.ui.select was a bit tricky.

🧰 Tooling

  • dots2k β€” Dev Environment
  • nvim2k β€” Personalized Editor

πŸ” More Info

  • nerdicons.nvim β€” thanks to the original authors for the groundwork.
  • co-author.nvim β€” Another one of my plugin that lets you add co authors.

⭐ hit the star button if you found this useful ⭐

Source | Blog | Twitter | LinkedIn | More Links | Other Projects

About

Find Nerd Glyphs Easily πŸ€“πŸ”­

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages