Tag: bash ¦ Atom ¦ RSS

My Bash prompt

A few days ago I took the time to finally rewrite the code for my Bash prompt. I had been using the prompt for nearly two years, but the code was fugly and had some problems. Now it runs without problems and is nicer so I can finally share it with the world. You can find the 'trexprompt' in my dotfiles repository on github. It also has a project page on this site with installation and configuration details. The prompt has the following features:

  • Shows the current path, trimmed in the middle for very long paths.
  • Shows the current load and time when last command finished on very wide terminals, right aligned.
  • When inside a Git repository, shows the current branch and state
  • Shows the exit code of the previous command when non-zero
  • Configurable colors (left and right)
  • When no colors are configured, colors will be calculated based on the hostname. So every host will automatically display other colors.

Using your Bash and Vim config on multiple computers

Not long after I switched to Linux I started modifying my .bashrc file. In a .bashrc file you can set options for Bash, add aliases, configure your Bash prompt etc. When I decided to start using Vim as my main editor a few weeks ago, I also started tinkering with the .vimrc file. The .vimrc file is, similar to the .bashrc file, the place-to-be to configure Vim.

Obviously I wanted to share all these config-files between my work machine and my personal computer. That is why I set up a Git repository on my Dreamhost webspace. With most of your important config-files in a Git repository you can easily share your config between multiple computers and you get a history of your modifications as a free bonus.

Because I want to keep it clear which files are in the Git repo and which files are not, I just created a directory in my homedirectory called 'scripts' (so at ~/scripts/). Everything in that directory is in Git, everything outside the directory …