113

Please visit Announcement: Keyboard shortcuts are now integrated into the site for an updated status on this.


Blast from the past: Add keyboard shortcuts to Stack Overflow was posted in September 2009. You might have noticed that that post was recently retagged – we're working on it.

Since keyboard shortcuts are definitely a power user feature, we have decided to go about this project in a slightly different way than usual. The keyboard shortcuts will begin their life as a user script for people to try out and give feedback, so we can refine it together, until we consider it ready enough to be added to the core engine.

There is now a version for you to try out, play with, and answer the following questions:

  • Does it work for you? What does, what doesn't?
  • What additional actions are unquestionably in need of keyboard shortcuts? There's just a selection currently, so what more is important?

Remember, this is for the tiny percentage of people who would rather use the keyboard than the mouse to make their life easier and faster – so what should be done to achieve that?

keyboard shortcuts

Since this is very much work in progress, there is a version of the user script that checks for an updated version every twelve hours* and gives you a link to click and update. If you don't want this, there's also a version without this check.

*Note that it uses the localStorage to store the time of the last update check, so it's actually every twelve hours per SE site that you visit, since different origins don't share a localStorage.

Here are the two versions:

Should work in Chrome, Firefox (with Greasemonkey) and Opera (where you'll have to manually move it to your user script folder).

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

Post feedback as answers here, or for small questions and remarks, chances are often good that you'll find me and other helpful people in the Tavern on the Meta.

If you're using the rchern Mafia's keyboard script, you might want to turn that off, or things could get weird :)

18
  • 3
    @jtbandes see the info on Stack Apps about installing userscripts. It looks like you'll need the NinjaKit extension for Safari 5.
    – nhinkle
    Aug 17, 2011 at 17:31
  • 1
    I wish it didn't need my data on all websites...
    – jjnguy
    Aug 17, 2011 at 18:43
  • 7
    @jjnguy: That's a long-standing chrome issue. It ignores the fact that the user script is restricted to certain sites (check in Firefox/Greasemonkey for example; you'll see that the restriction is indeed there). And Chrome indeed only runs it on the given sites, despite claiming otherwise.
    – balpha StaffMod
    Aug 17, 2011 at 18:45
  • 2
    This will conflict with quick search functionalities of browsers if no modifiers are needed for the shortcuts.
    – brunnerh
    Aug 17, 2011 at 19:37
  • 5
    @H.B.: Anything will collide with something. We've decided to go with no modifiers; if that conflicts with someone's plugins, they'll have to live with the fact that they can't use our shortcuts.
    – balpha StaffMod
    Aug 17, 2011 at 19:53
  • 4
    How is the script licensed? I whipped up a Safari extension, for myself, that injects the script. Can I release it? Sep 2, 2011 at 0:41
  • @elasticthreads: Go ahead; it's MIT licensed now.
    – balpha StaffMod
    Sep 2, 2011 at 4:58
  • 2
    @Dori The Extension is up on GitHub here github.com/elasticthreads/StackKBShortcuts-for-Safari Sep 2, 2011 at 13:43
  • 1
    Any updates on the ETA of this feature? Sep 26, 2011 at 21:12
  • 1
    Interestingly, I get this error when trying to update the script as prompted. It just downloads the sekeys.updating.user.js file. Seems Chrome made it impossible to continue auto-updating the script? (v21, dev)
    – slhck
    Jun 23, 2012 at 7:30
  • 1
    @slhck When Google decided to make non-Store extensions harder to install, they totally forgot that user scripts even exist. From that thread, it looks like they're on and off, so I can't tell you if they currently work. You can try domain whitelisting or this supposedly existing command line argument. Or use a released browser :)
    – balpha StaffMod
    Jun 23, 2012 at 9:13
  • @balpha On OSX 10.6.8 and Chrome neither of E or C seem to work after selecting a question or answer with U/J/K. I don't have conflicting scripts installed. At least none from here. Is there a way to debug this?
    – halirutan
    Nov 12, 2012 at 17:43
  • Adding comments via C is no longer possible after the latest changes to the comment system.
    – slhck
    Jul 25, 2014 at 17:28
  • @slhck Yep, stackapps.com/a/4817/43. And when fixing that, I'll also finally make it a part of the site instead of a user script.
    – balpha StaffMod
    Jul 25, 2014 at 17:39
  • @balpha Cool, didn't know there was an "official" StackApps entry. And hooray! :)
    – slhck
    Jul 25, 2014 at 18:33

