Oh-my-bash shell enhancement with nerd fonts

I use oh-my-zsh on my other systems and there is a oh-my-bash equivalent for bash. We will install that and some Nerd Fonts that work well with the custom prompts in oh-my-bash.

First, let’s install a Nerd Font. I like the FiraCode font, but pick whatever you prefer.
Nerd Fonts

  • Once downloaded to Desktop, unzip the file.
  • mkdir ~/config/non-packaged/data/fonts/ttfonts
  • copy the downloaded .ttf fonts to that directory
  • in Terminal settings, change the font to use the Nerd Font that was installed
  • optionally, launch the Appearance Preferences app and change fonts to use the Nerd Font.

Now let’s install oh-my-bash from:
github-oh-my-bash

With BeOS it’s considered bad practice to pollute the $HOME directory with unixy dotfiles. As such, we will store these files in the Terminal config settings area (/boot/home/config/settings/Terminal).

To install oh-my-bash, run the following command from a Haiku terminal:

export OSH="/boot/home/config/settings/Terminal/oh-my-bash"; bash -c “$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh)”

Move the .bashrc file that was created by the installer into the Terminal config settings folder:

mv /boot/home/.bashrc /boot/home/config/settings/Terminal

Edit the .bashrc file to select your theme. I like the powerline-multiline theme:

  • change OSH_THEME to powerline-multiline

Now we need to create a new terminal profile to augment the system default profile. Optionally, one can also run the neofetch command (available via HaikuDepot) which is nice to see when a new terminal is opened:

Create /boot/home/config/settings/profile and edit to contain:

neofetch
source /boot/home/config/settings/Terminal/.bashrc

That’s it. When you create a new terminal window, you should have the themed prompt.

Now open a new terminal to see your new prompt. cd into a git cloned repository to see how the prompt reflects the current git status.

11 Likes

On Haiku we dont like to litter the $HOME directory with unixy dotfiles, it is a bad practice and it is basically a hack.

3 Likes

Haiku isn’t an unix-like, too? Aslo I dont see why you think the concept of dotfiles is a hack, especially when we are talking about non-GUI applications…

As this was already discussed here and at other websites too please use your preferred web-search engine to find the related forum threads and articles.

For me, then needs of the one outweigh the needs of the many. LOL. I find a customized bash prompt very useful and it was a simple install. Sure, adhering to the core principles of BeOS are important, but getting more people using it is also important.

2 Likes

It is probably possible to adjust the install scripts to support Haiku and its phylosophy regarding the settings file locations / naming and upstream the modifications so Haikunauts can enjoy it while keeping their $HOME clean and tidy. Would you do it?

4 Likes

will do… I’ll update my original post and post a reply to the thread when finished. :+1:

2 Likes

Ok, thanks to extrowerk for pointing out that in BeOS one should try to keep the home directory free of dotfile cruft. I’m new to BeOS, and I like that approach. As such, I updated my original post to move such files into the config settings area, specifically into the Terminal folder as this is all Terminal related. Cheers.

4 Likes

Great, thanks!

1 Like

screenshots please??

That install.sh has #!/usr/bin/env bash as shebang. That doesn’t work on Haiku. I suggest to do

wget https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh

Then edit install.sh to use #!/bin/sh in the first line instead. Make install.sh executable and:

export OSH="/boot/home/config/settings/Terminal/oh-my-bash"; install.sh

I also had to uncomment DISABLE_AUTO_TITLE="true" in /boot/home/config/settings/Terminal/.bashrc as the Terminal updates the window title with the current directory anyways.

I still have to use it a bit before coming to a conclusion, but the thing showing git branch and if it’s dirty should be nice. Thanks for making me aware of it!

You find screesnhots of the various themes at Themes · ohmybash/oh-my-bash Wiki · GitHub

haiku should support this IMO. File a bug report?

/usr/bin/ is rewritten to /bin/ by runtime_loader for some time now. Do we not have an env command? Because otherwise that should work fine.

I just re-tried and apparently #!/usr/bin env does work after all. No idea what went wrong the first time, but I did see an error pertaining to the shebang…
I stroke those lines from my comment further up. Mea culpa.

Can the difference be the reason?

the original ls tool had a shortcut to hiding the special files . and … by only checking if the file starts with a dot.

Haikus tracker does not respect this convention at all, we also have a proper configuration dir you can discover. On FreeBSD there is also a proper fs flag to hide files, so it isn’t “universally” unixy.

Also in my opinion configuration files just shouldn’t be hidden in the first place.

On linux there is now also the xdg config dir one is supposed to use instead of the home dir.

3 Likes

Also in regards to shebang, a nice to know is that on haiku #!bash is completely sufficient if you want bash.
We also split the arguments by whitespace and don’t shove them all into the first arg, so you can easily use commands with severall arguments too and don’t have to use env at all.

Hello… ya, I had no issues or errors while installing on R4. Definitely need to have a Nerd Font installed for some themes. But ya, I like it showing my git status. I was going to setup zsh and oh-my-zsh on Haiku, but it appears that bash is pretty much the preferred shell on this system, and it’s working fine for me. cheers.

#!/usr/bin/env bash is what’s in the original install.sh and it works unmodified in Haiku. As I said, no idea what went wrong on my forst try…

I’m running with the powerline-multiline theme, and I mostly like it, apart from the delayed startup when entering into a big git-repo like Haiku and the difficult to see red text…

One issue though: I use aliases in git’s “config”:

[alias]
	st = status -s
	re = remote -v
	ci = commit -a
	co = checkout
	br = branch

All work nicely, but “git br” doesn’t just print all branches to the current prompt, but clears the screen and shows the branches with a (END) in the last line. I have to enter ‘Q’ to get back to my prompt. Kinda like displaying something with ‘less’.

I have commented out all aliases in .bashrc.
Any idea what’s messing things up here?