How to get a welcome message in VS Code while using zsh?

How to get a welcome message in VS Code while using zsh?

Whenever I press Ctrl+J to open a terminal in my VS Code, I have always wondered how cool it would be if there was a little animation with a clean little welcome message. Then something popped up in my mind and I thought how about we edit the startup file with some of our own custom code in it?

But before we move on to all of that we need to install a few tools:

  • Figlet - FIGlet is a program for making large letters out of ordinary text and we will be using it as our skeletal tool.

  • Lolcat - Lolcat is essentially a very handy tool to colorize our skeletal text into a rainbow-themed text

Now, to install them -> Go to your zsh terminal and do the following:

  1. sudo apt-get install figlet

  2. git clone https://github.com/busyloop/lolcat

  3. sudo apt-get install rubygems -> Rubygems is a package manager for Ruby programs

  4. gem install lolcat

We have now installed both Figlet as well as Lolcat. Now we need to install different Figlet fonts for more customization. But first we need to go to usr/share directory which can be done like this:

  1. cd /usr/share

The commands below help in installing the new figlet fonts:

  1. git clone https://github.com/xero/figlet-fonts -> If permission denied, prepend the command with sudo -> sudo git clone https://github.com/xero/figlet-fonts

Now we need to move the newly installed fonts into Figlet context which can be done like so:

  1. mv figlet-fonts/* figlet && rm –rf figlet-fonts

There is something called zshrc file and It's basically a script that is run whenever you start zsh. We can add some code in this script which will run everytime the terminal opens up.

We can open this up using the following command:

  1. <your-favourite-text-editor> ~/.zshrc -> Here we need to choose the text editor of our choice. I'm a fan of nano so we can have it like so -> nano ~/.zshrc

Now comes the actual coding part. Trust me it's a bite-sized code that is really simple and let me walk you through it.

  • Go to the bottom of the file

  • In a new line -> type clear

  • Move to the next line

  • Type figlet -f fontname "yourtexthere" -c | lolcat -a -d 1 -> Now what this means is that Figlet will use the font name you provided and -c centers the output horizontally. Further, the -a and -d gives a cool little animation upon terminal bootup for a second.

P.S. I'm using the "Bloody" fontname.

Now, Save your file, Go ahead and restart your terminal. Boom! We have a cool little animation popping up which reads a welcome message every time we start our terminal.

Now that we got it working lets talk about whats happening under the hood, We have a zshrc file which is kind of a middleware layer which runs whenever your terminal boots up or your interactive shell boots up.