2012-01-22, Sun

How to remap Capslock to Escape on Asus Transformer TF-101

I’ve been wanting to be able to do some VIM + terminal work on my Asus Eee Pad Transformer TF-101 especially since it’s got the keyboard dock. One of the biggest annoyances is how they’ve replaced the ESCAPE key with the android BACK key, which is a pain when you try to use VIM.

In this short guide, we will instead map the less-than-useless CAPS LOCK key to ESCAPE.

A few pre-requisites:

  • Your TF-101 needs to be rooted
  • You need to install Terminal IDE
  • So far, this has only been tested on Android 3.2.1.

Before we begin, find out what what language you’re using for your ASUS keyboard by going through Settings → Language & Input → Current input method. Among other options, mine says ASUS English (UK) Keyboard (ASUS keyboard).

This means I’ll be working with the locale code en_GB. If yours says something like ASUS English (US) Keyboard (ASUS keyboard), your locale code should be en_US. Just bear this in mind for now, we will be needing this piece of information shortly.

Fire up the Terminal IDE app. If you haven’t already, click on Install System in the app to get the terminal system set up. Next, go through the Options → ESC Key and select Left Alt key. Once that is done, proceed to select Terminal IDE. This will bring up a shell for you to work on.

We’re going to be making some changes to some system files, namely:

    /system/usr/xt9/keylayout/qwerty-[locale code].kl

Before we can do that, we’ll need to get into superuser mode and remount the /system folder as read write. Type the following in the Terminal IDE console:

    mount -o remount,rw /system

Next we’ll cd into the /system/usr/keylayout folder make a backup of asusec.kl and proceed to edit it. (I’m assuming you know vi. Why else would you want to remap Caps to Esc?).

    cd /system/usr/keylayout
    cp asusec.kl asusec.kl.orig
    vi asusec.kl

Look for the line that says:

    key 58    CAPS_LOCK        WAKE UNLOCK

Edit it so that it looks like this:

    key 58    ESCAPE           WAKE UNLOCK

Save and quit.

Next we’ll backup and edit the /system/usr/xt9/keylayout/qwerty-[locale code].kl

    cd /system/usr/xt9/keylayout
    cp qwerty-en_GB.kl qwerty-en_GB.kl.orig
    vi qwerty-en_GB.kl

Same deal. Look for the line with CAPS_LOCK and replace it with ESCAPE. Save and quit.

Now reboot your Transformer, and take your new CAPS LOCK turned ESCAPE key for a spin.

Original solution: http://forum.xda-developers.com/showthread.php?t=1144204

Isaac Su

Comment [1]


2011-11-21, Mon

Common Vim operations in Emacs

Join Line

Vim J
Emacs M-^ (or M-x join-line)

Cut whole line

Vim V d
Emacs C-a C-k


Vim u
Emacs C-_
Isaac Su

tags: emacs vim



2011-11-04, Fri

VIM lagging and causing network I/O when moving within a file

Recently, whenever I edit a file in VIM over a samba share or an SSH mapped drive in Windows, there is a noticeable delay as well as an I/O event over the network.

At first, I was advised that it could be VIM writing to the file’s corresponding swap file over the network. I checked that setting, instructed VIM to write swap files to a local folder, and yet the delay and I/O still ensued.

So I went through my VIM plugin files, removing them all, and adding them back one by one. I finally found the culprit in vim-fugitive, a VIM plugin that provides GIT functionality from within VIM. Since I wasn’t using it very much, I disabled it. The lags and IO events disappeared.

For some reason, vim-fugitive seems to read from the opened file every time I move around the buffer.

So there you go, if you find some mysterious lag in your cursor movement, it could be vim-fugitive or some other plugin.

Isaac Su

tags: delay lagging network plugins samba share ssh vim vim-fugitive

Comment [1]


2011-10-16, Sun

How to remap your capslock key to esc key in ubuntu linux

For all vi/vim users out there, here’s how you can remap the CAPSLOCK key and replace it with the ESC key in your linux Xwindows environment.

First Add the following lines of text to your ~/.Xmodmap file1:

    !! No Caps Lock
    clear lock
    !! Make Caps_lock an escape key.
    keycode 0x42 = Escape

Second In your terminal, type the following command:

    xmodmap ~/.Xmodmap

Your CAPSLOCK key is now remapped to the ESC key.

XWindows loads the ~/.Xmodmap file every time it starts, so you won’t have to keep typing the second command.

If you plug/unplug your USB keyboard, or dock/undock your laptop, XWindows may “forget” that mapping. You may need to repeat the second step in a terminal to restore the key mapping functionality.

I’ve tested it in Ubuntu, but it should work just the same for Fedora, RedHat, CentOS, Debian, openSUSE and pretty much anything that runs XWindows.

1 ~/ stands for your home folder. For example, if I type cd ~/ in my terminal, it takes me to /home/isaac/

Isaac Su

tags: capslock esc escape fedora key keyboard linux ubuntu vi vim xmodmap xwindows

Comment [3]


2011-09-29, Thu

jQuery Validation not working in Internet Explorer

jQuery Validation plugin was working fine in Firefox and Chrome, but it wouldn’t validate my form in IE7 or IE8 when I submit it.

What’s even more odd is that in both versions Internet Explorer, the validation error labels still come up when fields lose their focus, but it still allows the form submission to go through. In other words, it’s not blocking a form that fails validation from getting submitted.

When you pair jQuery Validator 1.8.0 or 1.7 or lower with anything less than jQuery 1.6, it WILL NOT WORK in Internet Explorer. You have two options.

  1. Upgrade your jQuery Validator to 1.8.1 or higher, or
  2. Downgrade your jQuery library to 1.5.2 or lower

For my case, the solution was ridiculously simple, hopefully you’ll be able to read this post and not waste as much time as I did.

Solution found here: jquery-validation Issue #105

Isaac Su

tags: form ie internet-explorer jquery submit validate validator

Comment [2]


« Older Newer »