OpenShift 3 Tab Completion for Windows

Greetings fellow Microsoft Windows users and developers! If you are not aware, I recently made the switch from OS X to Microsoft Windows and promised to blog about my journey along the way, especially if I found new and exciting tools that I feel will help the OpenShift developer population as a whole. In case you missed my first post that specifies what tools I am using, you can check it out here:

https://blog.openshift.com/getting-productive-with-openshift-on-windows/

One of the readers (Boris Kurktchiev) was kind enough to post a comment suggesting that I try out the Babun shell. I am happy to report that I not only tried it out, but I integrated it with ConEmu to create what I think is a top-notch shell for working with OpenShift and git based projects. In this post, I will explain how I got everything working.

Okay, let’s get started. First of all, what is Babun shell? Well, the creators of the project state that Babun is a Windows shell that you will love. I can’t say that I disagree with them as I do indeed love it so far.

Step 1: Download Babun

The first thing you will want to do is download the shell at http://babun.github.io/ This will download a zip file of the shell on your local file system. Once you extract the zip archive using file install, I suggest you install it using the install.bat file. In my case, I wanted to install it to my C:\babun directory so I executed the following command:

 C:\downloads\Babun\install.bat /t “C:\babun”

Step 2: Integrate it with ConEmu

The default shell application window that ships as part of Babun is a little lacking when it comes to features. I much prefer a terminal that supports tabs, font resizing on the fly, etc etc. If you recall from my first Windows blog post, I truly enjoy using ConEmu. Luckily, it is a pretty easy task to use Babun as the default shell for ConEmu based sessions. To do this, open up the settings window of ConEmu and select Tasks located under the Startup section. This is shown in the following image:

grant-windows-2-1

Click the + sign under the tasks to create a new one. A few things you will want to enter here:

  1. Give the task a name of “Babun”
  2. Enter the following for the task parameters:
    /icon “%userprofile%.babun\cygwin\bin\mintty.exe” /dir “%userprofile%”
  3. Enter the following for the Start section:
    C:\babun.babun\cygwin\bin\mintty.exe – -new_console:a

The last part in section 3 above will start each new console as “Administrator”. If you don’t want to do this, leave the -new_console:a off.

Once complete, it should look like this:

grant-windows-2-2

Perfect! You now have Banbu up and running and integrated with ConEmu.

Step 3: Installing ZSH completions for OpenShift 3

Now that we have ConEmu up and running and configure with Banbu, the next thing we want to do is set our theme and enable OpenShift 3 tab completion. Open up a new ConEmu session and it will drop you in your cygwin home directory.

Pro Tip: If the font size it too small for your liking, a quick way to change it is hold down the control key and use your mouse scroll wheel to enlarge the font.

Edit your .zshrc file with the following command:

  [~]$ vi ~/.zshrc

Look for the following line:

 ZSH_THEME=”babun”

and change it to the following:

 ZSH_THEME=”eastwood”

Okay, you got me there. Why do you have to change it? Well, you don’t. I just personally like the eastwood theme better but you can use whatever theme strikes your fancy.

Exit out of the VI session and enter in the following command to clone the git repository that contains the ZSH tab completion information:

 git clone https://github.com/chmouel/oh-my-zsh-openshift ~/.oh-my-zsh/custom/plugins/oc

After the repository has been cloned, you will need to edit your .zshrc file once more to load the plugin.

 vi ~/.zshrc

Look for the following line:

  plugins=(git)

and change it to:

  plugins=(oc git)

save your changes and create a new shell session to ensure that your .zshrc file is sources properly.

Step 4: Bask in your oc tab completion glory

You now have tab completion working inside of your bright and shiny new shell. Try it out by typing oc lo (and then hit the tab key).

Pretty fancy huh?

Wrapping up

Okay, a few other things you will need to show when using Babun:

To see what shell you are currently using, enter in:

 babun shell

To change your default shell to zsh (bash is also supported)

 babun shell /bin/zsh

To install new packages

 pact 

To install cygwin ports (example bash-completion 2.1)

 pact install bash-completion -m ftp://ftp.cygwinports.org/pub/cygwinports

I have found that installing things when not running as administrator breaks things horribly.

Categories
OpenShift Container Platform, OpenShift Dedicated, OpenShift Online, OpenShift Origin, Products
Tags
, , , , ,
Comments are closed.