mirror of
https://github.com/nushell/nushell
synced 2024-12-27 21:43:09 +00:00
0da9213de6
It would appear that starship needs an environment variable set to output the prompt correctly on a per shell basis.
2.2 KiB
2.2 KiB
How to configure 3rd party prompts
nerdfonts
nerdfonts are not required but they make the presentation much better.
oh-my-posh
If you like oh-my-posh, you can use oh-my-posh with nushell with few steps. It's works great with nushell. There is how to setup oh-my-posh with nushell:
- Install Oh My Posh and download oh-my-posh's themes following guide.
- Download and Install a nerd font.
- Set the PROMPT_COMMAND in ~/.config/nushell/config.nu, change
M365Princess.omp.json
to whatever you like Themes demo.
let-env PROMPT_COMMAND = { oh-my-posh --config ~/.poshthemes/M365Princess.omp.json }
Starship
- Follow the links above and install starship.
- Install nerdfonts depending on your preferences.
- Set the starship shell environment variable to
nu
by running this commendlet-env STARSHIP_SHELL = "nu"
- If you want the default ticking clock with date & time on the right prompt execut this command
hide PROMPT_COMMAND_RIGHT
- If you don't want the default indicator, you can run this command
let-env PROMPT_INDICATOR = " "
- Set starship as your left prompt with this command
let-env PROMPT_COMMAND = { starship prompt --cmd-duration $env.CMD_DURATION_MS --status $env.LAST_EXIT_CODE | str trim }
. Note that you may not have to usestr trim
in the nushell prompt if you disable starship's default newline setting with this entry in the starship.toml fileadd_newline = false
. There have been reports that this might not play nice with nushell prompts. We're still testing. - Since nushell supports a right prompt you can also play around with starship's ability to set a right prompt. Setting the right prompt in nushell is identical to setting the left prompt however you use
PROMPT_COMMAND_RIGHT
.