Skip to content

Shell

Before we proceed further, I will quickly install my shell next, so I don’t go insane from using bash. Of course, you can use any shell you want.

In this case we’re using nu Just say it: I use rust btw.

Install missing tools

To properly utilize my shell setup, I need to have the following tools available

Set it as default

If you remember correctly, we set the login shell to bash when creating the custom user, so you might wonder why we didn’t directly set it to nu.

Well nushell isn’t POSIX compliant, and neither does it want to be. Therefore running nu as a login shell might not be the absolute best experience you’ll ever have.

Instead, I include a code snippet in my dotfile’s ~/.bash_profile that will let nu take over any interactive shell, while scripts, etc. that expect a POSIX compliant shell can have their way.

~/.bash_profile
if [[ $- == *i* && $(ps --no-header --pid $PPID --format comm) != "nu" && -z ${BASH_EXECUTION_STRING} ]] then
exec nu
fi

Special case for WezTerm

I’m previously used the terminal emulator WezTerm to run WSL. There is a weird behaviour, however, with nushell, where a \n gets inserted above the prompt on every keystroke.

If you look inside ~/.config/nushell/config.nu

~/.config/nushell/config.nu
$env.config.shell_integration.osc133 = ("WEZTERM_PANE" not-in $env)

osc133 is disabled while using WezTerm, mitigating the aformentioned issue.

This works flawlessly in windows, but unfortunately wezterm_pane isn’t automatically set within wsl.

To hack this, i just add an export to my ~/.bashrc, which gets sourced by my dotfiles’ ~/.bash_profile

~/.bashrc
export WEZTERM_PANE=0