#nu #plugin #syntax #highlighting

app nu_plugin_highlight

A nushell plugin for syntax highlighting

9 stable releases

1.1.0+0.90.1 Feb 10, 2024
1.0.7 Nov 5, 2023
1.0.6 Oct 7, 2023
1.0.5 Jul 30, 2023
1.0.1 Jun 29, 2023

#26 in Value formatting

Download history 44/week @ 2023-10-31 13/week @ 2023-11-07 6/week @ 2023-11-14 29/week @ 2023-11-21 31/week @ 2023-11-28 14/week @ 2023-12-05 7/week @ 2023-12-12 11/week @ 2023-12-19 31/week @ 2023-12-26 12/week @ 2024-01-02 10/week @ 2024-01-09 11/week @ 2024-01-16 7/week @ 2024-01-23 21/week @ 2024-01-30 54/week @ 2024-02-06 464/week @ 2024-02-13

546 downloads per month

MIT and maybe CC-PDDC

426 lines


A nushell plugin for syntax highlighting.

Version License


nu-plugin-highlight is a plugin for Nushell that provides syntax highlighting for source code. It uses the syntect library for syntax highlighting and the bat library for easy access to its ready-to-use assets.


The highlight command can be used for syntax highlighting source code. Here are a few examples:

# Highlight a TOML file by its file extension
open Cargo.toml -r | highlight toml

# Highlight a Rust file by programming language name
open src/main.rs | highlight Rust

# Highlight a bash script by inferring the language (the file should start with a shebang)
open example.sh | highlight

# Highlight a TOML file with a different theme
open Cargo.toml -r | highlight toml -t ansi

# List all available themes
highlight --list-themes


  • language <string>: This is an optional parameter that can be used to specify the language or file extension to aid language detection.


  • -h, --help: Display the help message for the highlight command.

  • -t, --theme <string>: The theme used for highlighting.

  • --list-themes: List all possible themes.


The plugin can be configured using the $env.config.plugin.highlight variable.

[!IMPORTANT] The environment variables NU_PLUGIN_HIGHLIGHT_TRUE_COLORS and NU_PLUGIN_HIGHLIGHT_THEME are currently still supported but considered deprecated.

Start using $env.config.plugin.highlight.


Enable or disable true colors (24-bit). By default, this is enabled.

$env.config.plugin.highlight.true_colors = true


Set a theme to use. The default theme depends on the operating system. Use highlight --list-themes | where default == true to see your default theme. Setting this environment variable should allow highlight --list-themes | where id == $env.config.plugin.highlight.theme to result in a single row with your selected theme. If you get no results, you have set an invalid theme.

$env.config.plugin.highlight.theme = ansi

Plugin Installation

Installing and registering the nu-plugin-highlight is a straightforward process. Follow these steps:

  1. Install the plugin from crates.io using cargo:

    cargo install nu_plugin_highlight
  2. Restart your terminal session to ensure the newly installed plugin is recognized.

  3. Find path of your installation:

    which nu_plugin_highlight
  4. Register the plugin with Nushell:

    register path/to/the/plugin/binary

After registering, the plugin is available as part of your set of commands:

help commands | where command_type == "plugin"

Version Numbering

Starting with version v1.1.0, the version number of nu-plugin-highlight incorporates the version number of its dependency, nu-plugin. This is denoted in the format v1.1.0+0.90.1, where v1.1.0 refers to the version of nu-plugin-highlight and 0.90.1 refers to the version of the nu-plugin dependency.


nu_plugin_highlight is licensed under the MIT License. See LICENSE for more information.


~1M SLoC