How to bind the Windows key to the Escape key in Vim for Ubuntu

Here’s a nice tip I’ve just discovered when using Vim on the Ubuntu OS on a computer equipped with a windows keyboard. Most PC keyboards have Windows specific keys on their bottom row, such as the Windows start menu key and the context menu key.

With the default key bindings in Vim, it can be a pain to reach up to hit the escape key to exit insert mode.

I discovered that you can bind the Windows key at the bottom row of the keyboard to act as the escape key.

To do this, you need to edit your ~.bashrc file and add the following line:

xmodmap -e “keysym Super_L = Escape”

The changes will come into effect once you restart your terminal. Then you’re good to go.

There are many alternative keybindings, and I was wary of swapping the escape and caps lock key bindings because of unintended side effects.

I had previously mapped typing jj to exit from insert mode by adding the following to my .vimrc file

:imap jj

After about a year of using jj I wanted to use something quicker and the windows key binding above was my solution.

Happy Vimming!

No Comments

Allow Selenium Webdriver C# tests to accept javascript popup alerts

I have been writing Selenium webdriver powered tests for over a year, as part of a suit of acceptance tests, and I was looking to prevent a test from failing when a JavaScript pop up alert interrupted the tests completion.

I found the non C# solution blogged but I’ve written the code in C# below:

1
WebDriver.SwitchTo().Alert().Accept();

,

No Comments

Livenation 3.0 site launched!

After over half a year of effort, the site I have been working on was officially announced this week. The site, www.livenation.co.uk is now at version 3 and was put into production last Tuesday. The project started some time before I joined the company, and it’s been a great experience to work with a such a skilled team.
I’m looking forward to further interesting projects the year will bring!

1 Comment