icons

package
v0.14.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package icons picks a Nerd Font glyph for a file: a folder for a directory, the Go gopher's mark for a .go file, a picture for a PNG.

The glyphs live in the Private Use Area and draw only in a terminal whose font has them - a Nerd Font, or a terminal like Ghostty, Kitty or WezTerm that ships the symbols itself. Everywhere else they are empty boxes, which is why the editor has a setting to turn them off.

Every codepoint here was checked by name against a Nerd Fonts v3 font (glyph names are in each comment). Font Awesome's are the most stable across Nerd Fonts versions, so they carry the categories; the language marks come from the Seti and Devicons sets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All() []rune

All lists every distinct glyph the package can return, for tests that check them against a font.

func Detect added in v0.1.6

func Detect() bool

Detect reports whether the terminal nem is running in can probably draw the icons.

Types

type Icon

type Icon struct {
	Glyph rune
	Class syntax.Class
}

Icon is one glyph and how to colour it.

The colour is a syntax class rather than a colour of its own, so icons take the light or dark palette with everything else instead of adding a palette a theme would have to match.

func For

func For(name string, kind Kind) Icon

For returns the icon for a file called name, given what the caller knows about it. name may be a path; only its last element is looked at.

func ForBuffer

func ForBuffer(name string) Icon

ForBuffer is the icon for a buffer's name: its file's, a folder for a directory listing (named with a trailing separator), and a note for buffers like *scratch* that no file stands behind.

func ForCandidate

func ForCandidate(cand string) Icon

ForCandidate is For for a completion candidate: a path, a directory when it ends in a separator, and "./" for the directory being listed.

type Kind

type Kind int

Kind is what the caller knows about a file beyond its name.

const (
	File Kind = iota
	Dir
	// Parent is the ".." entry, the way up.
	Parent
	Link
	LinkDir
	Exec
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL