Thursday, November 3, 2011

Spruce up your Terminal

It's very annoying when mouse doesn't work inside Vim in Mac's Terminal and when Cmd + 1-9 doesn't work while switching tabs. With some googling here are simple steps for making these things work.

The first thing you need to install in SIMBL - (SIMple Bundle Loader) - pronounced like "symbol" or "cymbal" - enables hacks and plugins. Download it from Unzip it and use the .pkg installer.

Next step is to get the required plugins. Most of the plugins come with installer but it's easy to do it yourself.  Plugins can be copied to /Library/Application Support/SIMBL/Plugins for all users or ~/Library/Application Support/SIMBL/Plugins for just your account.

Using MouseTerm Plugin -
MouseTerm is a SIMBL plugin for Mac OS X's that passes mouse events to the terminal, allowing you to use mouse shortcuts within applications that support them.
Download .dmg file from
Run Install and restart Terminal app.  To enable mouse for all events inside vim, add this to your .vimrc file
if has("mouse")
   set mouse = a
To check other information and possible values run :help inside vim.

Switching between tabs using cmd + 1-9
cmd + 1-9 lets you switch between different windows, but if you like to work with multiple tabs instead, you can change the behavior of this key combination using TerminalTabSwitching plugin.
Download it here.
Extract it in ~/Library/Application Support/SIMBL/Plugins

Changing bash prompt - 
To customize your bash prompt, you can refer to this post

Adding colors to bash prompt - 
Good explanation on how to add colors to bash prompt can be found here.

Adding git branch to bash prompt - 
This is really helpful, if you work with many branches in git. I have covered this in my earlier post.

Just a quick note, mouse events and tab switching works by default in iTerm 3 and it also supports many more features such as vertical / horizontal splits etc. Give it a shot. 

No comments:

Post a Comment