Google Chrome does not yet offer customizable keyboard shortcuts. In the mean time, we can use AutoHotKey for setting keyboard shortcuts to common tasks like switching to previous and next tabs, going back and forward in the history, closing and un-doing last closed tab.

Google Chrome & AHK

Update #1: Added code for opening a new tab by pressing CAPS key. This works even if Chrome is not open or not the current active application. If you want CAPS lock to work again, simply press Shift+CAPS. i.e., Shift+CAPS toggles between default functionality of the CAPS lock and tab opening in Chrome.

Update #2: Added Windows key modifier to single keys a, s, z, x, and c

Update # 3: Added shortcuts for paste and go. Details here.

This is what we are going to set:

Key Action
Win+a or F1 Switch to previous tab
Win+s or F2 Switch to next tab
Win+z Go back
Win+x Go forward
Win+c or F4 Close current tab
Win+v Paste and go
Win+Alt+v Paste and go in a new tab
F12 Undo last tab
CAPS Switch to Chrome and create a new tab (If Chrome isn’t already running, it opens Chrome first)

 

and the steps to follow are:

  1. Download AutoHotKey and install it if you don’t have it already.
  2. Save this (or this for Vista) small ChromeShortcuts.ahk file (the contained code can be found at the bottom of this post) and place it anywhere in your computer. Double click this .ahk file.

That’s it. Now you can use all the shortcuts mentioned in the above table while using Google Chrome.

Note: You should remove --no-sandbox from line 33 of the .ahk file if your Chrome has no problems in displaying web pages.

Contents of the ChromeShortcuts.ahk file:

; Reference: ^ = Ctrl, ! = Alt, + = Shift, # = Win
; Source & Credits: http://www.autohotkey.com/forum/viewtopic.php?p=218283, http://lifehacker.com/5046035/tabslock-puts-your-browser-one-keystroke-away
; Relevant blog post: http://www.howtotuts.com/2008/09/05/how-to-set-keyboard-shortcuts-in-chrome/

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance force
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.

#IfWinActive ahk_class Chrome_XPFrame
~#a::Send,^+{Tab}
~#s::Send,^{Tab}
~#z::Send,!{Left}
~#x::Send, !{Right}
~#c::Send, ^{F4}
#v:: Send !d^v{Enter}
!#v:: Send ^t!d^v{Enter}

F1::Send ^+{Tab}
F2::Send ^{Tab}
F4::Send ^{F4}  ;close current tab
F12::Send ^+t ;undoclosetab
#IfWinActive

Capslock::
if WinExist("ahk_class Chrome_XPFrame")
{
	WinActivate
	WinWaitActive
	Send, ^t
}
else
{
	EnvGet, USERPROFILE, USERPROFILE
	Run "%USERPROFILE%\Local Settings\Application Data\Google\Chrome\Application\chrome.exe" --no-sandbox
	WinWait, ahk_class Chrome_XPFrame
	Send, ^t
}
return
+Capslock::Capslock

We hope you found this how-to helpful. Please social bookmark this tutorial and help us and others. Thanks in advance.

Related posts:

  1. How to paste and go in Chrome using keyboard
  2. How to add useful keyboard shortcuts in Firefox using Keyconfig
  3. How to switch tabs in Chrome by using the mouse wheel
  4. How to accelerate bookmarking to delicious from Chrome
  5. How to post to Twitter from Chrome

Related posts brought to you by Yet Another Related Posts Plugin.

Tags: ,

This post has 14 comments.

  1. Mark Martel
    05 Sep 08
    7:27 pm

    Thanks for this really helpful tip. I was really missing my Opera shortcuts in Chrome and with a few tweaks to the .ahk file I had them back. Also, I hadn’t been aware of AutoHotKey and the other cool stuff it could do.

  2. admin
    05 Sep 08
    8:53 pm

    Mark: What changes have you done, if you don’t mind sharing with us?

  3. Mark Martel
    05 Sep 08
    9:22 pm

    After using Opera for a bit a while back, I became addicted to using 1 and 2 to change tabs so I modified your .ahk file as follows:

    #IfWinActive ahk_class Chrome_XPFrame
    ~1::IfNotEqual,A_Cursor,IBeam, Send, ^+{Tab}
    ~2::IfNotEqual,A_Cursor,IBeam, Send, ^{Tab}
    #IfWinActive

  4. admin
    07 Sep 08
    11:31 am

    I’ve modified the script and changed single key presses to a combo of windows key and the single keys. So for example, ‘c’ becomes ‘win+C’ now.

  5. [...] This code is a part of How to set keyboard shortcuts in Chrome script. We hope you found this how-to helpful. Please social bookmark this tutorial and help us and [...]

  6. [...] How to set keyboard shortcuts in Chrome | HowToTuts.com (tags: chrome) [...]

  7. guest
    10 Sep 08
    12:18 pm

    Take a look at the AHK topic. There is hope for single-key shortcuts:

    http://www.autohotkey.com/forum/topic35423.html

  8. [...] convertir a la navegación con teclado en Chrome en algo realmente sencillo. Pueden descargar un script con atajos para Chrome que pueden cargar en AutoHotKey una vez que lo hayan [...]

  9. k9burn
    22 Sep 08
    2:58 pm

    How could you modify this script to map a key to a button on the page (like clicking an “OK” button a page with java script)?

  10. admin
    22 Sep 08
    5:05 pm

    k9burn: You can try using ‘AutoIt3 Window spy’ that comes w/ AutoHotKey to inspect whether the button control has a fixed class (’ClassNN’ value). If it does, it is possible to target it using Control related commands like ‘ControlClick’.

  11. [...] - bookmarked by 4 members originally found by lesterminator on 2008-09-13 How to set keyboard shortcuts in Chrome http://www.howtotuts.com/2008/09/05/how-to-set-keyboard-shortcuts-in-chrome/ - bookmarked by 6 [...]

  12. Igor
    06 Oct 08
    3:14 am

    Hy! How I can simulate right mouse click->letter “v” to save image as…?

  13. Jonathan
    03 Dec 08
    11:51 am

    Btw by replacing “!#v:: Send ^t!d^v{Enter} ” with “!#v:: Send ^c:K3:^t?^v{Enter}” it will copy the selected text and then open a new tab and paste and go. This should cut down on the number of keystrokes even further!

  14. [...] why I was trying hard to find how to setup some keyboard shortcuts for Chrome and I came across this [...]

Close
E-mail It