22 Answers 22

22

Feature request: allow "checking" of questions on the question list, and then with a question, J/K (or something like that) to navigate between checked questions. So I can view a page of questions, select those I'm interested in, and then go to each in turn.

7
  • By J/K I'm guessing you mean shift-j and shift-k?
    – jtbandes
    Aug 17, 2011 at 17:22
  • 2
    I think this should be done with "x", like selecting messages in Gmail.
    – jtbandes
    Aug 17, 2011 at 17:22
  • @jtbandes: Yes on both counts :)
    – Jon Skeet
    Aug 17, 2011 at 17:29
  • That's a really interesting idea.
    – balpha StaffMod
    Aug 17, 2011 at 17:29
  • 18
    @balpha: Basically I'm thinking about how I can treat SO like gmail :)
    – Jon Skeet
    Aug 17, 2011 at 17:31
  • 9
    It would be nice to have a mouse interface for that first.
    – jjnguy
    Aug 17, 2011 at 18:53
  • @jjnguy - Or simultaneously, or one then the other. It would be nice to have it at all, I don't care too much about the order. Oct 12, 2011 at 16:54
13

Would it be possible to make Esc close an open comment box triggered by c?

This would make it easier to navigate the site without having to tab through to the "Cancel" button and seems like a very consistent thing to do (escaping actions such as editing, etc.).

8

Feature request: Shortcut to go to the /tools page. Perhaps G T. This might not be the best keyboard shortcut because it'd only be usable for 10k users and mods, but it would definitely be useful for those groups of people.

In addition to this, G R to access /review would be nice as well.

5
  • 1
    Thanks to Rebecca, these are now available via "special pages", [G][S][T], [G][S][R] etc.
    – balpha StaffMod
    Sep 16, 2011 at 6:49
  • @balpha Actually, G-S-T does not seem to work – at least for me on Super User. There is no such option in the auto-help, and the action performs nothing.
    – slhck
    Oct 25, 2011 at 21:15
  • @slhck Fixed, thanks.
    – balpha StaffMod
    Oct 26, 2011 at 7:08
  • @balpha Is it broken again? G-S only shows Review when you previously were on /review. If you were on \tools, G-S shows both Review and Tools. See here.
    – slhck
    Nov 18, 2011 at 14:53
  • @slhck: Yes, there has been a change to how that link works, and I haven't yet come up with a good way to handle that.
    – balpha StaffMod
    Nov 18, 2011 at 14:56
6

Bug

Given the following conditions:

  • hiding of ignored tags in user preferences enabled
  • ignored tags specified by wildcard, e.g. windows* for , , etc.

The following issue occurs:

The previous (k) / next (j) buttons don't skip the questions with tags ignored by wildcard.

Since a hidden question is actually focused (even though that's invisible), enter opens it.

Notes

It works properly when ignoring tags without wildcards.

Tested environment: Safari 6.0 with NinjaKit, and Firefox 13.0.1 with Greasemonkey

5

Feature request:

Would it be possible to map F to toggle add question to favorites?

3

Enhancement request: / should focus the search field (common to many sites). I think S would be better suited as "sort by" instead of the current O for "order by".

2
  • 1
    .. and then you could make O open a question, like a mail in Gmail ;)
    – slhck
    Aug 23, 2011 at 18:03
  • 2
    The problem with this is that / is the default key for searching within a page on firefox...
    – Benjol
    Sep 1, 2011 at 12:42
2

Feature request: press Esc to stop editing tags; and some keyboard shortcut for saving/cancelling a question edit.

