Archive for April, 2012

How to bind caps lock key to escape key on Windows using AutoHotKey for Vim only

Here’s another Vim tip that I find very handy. When using gVim on Windows, I can bind the escape key to caplock, but only for Vim. This method relies on using AutoHotKey, an excellent tool.

First install AutoHotKey

Once installed, right click the AutoHotKey icon in the system tray and select “Edit This Script”.

A text editor will open, with the default script that executes when AutoHotKey is running.

Add the following code snippet to the end of the script:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
classname = ""
keystate = ""</code>
 
*Capslock::
WinGetClass, classname, A
if (classname = "Vim")
{
SetCapsLockState, Off
Send, {ESC}
}
else
{
GetKeyState, keystate, CapsLock, T
if (keystate = "D")
SetCapsLockState, Off
else
SetCapsLockState, On
return
}
return

AutoHotKey is designed to run in the background. When Vim is running, a capslock key press will operate in an identical manner to an escape key press. Even better is the fact that the capslock status for Windows does not change when Vim is in focus.

Enjoy!

No Comments

How To Fix Grub2 Error 17 after a FakeRaid Ubuntu Reinstall

I had a problem some ago after installing Ubuntu on a RAID array, my computer would not boot and displayed a Grub Error 17.

Here are some of the links that helped me to fix the problem:

http://ubuntuforums.org/showthread.php?t=1574765

https://help.ubuntu.com/community/RecoveringUbuntuAfterInstallingWindows

http://ubuntuforums.org/showthread.php?t=1559762

had an error 17

had to rebuild the boot partition & then reinstalling grub2

http://grub.enbug.org/Grub2LiveCdInstallGuide

put in livecd 10.4

mnt drives with \dev\mapper\nvide3gegj0 <-- number at end chroot grub install pc might fail if so, then apt-get -update to update repository listings. then install dp installer

No Comments