TERMINAL CUSTOMIZATION

Basic ways to customize your command line terminal experience...

I use Linux machines at work remotely using the terminal, so I use the command line and Vim a lot. There are ways to use text editors like VS Code for remote development, but I haven't really tried them out yet, and for writing code locally, I just use VS Code (or the Neocities editor) That makes it seem like I'm a little reluctant when it comes to changing work environments. Maybe I am... Or maybe I just think using Vim makes me cool (not true).

Anyway! While looking at a dark screen with colored text on it can be easier on the eyes in the long term, it's hard to pick out important information from a sea of white text! Here's how I change the color of my terminal text:
  1. Locate the .bashrc or the .bash_profile file for your machine. And if you want to customize it, your .vimrc file. Most likely, these are in the root directory, and listed with the command ls -a. Open them up in your preferred text editor.
  2. Decide what you want your command line and Vim experience to be like. I personally end up working really late at night when my eyes are tired, so I made my command line prompts bold and used colors that are easier on my eyes than pure white. My local (Mac) and work (Linux) terminals look like this:

          Since I use Vim, I also wanted features like cursor line, line number, syntax coloring, one tab = four spaces, indenting, and a slightly different background color to show that I'm in Vim. There are many other features for Vim, some of which you can find here, with a bunch of color schemes, vertical cursor lines, keyboard shortcuts (if you don't like the defaults), etc. You can also download custom plug-ins and themes, like I ended up doing, to get this:

          Do note that some settings, i.e. font size, are better set in your terminal emulator! If you don't know what that is, the terminal itself is just an interface that we can interact with our machines with. A terminal emulator is the thing that lets you interact with the terminal/shows you the terminal, in a sense. Sort of like how a Nintendo DS emulator can shows us games, but the emulator isn't the game itself. For a Mac, it's just called "Terminal", but some people prefer XTerm, Yakuake, Kitty, ST, etc.
  3. Customize your terminal text: People do all sorts of things, like customizing the terminal tab names, using an image for the background of their window, making the window transparent, etc. There's decent guides online, but they're all specific to your terminal emulator. If you want to do those, there's definitely guides online for you. I'll show you how to edit the text, which can be done on anything.
          Your .bashrc/.bash_profile files are run at startup. A bash script is basically a list of terminal commands. This means that commands you put into them are run right as you open up the terminal. This is commonly used to edit the $PATH variable to tell your machine where to search for executable commands, and other initialization. If you don't have either of these files, you can make one with the command touch .bashrc or similar, in the root directory.
          The PS1 variable controls the formatting of terminal prompts. I have no idea what PS1 means, but it's definitely not PlayStation One lol. Setting this variable controls the text that is printed. To set it, do something like this: export PS1='\[\e[1;31m\][\u@\h \W]\$ \[\e[1;33m\]'. Broken down, here's what that command means: HOWEVER! This makes all the following text yellow, not just your input text. We need to clear the text formatting after the input text is entered! You can do it like this, in a single line: trap 'echo -ne "\e[0m"' DEBUG or in a couple lines like this:
       debug()
       {
          echo -n $'\e[0;32m'; <- set to whatever formatting you want the terminal output to be
       }
       trap debug DEBUG
    These two do essentially the same thing. Calling the debug trap executes at each command, and resets the following text with the echo -n command.
  4. To get my Vim theme: I use the Gruvbox theme, and installed it with pathogen! You can see the lines involved in the screenshot, at the very bottom. You need to install Pathogen and the theme to begin with. The instructions are in the link, but I'll show you how I did it:
          Install Pathogen by running the command mkdir -p ~/.vim/autoload ~/.vim/bundle && \, then the command curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim.
          Install Gruvbox theme by running the command git clone https://github.com/morhetz/gruvbox.git ~/.vim/bundle/gruvbox.
    Coupled with the last two lines of my .vimrc file, you should have the theme appear whenever you open Vim!
I hope this helped!! Thought it seems easy to figure out now, I remember the first time I tried to customize my stuff and I was confused the whole time... hopefully this gives you a starting point for terminal customization!