2
  • 1
    The latter already exists (for inline editing, anyway): Ctrl-Enter and ESC.
    – balpha StaffMod
    Aug 17, 2011 at 18:12
  • It works for non in-line too.
    – Tim
    Aug 23, 2014 at 10:34
2

Feature request: voting for comments (and flagging comments, maybe).

2

Feature request: Under inbox, add an option to open all new messages in separate tabs. This is something I do manually by opening the inbox and middle clicking all the highlighted links, would be great if it could do it automatically.

2
  • I'll have a look at that, but I'm pretty sure opening several new windows at once is going to have me fighting popup blockers.
    – balpha StaffMod
    Sep 2, 2011 at 5:01
  • @balpha I think that the power users that this feature is designed for can figure out how to prevent popups from being blocked on SE Sep 2, 2011 at 5:05
2

The new user page breaks the tab selection window (N T with the auto help on). The options are spaced way too far apart, which makes them get cut off at the top of the window (that gray bar at the top is the tab bar).

enter image description here

1
  • 1
    Fixed, thanks.
    – balpha StaffMod
    Nov 15, 2011 at 8:47
2

Feature request: j/k or J/K (as suggested by Jon Skeet) while viewing a question loads the previous/next listed or checked question, without having to go back to the list. Gmail handles both this and navigating within a thread by using n/p in addition to j/k.

11
  • How is that different from Jon's answer?
    – balpha StaffMod
    Aug 17, 2011 at 18:11
  • 2
    @balpha: unless I misread Jon's, this is navigating while you're viewing a question whereas his was from a list. Also I think the shortcut for this should be distinct (j/k vs p/n) from navigating among answers.
    – jtbandes
    Aug 17, 2011 at 18:17
  • Okay, that's how I read Jon's version.
    – balpha StaffMod
    Aug 17, 2011 at 18:43
  • @jtbandes: It's similar to this answer meta.stackexchange.com/questions/102769/… rather than the one which has now been implemented.
    – Jon Skeet
    Aug 19, 2011 at 15:22
  • @Jon Skeet: are any of these currently implemented? j/k from a question navigates the answers, and J/K and p/n don't seem to do anything.
    – jtbandes
    Aug 19, 2011 at 18:51
  • @jtbandes: No, this feature hasn't been implemented - the feature which has been implemented is making j/k keep going beyond what was previously visible.
    – Jon Skeet
    Aug 19, 2011 at 19:24
  • @Jon Skeet: Oh, yes (which is great). Our suggestions are both in addition to that.
    – jtbandes
    Aug 19, 2011 at 19:25
  • @jtbandes: I think the point is that my other suggestion (including checkboxes) includes your idea of loading the previous/next question. I don't think you could sensibly do it without some sort of checkbox system, as you'd rarely want to just go to "the next question with no filtering applied". Maybe for search results.
    – Jon Skeet
    Aug 19, 2011 at 19:28
  • @Jon Skeet: Okay, sure. What was your suggestion for navigating answers within a question, versus questions? I'm suggesting p/n (again, like Gmail).
    – jtbandes
    Aug 19, 2011 at 19:30
  • @jtbandes: I didn't have a suggestion around that, but n/p is good.
    – Jon Skeet
    Aug 19, 2011 at 19:32
  • Userscript for that: meta.stackexchange.com/questions/201887/…
    – Basilevs
    Oct 16, 2013 at 19:45
2

Feature-request:

Add a function that enable switching between the Stack accounts of the user could be good. I don't know how that could be done. Display the user accounts page then use J/K to select one? Or a textbox where you write the name?

2

Feature-request: when summoning the inbox, change j/k navigation to inbox elements instead of posts items.

In a general manner, give J/K navigation to the most important panel shown, could be flags etc...

2

Feature request/bug report: in profile j/k can be used to select a question — but no way to select an answer, it seems.

2
  • Yes, that's definitely planned; I just haven't figured out how to best handle the fact that there are several paginations on the user profile.
    – balpha StaffMod
    Aug 19, 2011 at 12:13
  • 1
    You can now use [N][Q] and [N][A] to switch between what section you're working with.
    – balpha StaffMod
    Sep 16, 2011 at 6:54
