101

This script is no longer necessary; please visit Announcement: Keyboard shortcuts are now integrated into the site for an updated status on this.


Screenshot

screenshot of the keyboard shartcuts help overlay

About

This is the official keyboard shortcuts script for the Stack Exchange sites, as announced on Meta Stack Overflow. It is still in active development, and will eventually move from being a user script to being a full-blown (optional) feature when it is ready for that.

Download

Use one of these two links to install:

After installing (and possibly restarting/refreshing), pressing ? should get you started.

(When installing, remember to disable conflicting keyboard shortcut scripts you may be running.)

Platform

Should work in Chrome, Firefox (with Greasemonkey) and Opera (where you'll have to manually move it to your user script folder). May also work in other browsers; see the tag wiki of the tag.

Contact

Feedback is very encouraged – keyboard shortcuts are a power user feature, so we have to know what those power users actually need. Please leave or vote on feedback on the Meta question.

6
  • Self-updating script eh? I have prior art on that one, but I guess you did help me a teeeny bit :D
    – Benjol
    Commented Sep 1, 2011 at 12:24
  • @Benjol: Er, uhm... Commented Sep 1, 2011 at 14:00
  • @George, ok, I'll share the patent with you both (gist.github.com/874058) :)
    – Benjol
    Commented Sep 1, 2011 at 18:53
  • 1
    I have to press shift+? to get the help in chrome 14
    – Zypher
    Commented Sep 2, 2011 at 15:10
  • 4
    @Zypher that's a joke, no? What keyboard layout has the ? key in normal state?
    – sehe
    Commented Mar 26, 2012 at 17:02
  • Is there any way we could get this for the review screens? Specifically close votes?
    – user18962
    Commented Dec 7, 2013 at 3:02

9 Answers 9

8

Fantastic addition to the site, hands down. I just browsed for half an hour with nothing but the keyboard.

  • Took about 10 minutes to get accustomed to the controls
  • Voting is a snap, and I feel more likely to vote on more answers because I can quickly zip through them without reaching for my mouse
  • Easier to get a comment or answer started

The only suggestion I would have is adding a shortcut for jumping out of the answer/comment textbox without having to tab over to the "post" button. Can be kind of annoying when I accidentally hit "enter".

4

I love keyboard navigation, +1 to infinity for this feature!

I have but one request: I usually open up questions in a new tab, from the newest or active questions pages, for example.

Normally, on Mac, I'd hold down the (command) key while clicking on the link, or use the TAB key to shift focus to the link and use -ENTER to open the link in a new tab.

However, with the keyboard extensions, when a question has been selected (after pressing U, first question for example), there is no link focussed and the -ENTER will not open the question, at all.

Could this be implemented in the keyboard extensions? This probably has to be platform dependant, as the modifier key for Windows and Linux would be different.

6
  • 1
    This works, but we have decided to go with Shift as the modifier key, since there's less of a collision chance. Shift-Enter will open in a new tab (it also works in a few other places, e.g. G Shift-P opens your profile in a new tab).
    – balpha Staff
    Commented Jun 22, 2012 at 13:03
  • Okay, didn't know this. Does the short-cuts help window update if you hold the Shift key down (like Mac menus do)? Note that on Mac (Firefox), the Shift modifier normally means 'new window', not 'new tab', so that's inconsistent with "normal" operations. Commented Jun 22, 2012 at 13:07
  • Actually, with the most recent version of the script, ? doesn't work at all. Commented Jun 22, 2012 at 13:11
  • Regarding the inconsistency -- yes, we decided to live with that, in particular since hardly anybody uses "new window" anymore these days. Regarding ? -- hmm yeah, I must have just broken that. Will fix.
    – balpha Staff
    Commented Jun 22, 2012 at 13:14
  • Fixed, thanks for noting.
    – balpha Staff
    Commented Jun 22, 2012 at 13:20
  • Confirmed, thanks! I now also realize that updating the help window when Shift is pressed won't work as you'd be holding the Shift when opening the popup in the first place (Shift-/ makes ?). Commented Jun 22, 2012 at 13:36
4

When you are viewing a question list that updates via the live question bar ("N question(s) with new activity") and you use the mouse to click and load the new question(s), then the JS model as seen by the keyboard shortcut code is not updated. As a result, the newly loaded questions cannot be navigated over.

Thus, U goes to the question that was top-most before you clicked on the new questions link, and K will not move the question indicator any higher.

6
  • Yeah, at the moment that only works when you load the new questions via the keyboard shorttcut (F). This is on my list, though.
    – balpha Staff
    Commented Jun 24, 2012 at 22:22
  • At least it auto-corrects the next time there are new questions to load and you hit F; the previously unreachable questions are then navigable again as the new items have loaded. Commented Jun 25, 2012 at 9:44
  • For completeness: I fixed this a few days later in bitbucket.org/balpha/se-keyboard-shortcuts/commits/…
    – balpha Staff
    Commented Nov 28, 2013 at 13:45
  • This is still an issue, I am afraid. Commented Nov 28, 2013 at 14:43
  • My bad, now fixed in bitbucket.org/balpha/se-keyboard-shortcuts/commits/….
    – balpha Staff
    Commented Nov 28, 2013 at 16:00
  • Thanks, the new fix indeed works. Clicking on the link now lets you navigate the newer posts too. Commented Nov 28, 2013 at 16:07
3

Using Shift-ENTER opens questions in a new tab.

However, the same does not apply to the other options. Could this be extended to any of the options that load a new page? So, hit i for inbox, then Shift-1 to open the first inbox message in a new tab.

Preferably, I'd still like to see this using the native 'open in new tab' modifier key (CMD on Mac for example), instead of using Shift.

3

After loading newly-posted answers with F they are not navigable with the J and K keys. Only items already loaded with the page are keyboard-navigable.

1
3

I have peculiar issue with script somehow inserting itself into editors on completely unrelated sites. It seems to especially love to wreck WordPress and Basecamp posts.

Here is screenshot from my local WP development site, right after adding new post and switching to code view:

SE hotkeys script in my WordPress

Opera 12.16, Win7x64

1
  • 1
    Confirmed. Workaround: use a separate user script directory for stack sites.
    – fuxia
    Commented Feb 4, 2014 at 19:32
2

Please add a consistent shortcut to reach the (new) review queues.

With consistent I mean one that is there on all sites. Currently, I can go to the review page on Programmers.SE and here on StackApps, where I can type GSR for go to... -> special pages... - review.

But the same option isn't available on MSO or on SO. On SO, the special pages... listing gives me the option to go to suggested edits and flags, MSO has no special pages... option at all. Either my reputation level prevents me from seeing the review option on those sites, or they have been configured differently to alter the keyboard shortcut script's behaviour.

2

Can I get a way to configure which keys do what? I like to have all the most commonly used keys clustered in one place: it's hard to use SO with a drink in my hand if I have to use both hands to do anything.

2

With the new comment format rolled out, comment loading is now broken. C no longer triggers comment loading.

This looks like a conflict with AutoReviewComments - Pro-forma comments for SE, disabling the extension brings back the functionality.

13
  • Yep, I figured that change would break a lot of user scripts, including that one.
    – balpha Staff
    Commented Jul 25, 2014 at 15:57
  • Hmm I was just going to fix this, but I can't even reproduce it. Is it still happening? (FWIW, you weren't the only one reporting this)
    – balpha Staff
    Commented Jul 26, 2014 at 12:17
  • @balpha: absolutely; using this question with a lot of comments as a test subject I cannot get the C key to load the comments nor the add-comment box. Navigating around the question and answers doesn't help. Nor does it work for posts with new comments coming in from the socket. Commented Jul 26, 2014 at 12:53
  • Hmm, works for me. Are you using any other user scripts that may be interfering?
    – balpha Staff
    Commented Jul 26, 2014 at 13:03
  • @balpha: I switched of all other user scripts; Chrome 35 on Mac OS X 10.9, if that makes a difference. Commented Jul 26, 2014 at 13:04
  • @balpha: also doublechecked that I am running version 29 of the script. Further context: this is with using Tampermonkey as well. Commented Jul 26, 2014 at 13:11
  • Weird. The only difference between the two of us is the Chrome version then. I'm on 36. By the way: meta.stackexchange.com/questions/237166/…
    – balpha Staff
    Commented Jul 26, 2014 at 13:27
  • @balpha: ick, no, I am on 36 too, actually. I've lost track of the version changes for Chrome.. Commented Jul 26, 2014 at 13:29
  • @balpha: W000t! About time! :-) But disabling all user scripts, enabling the site pref, and still no comments being loaded. Commented Jul 26, 2014 at 13:32
  • If you select a post and then press "?", does "C" appear in the list of available keys?
    – balpha Staff
    Commented Jul 26, 2014 at 13:33
  • @balpha: progress: I can load them in a privacy window, time to start disabling extensions. C appears in the help listing. Commented Jul 26, 2014 at 13:33
  • @balpha: it's the Pro Forma Comments extension, chrome.google.com/webstore/detail/autoreviewcomments/… Commented Jul 26, 2014 at 13:35
  • Yes, I can confirm the Auto Review script being the culprit. @balpha
    – slhck
    Commented Jul 26, 2014 at 13:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .