Syntax Highlighting

Nib highlights syntax automatically — no configuration needed for common languages.

Language detection

Nib picks a language in this order:

  1. Full filename — so files like CMakeLists.txt or Dockerfile, which have no useful extension of their own, still highlight correctly
  2. File extension
  3. Shebang line (for extensionless scripts, e.g. #!/usr/bin/env python)
  4. Falls back to plain text if nothing matches

Supported languages

Nib bundles syntect’s default language set — including Rust, Python, JavaScript, JSON, Markdown, HTML, CSS, C/C++, C#, Go, Java, Ruby, Shell, SQL, XML, YAML, and more — plus ten additional languages converted directly from real, current VS Code/TextMate grammars, which syntect doesn’t ship out of the box:

  • TypeScript
  • Swift
  • Kotlin
  • Zig
  • TOML
  • Dockerfile
  • GraphQL
  • Protocol Buffers
  • CMake
  • Ini

An untitled tab (no filename yet, so nothing to detect a language from) can have its language forced manually via the tab’s right-click “Set File Type” menu — see Tabs & Windows.

Themes

Nib ships all seven color themes bundled with syntect. Preferences lets you pick a separate Dark theme and Light theme, and Nib switches between them automatically based on the Appearance setting (Light / Dark / System) — see Preferences.

Turning highlighting off for large files

Syntax highlighting is on by default and can be toggled off in Preferences. It’s incremental — editing a line only re-tokenizes what changed, not the whole file — but the very first highlight of a large file (or any edit that invalidates the whole cache) is still proportional to file size. Preferences shows a warning about this: for multi-megabyte files, turning highlighting off keeps typing and scrolling smooth at the cost of color.