Tags


Do you like this vivid iTerm? It shows the host, the time and the current directory, with optional Git branch, all in different colors.

Want one similar to this? Follow the steps below:

  1. Download iTerm themes from https://github.com/mbadolato/iTerm2-Color-Schemes
  2. Go to iTerm2 >> Preferences >> Profiles >> Color Tab. In the Color Tab look for dropdown Color Presets… and select Import… and import the themes.
  3. Choose a theme of your liking
  4. Download Source Code Pro Font from https://github.com/adobe-fonts/source-code-pro
  5. Open the Font Book.app and load these fonts by clicking the ‘+’ button.
  6. Go to iTerm2 >> Preferences >> Profiles >> Text Tab. In the Text Tab, look for Change Font button and change it to Source Code Pro Font.
  7. Finally we can customize the prompt and make it vivid. Go to http://xta.github.io/HalloweenBash/
  8. Play with it, follow the steps and copy-paste the code in your ~/.bash_profile get your prompt customized. Here is how my ~/.bash_profile prompt customization looks like:
    # for iTerm2
    export CLICOLOR=1
    
    function parse_git_branch {
      git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
    }
    
    # prompt
    # format \[\033[COLOR_CODE_HERE\]PROMPT_ESCAPE_OR_TEXT_HERE\[\033[0m\]
    
    export PS1="\[\033[01;35m\]\h \[\033[01;33m\]\t \[\033[01;32m\]\W \[\033[01;34m\]\$(parse_git_branch)\[\033[0m\] \n \[\033[01;37m\]\# => \[\033[0m\]"
    
Advertisements