Using powerline-shell with csh and older terminal emulators

Its no secret I spend a lot of time customizing my work environment (and more recently my workflow). Apart from the fact that I enjoy it, the other reason is that I suspect my eyes are not going to last forever and I should do whatever I can to make it easier on them. This involves a balance of contrast and brightness. So when I found powerline and then later powerline-shell I could immediately see the advantage it would give me. Instant information about what I need, in sectioned and clearly separated regions.

My previous shell was already colored and segmented, and displayed my username, hostname and full path. It gave me a separation when scrolling up the terminal to see where the command I last entered was, and where stdout started spewing its stuff. However, I decided to up the ante and tried to install powerline on a combo of csh and konsole from Centos5. Pretty darn old version of konsole dating back to 2006, there were a few hiccups but got it to work using the following steps.

  1. Get the powerline fonts from here: Powerline Fonts . You can clone to repo or wget the zip file. Either copy the required fonts into your ~/.fonts directory or use the install script. Make sure you flush the font cache and see if konsole can find your fonts. Now in your konsole settings change the font to a powerlne one, currently I am on Meslo.
  2. Get the powerline shell python scripts from: Powerline Shell . Try to follow the instructions to do the install, but we will need some tweaks for csh.
  3. Make sure your character encoding in konsole is set to utf8. You can do this by going to settings and encoding. Then set these settings as default so that any new konsole window or tab will wake up with these settings (i.e. font and encoding).
  4. We need to slightly tweak the cshell environment. Set the environment variable LC_ALL to the correct locale, for e.g.
     setenv LC_ALL en_US.UTF-8 

    . Make sure this line is in your .cshrc file, otherwise it wont work by setting it once the shell has spawned.

  5. We need to tweak the powerline-shell-base.py to add support for csh style color formatting, this is fairly easy.
    1. Under color_templates list add another entry for csh:
       'csh': '%%{\\e%s%%}' 
    2. Under the arg_parser shell section, in the choices, add an entry for ‘csh’
    3. Under root_indicators add only if you want to:  
       'csh': ' > ' 
  6. Set the prompt in your .cshrc to run this script:
    1.  set prompt = "`~/powerline-shell.py --shell csh`" 
    2.  alias cd 'cd \!*; set prompt = "`~/powerline-shell.py --shell csh`"' 
  7. Profit!!!

powerline