Since I switched to Linux last June (2022), I have been particularly inclined towards using the terminal for almost every developer workflow I know. Using Git, quickly rename files, and quick editing, or install new packages/apps.
My terminal helped me wherever I go.
But I felt something was missing. My default shell (the program which lets you interact with your computer on a terminal by executing commands written by you) was BASH. It's great but it implements key features like Tab completions which is very useful to my workflow, in a pretty weird fashion:
Yup. Tab completions throw every possibility out in the output (stdout). What I wanted was something close to IDE/Text editor like completion menu.
And maintaining it's ~/.bashrc
is nightmare.
What I want is a clean, customizable, yet fast shell, fun to use and improves my productivity.
The Nushell
Then I found Nushell. A new type of Shell written in Rust.
From its config file, conveniently located in ~/.config/nushell
directory everything about Nushell is customizable, from prompt to keybindings, tables, and even external autocompleter.
Nushell in itself is a completely different shell with the idea being it sees data as having some kind of structure to it instead of raw bytes of stream. The fact that it's written in Rust makes it even more appealing to use, plus it's Blazing Fast!!!
Even better about Nushell is that it is cross-platform, it works on Linux, Windows, and Mac.
Bash is not bad, but when it comes to user experience, IMO it fails there. Nushell gave me a completely new experience and fun to use terminal. Although it's not POSIX compliant, it works pretty fine with external commands. Even if a command for Nu clashes with external commands of Bash like, ls
just adding ^
in front calls the external command.
Other than that the config for Nu, is easily accessible in nu
by config nu
is way easier to read.
There are other options as well:
- Z-Shell, good but not in Rust, requires its own plugin manager
- Oh My ZSH, filled with Plugin
- Fish, not POSIX compliant
Again, I might be biased and you might want to try the above options as well.
Getting the Prompt Right
The prompt is what you see as the text to the left (or sometimes even on right), when you open a terminal.
I previously used a script in ~/.bashrc
to customize the prompt and display info such as git branch, python virtual env name or conda environment name with no icons. Again, plain minimalist look.
With Nu setup, I find out there is easier and yet pretty maintainable way to customize the prompt.
Introducing, Starship.
People love to customize it to their liking, and I just wanted a clean minimal look. Starship works not just with Nu, but almost every mainline shell available.
Plus point, again it's written in Rust!
With this I created my prompt which looked something like this:
Pretty Minimalist I guess, hiding every feature :)
External Completions
As of writing, Nu (0.76.0) doesn't support completions for commands outside of nu
and do require an External Completer.
There is an issue regarding this to parse man pages and store the completions in .nu
files since man pages don't really exist on Windows.
For the time being, we can utilize external autocompleters and this time unfortunately it's not Rust :/
But, it's Go! Hey common, Go is also equally good. Even though it has a garbage collector, doesn't mean it's a dumpster fire like Java๐.
Let's introduce Carapace.
Supporting a wide range of default programs you have worked with and new ones like gh
for GitHub CLI and rg
ripgrep is also supported.
Adding it to Nushell or any shell is also pretty straightforward and clearly documented.
If you don't find your CLI program getting autocompletion, please put a PR to the above GitHub page and contribute. Who doesn't love contributions?
And if you find any bugs or have a new feature you want to work on, strike a conversation in the Issues tab of any of the above repositories and contribute however you'd want.
If you want to use my setup for your terminal, the config files and instructions are on GitHub along with Instructions and minor details.
Have fun with your new terminal.
This is Anurag Dhadse, signing off.