{"id":13541217,"url":"https://github.com/cptpiepmatz/nu-plugin-highlight","last_synced_at":"2025-10-09T23:36:54.069Z","repository":{"id":177220948,"uuid":"656533259","full_name":"cptpiepmatz/nu-plugin-highlight","owner":"cptpiepmatz","description":"🌈 A nushell plugin for syntax highlighting.","archived":false,"fork":false,"pushed_at":"2025-03-19T14:16:58.000Z","size":175,"stargazers_count":45,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-04T15:56:22.005Z","etag":null,"topics":["highlighting","highlighting-plugin","nu","nushell","plugin","syntax","syntax-highlighting"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cptpiepmatz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-21T06:26:15.000Z","updated_at":"2025-03-29T14:21:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"cc55a38a-74ac-4f18-844a-2b4fa75c3a23","html_url":"https://github.com/cptpiepmatz/nu-plugin-highlight","commit_stats":null,"previous_names":["cptpiepmatz/nu-plugin-highlight"],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cptpiepmatz%2Fnu-plugin-highlight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cptpiepmatz%2Fnu-plugin-highlight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cptpiepmatz%2Fnu-plugin-highlight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cptpiepmatz%2Fnu-plugin-highlight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cptpiepmatz","download_url":"https://codeload.github.com/cptpiepmatz/nu-plugin-highlight/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247208141,"owners_count":20901570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["highlighting","highlighting-plugin","nu","nushell","plugin","syntax","syntax-highlighting"],"created_at":"2024-08-01T10:00:41.799Z","updated_at":"2025-10-09T23:36:49.050Z","avatar_url":"https://github.com/cptpiepmatz.png","language":"Rust","funding_links":[],"categories":["Plugins"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003enu-plugin-highlight\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n  \u003cb\u003e\n    A \u003ca href=\"https://www.nushell.sh\"\u003enushell\u003c/a\u003e \n    \u003ca href=\"https://www.nushell.sh/book/plugins.html\"\u003eplugin\u003c/a\u003e for syntax \n    highlighting.\n  \u003c/b\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n  [![Version](https://img.shields.io/crates/v/nu-plugin-highlight?style=for-the-badge)](https://crates.io/crates/nu-plugin-highlight)\n  [![License](https://img.shields.io/crates/l/nu-plugin-highlight?style=for-the-badge)](https://github.com/cptpiepmatz/nu-plugin-highlight/blob/main/LICENSE)\n\n\u003c/div\u003e\n\n\n## About\n`nu-plugin-highlight` is a plugin for [Nushell](https://www.nushell.sh) that \nprovides syntax highlighting for source code. \nIt uses the [`syntect`](https://crates.io/crates/syntect) library for syntax \nhighlighting and the [`bat`](https://crates.io/crates/bat) library for easy \naccess to its ready-to-use assets.\nCustom themes can be loaded too.\n\n## Usage\nThe `highlight` command can be used for syntax highlighting source code. \nHere are a few examples:\n```nushell\n# Highlight a Markdown file by guessing the type from the pipeline metadata\nopen README.md | highlight\n\n# Highlight a TOML file by its file extension\nopen Cargo.toml -r | echo $in | highlight toml\n\n# Highlight a Rust file by programming language name\nopen src/main.rs | echo $in | highlight Rust\n\n# Highlight a bash script by inferring the language (the file should start with a shebang)\nopen example.sh | echo $in | highlight\n\n# Highlight a TOML file with a different theme\nopen Cargo.toml -r | highlight -t ansi\n\n# List all available themes\nhighlight --list-themes\n```\n\n### Parameters\n- `language \u003cstring\u003e`:\n  This is an optional parameter that can be used to specify the language or file \n  extension to aid language detection.\n\n### Flags\n- `-h, --help`: \n  Display the help message for the highlight command.\n\n- `-t, --theme \u003cstring\u003e`: \n  The theme used for highlighting.\n\n- `--list-themes`: \n  List all possible themes.\n\n## Configuration\nThe plugin can be configured using the \n[`$env.config.plugins.highlight`](https://github.com/nushell/nushell/pull/10955) \nvariable.\n\n### `true_colors`\nEnable or disable true colors (24-bit).\nBy default, this is enabled.\n```nushell\n$env.config.plugins.highlight.true_colors = true\n```\n\n### `theme`\nSet a theme to use.\nThe default theme depends on the operating system.\nUse `highlight --list-themes | where default == true` to see your default theme.\nSetting this environment variable should allow\n`highlight --list-themes | where id == $env.config.plugins.highlight.theme` to \nresult in a single row with your selected theme.\nIf you get no results, you have set an invalid theme.\n```nushell\n$env.config.plugins.highlight.theme = ansi\n```\n\n### `custom_themes`\nSet a directory to load custom themes from.\nUsing `synctect`s theme loader, you can load custom themes in the `.tmtheme` \nformat from a directory that is passed as this configuration value.\n```nushell\n$env.config.plugins.highlight.custom_themes = ~/.nu/highlight/themes\n```\n\n## Plugin Installation\nInstalling and registering the `nu-plugin-highlight` is a straightforward \nprocess. \nFollow these steps:\n\n1. Install the plugin from crates.io using cargo:\n    ```nushell\n    cargo install nu_plugin_highlight\n    ```\n\n2. Restart your terminal session to ensure the newly installed plugin is recognized.\n\n3. Find path of your installation:\n    ```nushell\n    which nu_plugin_highlight\n    ```\n\n4. Register the plugin with Nushell:\n   \n    If you are using a version **lower** than **0.93.0**, use `register` instead of `plugin add`.\n    ```nushell\n    plugin add path/to/the/plugin/binary\n    ```\n\n5. Make the plugin available for use:\n\n   Tip: You can simply restart the shell or terminal. When nushell starts, it loads all plugins.\n\n   If you are using a version **lower** than **0.93.0**, you do **not need** to do this.\n   ```nushell\n   plugin use highlight\n   ```\n\nAfter registering, the plugin is available as part of your set of commands:\n\n```nushell\nhelp commands | where command_type == \"plugin\"\n```\n\n## Version Numbering\nStarting with version `v1.1.0`, the version number of `nu-plugin-highlight` \nincorporates the version number of its dependency, `nu-plugin`. \nThis is denoted in the format `v1.1.0+0.90.1`, where `v1.1.0` refers to the \nversion of `nu-plugin-highlight` and `0.90.1` refers to the version of the \n`nu-plugin` dependency.\n\n## License\n`nu_plugin_highlight` is licensed under the MIT License. \nSee [LICENSE](LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcptpiepmatz%2Fnu-plugin-highlight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcptpiepmatz%2Fnu-plugin-highlight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcptpiepmatz%2Fnu-plugin-highlight/lists"}