Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add real Nushell syntax highlighting support #1078

Merged
merged 9 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: Update docs
  • Loading branch information
hustcer committed Oct 2, 2023
commit 11c2c5c214201c0f0a37566b3235bb6a10e2ef3b
6 changes: 3 additions & 3 deletions book/3rdpartyprompts.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ If you like [oh-my-posh](https://ohmyposh.dev/), you can use oh-my-posh with Nus
3. Generate the .oh-my-posh.nu file. By default it will be generated to your home directory. You can use `--config` to specify a theme, other wise, oh-my-posh comes with a default theme.
4. Initialize oh-my-posh prompt by adding in ~/.config/nushell/config.nu(or the path output by `$nu.config-path`) to source ~/.oh-my-posh.nu.

```shell
```nu
# Generate the .oh-my-posh.nu file
> oh-my-posh init nu --config ~/.poshthemes/M365Princess.omp.json
> oh-my-posh init nu --config ~/.poshthemes/M365Princess.omp.json

# Initialize oh-my-posh.nu at shell startup by adding this line in your config.nu file
> source ~/.oh-my-posh.nu
Expand All @@ -35,7 +35,7 @@ For MacOS users:
2. Download and install a [nerd font](https://github.com/ryanoasis/nerd-fonts).
3. Set the PROMPT_COMMAND in the file output by `$nu.config-path`, here is a code snippet:

```shell
```nu
let posh_dir = (brew --prefix oh-my-posh | str trim)
let posh_theme = $'($posh_dir)/share/oh-my-posh/themes/'
# Change the theme names to: zash/space/robbyrussel/powerline/powerlevel10k_lean/
Expand Down
24 changes: 12 additions & 12 deletions book/coloring_and_theming.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Many parts of Nushell's interface can have their color customized. All of these

Table borders are controlled by the `$env.config.table.mode` setting in `config.nu`. Here is an example:

```shell
```nu
> $env.config = {
table: {
mode: rounded
Expand Down Expand Up @@ -268,7 +268,7 @@ This is the current list of primitives. Not all of these are configurable. The c

Here's a small example of changing some of these values.

```shell
```nu
> let config = {
color_config: {
separator: purple
Expand All @@ -293,7 +293,7 @@ Here's a small example of changing some of these values.

Here's another small example using multiple color syntaxes with some comments.

```shell
```nu
> let config = {
color_config: {
separator: "#88b719" # this sets only the foreground color like PR #486
Expand Down Expand Up @@ -347,7 +347,7 @@ Here's the current list of flat shapes.

Here's a small example of how to apply color to these items. Anything not specified will receive the default color.

```shell
```nu
> $env.config = {
color_config: {
shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b}
Expand All @@ -371,13 +371,13 @@ The Nushell prompt is configurable through these environment variables and confi

Example: For a simple prompt one could do this. Note that `PROMPT_COMMAND` requires a `block` whereas the others require a `string`.

```shell
```nu
> $env.PROMPT_COMMAND = { build-string (date now | date format '%m/%d/%Y %I:%M:%S%.3f') ': ' (pwd | path basename) }
```

If you don't like the default `PROMPT_INDICATOR` you could change it like this.

```shell
```nu
> $env.PROMPT_INDICATOR = "> "
```

Expand All @@ -400,13 +400,13 @@ Each of the `PROMPT_*` variables has a corresponding `TRANSIENT_PROMPT_*` variab

For example, if you want to make past prompts show up without a left prompt entirely and leave only the indicator, you can use:

```shell
```nu
> $env.TRANSIENT_PROMPT_COMMAND = ""
```

If you want to go back to the normal left prompt, you'll have to unset `TRANSIENT_PROMPT_COMMAND`:

```shell
```nu
> hide-env TRANSIENT_PROMPT_COMMAND
```

Expand All @@ -430,7 +430,7 @@ Theming combines all the coloring above. Here's a quick example of one we put to

The key to making theming work is to make sure you specify all themes and colors you're going to use in the `config.nu` file _before_ you declare the `let config = ` line.

```shell
```nu
# let's define some colors

let base00 = "#181818" # Default Background
Expand Down Expand Up @@ -516,7 +516,7 @@ if you want to go full-tilt on theming, you'll want to theme all the items I men

Nushell's default config file contains a light theme definition, if you are working on a light background terminal, you can apply the light theme easily.

```shell
```nu
# in $nu.config-path
$env.config = {
...
Expand All @@ -527,7 +527,7 @@ $env.config = {

You can just change it to light theme by replacing `$dark_theme` to `$light_theme`

```shell
```nu
# in $nu.config-path
$env.config = {
...
Expand All @@ -540,7 +540,7 @@ $env.config = {

It's often desired to have the minimum amount of decorations when using a screen reader. In those cases, it's possible to disable borders and other decorations for both table and errors with the following options:

```shell
```nu
# in $nu.config-path
$env.config = {
...
Expand Down
Loading
Loading