1

A mapping of favourite tags to numbers might be nice, or some popup to select from. (preferably everywhere and not just on those pages where the interesting tags section is visible).

1

Feature request: in question list selecting a question should, perhaps, show question excerpt (like hovering over its title does).

1

Feature request: Ctrl+Enter to open question in new tab. This works on Google search pages :)

4
  • this already works in the search box Sep 24, 2011 at 21:45
  • 1
    This works, except that it's Shift-Enter, not Ctrl-Enter
    – balpha StaffMod
    Sep 28, 2011 at 15:45
  • @balpha. But... it IS Ctrl+Enter
    – user173320
    Jun 24, 2012 at 6:20
  • @gdoron Ctrl-Enter in the search box has nothing to do with the keyboard shortcuts script; this is "native" site functionality that has been working forever. We're talking about e.g. opening a question (that you have selected via j/k) in a new tab. Also see stackapps.com/a/3497/43
    – balpha StaffMod
    Jun 24, 2012 at 6:32
1

It seems navigation doesn't work on /tools/flagged. Is this a bug or not implemented? It would be nice if I could act on those questions using keyboard only.

1

The "email settings" dialog in the supercollider doesn't capture key events, so when I start typing in my email address the shortcuts will activate, closing that dialog and opening random other page elements.

1
  • 2
    Sorry about being so late; fixed now.
    – balpha StaffMod
    Jun 22, 2012 at 12:42
1

I'd be in favour of either switching the function of j and k or of using a mapping that actually reflects the flow, e.g. y for previous and h for next as the layout is in most cases vertical.

5
  • 4
    I'd be the first to switch j and k, but these semantics (even if they don't make sense to me) are kind of a standard.
    – balpha StaffMod
    Aug 17, 2011 at 21:30
  • It's because in vi you move between lines with j and k. And vi(m) is awesome... ;) (or maybe it's because people like to play nethack (and I assume nethack has it from vi)).
    – Felix
    Aug 19, 2011 at 13:15
  • 2
    @Felix: Being stuck with a bad layout due to a thoughtless design decision in some popular software is sad...
    – brunnerh
    Aug 19, 2011 at 13:20
  • I'd be against switching to y and h - Those aren't on my home row! Choosing j and k was not a thoughtless decision. Nov 1, 2011 at 11:57
  • @KevinVermeer: Well, it was just an example, j + u would be better of course, but if you want to have vertical layout you will always have one key off, so it's a tradeoff between speed and mapping.
    – brunnerh
    Nov 1, 2011 at 12:02
0

Feature request: use left/right arrow keys to browse (next/previous) questions.

4
  • How is next/previous defined here? Do you mean something like meta.stackexchange.com/questions/102769/…?
    – balpha StaffMod
    Nov 1, 2011 at 10:22
  • @balpha, on Newest Questions page, for example, instead of clicking "next" we could press the right arrow key. Nov 1, 2011 at 10:34
  • So you just want to change the P,N/P,P shortcuts to use the arrow keys instead? Hmm... Not a fan; I'd like to keep standard navigational keys (cursor keys, pageup/down etc.) unchanged, so they behave like the user expects them to.
    – balpha StaffMod
    Nov 1, 2011 at 11:07
  • @balpha, personally I can't find a use for left/right keys on such pages. Anyway, for a demonstration: iconfinder.com/search/?q=icon Nov 1, 2011 at 11:22
0

There seems to be a bug in the script on the new login page. If you try to login using an Stack Exchange account, keyboard shortcuts can prevent you from entering certain characters into the field. I'm noticing the issue on Firefox.

Repro

  1. Got to the login page
  2. Open the "Log in using Stack Exchange" panel
  3. Put focus into the field and try to type in g, h, or s

Results

h does nothing, g does nothing on its own, g+h goes back one page, and s gives focus to the search field. ? also shows the help commands, even when focus is in the field.

Workaround

The only workaround I've found is to disable the script, reload the page, and then renable it after being logged in.

0

You must log in to answer this question.

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