shellnushell

How do you make the nushell prompt text not wrap?


I have just started experimenting with NuShell, and I am wondering how to fix this issue. With my prompt config set as

prompt = "build-string (ansi y) (date format '%I:%M:%S') (ansi reset) ' ' (ansi g) (whoami) '@' (hostname) (ansi reset) ' ' (ansi r) (pwd) (ansi reset) ' '"

I am getting this prompt:

04:50:57 carl
@hp-pavilion
 /home/carl

How can I force the text to stay on one line?


Solution

  • It look like you need to strip the trailing newline from the output of whom and hostname yourself. I don't know if this is the best solution (never heard of NuShell until I saw this question), but this appears to work:

    (whoami | str trim)