52

When I click the (?) button at the right of the editor toolbar, I get to see help pages, and nowhere are the keyboard shortcut listed.

Is there is reason for doing so?

For example, I discovered Ctrl+K only like 2 weeks ago...

7
  • 13
    You can see the shortcuts when you hover over the elements of the editor. But that being said I always loved a help side where all shortcuts can be found together Jan 21, 2016 at 1:47
  • Oh... so in a way it is documented... (a bit like in a dropdown menu of a desktop app) But not obvious. Jan 21, 2016 at 1:57
  • 5
    You should consider yourself lucky. On OSX Ctrl+K is an important text-editing shortcut, and you would have found it immediately, because the SE editor breaks it :-( Even better: on a German Windows keyboard @ is Ctrl+Alt+Q, which the SE editor interprets as Ctrl+Q, which means that it is impossible to use SE for asking/answering questions about Ruby or Perl code for German programmers. (The latter bug has been fixed, I believe, but it existed for years. The former still hasn't been fixed.) Jan 21, 2016 at 11:52
  • 3
    I read this title on the 'hot meta posts' and thought 'there are editor keyboard shortcuts?' - it seemed a fitting thing to mention! ;) - though to be fair, looking at the list in the answers, they are mostly what you'd expect them to be
    – Michael B
    Jan 21, 2016 at 11:56
  • @epascarello, Ah, so it is recent (1.5 years) and did not yet get documented? Jan 21, 2016 at 21:48
  • If only they had a "select whole code example" shortcut for the viewer... Jan 22, 2016 at 13:19

1 Answer 1

49

To attempt to "answer" the question:

The most likely explanation is: they forgot

And since that keyboard overlay it seems they implemented the overlay feature, but they haven't added the shortcuts to the markup help files, or anywhere else but in the tooltips in the editor.

It's likely no-one considered it could be handy to have the related keyboard shortcuts listed in for example the markdown help.

We implement a cool new feature, make it compatible with the previous "feature" but kind of forget to document it comprehensively what happens all except in the mouseovers.

But we'd need to hear from one of the higher ups from stackoverflow to know for sure. but looking at the history it's a case of "writing comprehensive documentation is a programmers last priority"

But that's guessing from my part.

Here's a list of known keyboard shortcuts.

Formatting:

  • Bold Ctrl+B
  • Italics Ctrl+I
  • Hyperlink Ctrl+L
  • Blockquote Ctrl+Q
  • Code sample Ctrl+K
  • Image Ctrl+G
  • Code snippet: Ctrl+M
  • Numbered list: Ctrl+O
  • Unordered list: Ctrl+U
  • Heading: Ctrl+H
  • Horizontal rule: Ctrl+R

Editor actions:

  • Undo: Ctrl+Z
  • Redo: Ctrl+Y
  • Paste: Ctrl+V
  • Copy: Ctrl+C
  • Jump to previous / next word: Ctrl+Left / Right arrow
  • Select previous / next word: Ctrl+Shift+Left / Right arrow
  • Delete previous word: Ctrl+Backspace
  • Delete next word: Ctrl+Delete

For more useful shortcuts see 42+ Text-Editing Keyboard Shortcuts That Work Almost Everywhere on How-To Geek.

For most shortcuts Ctrl is replaceable with Cmd or whatever command key your keyboard uses.

For the comment about the tab functionality, make a bookmark/favorite via your browsers bookmark/favorite manager, and paste the following script in it and place it on your bookmarks hotbar

javascript: !function(t){!function(t,e){t.fn.getCursorPosition=function(){var e=t(this).get(0),n=0;if("selectionStart"in e)n=e.selectionStart;else if("selection"in document){e.focus();var o=document.selection.createRange(),i=document.selection.createRange().text.length;o.moveStart("character",-e.value.length),n=o.text.length-i}return n}}(t),t(".wmd-input.processed").on("keydown",function(e){if(9==e.which){var n=t(this),o=n.val(),i=n.getCursorPosition(),r=o.substr(0,i)+"    "+o.substr(i);n.val(r),e.preventDefault()}})}(jQuery);

Now you can just press that button when your editor is open and it will make your tab presses into four spaces.

This is the uncompressed version:

(function(jQuery) {
(function ($, undefined) {
    $.fn.getCursorPosition = function () {
        var el = $(this).get(0);
        var pos = 0;
        if ('selectionStart' in el) {
            pos = el.selectionStart;
        } else if ('selection' in document) {
            el.focus();
            var Sel = document.selection.createRange();
            var SelLength = document.selection.createRange().text.length;
            Sel.moveStart('character', -el.value.length);
            pos = Sel.text.length - SelLength;
        }
        return pos;
    }
})(jQuery);

jQuery('.wmd-input.processed').on('keydown',function(e) {
   if(e.which == 9) {
       var $this = jQuery(this),
           content = $this.val(), 
           position = $this.getCursorPosition(),
           newContent = content.substr(0, position) + "    " + content.substr(position);
       $this.val(newContent);
       e.preventDefault();
   }
});

})(jQuery)
11
  • 1
    Is there an easy way to indent code? When I edit others malformated code I always use space 4/8/12 times for every line... Tab jumps out of the editor and Ctrl+K only works once Jan 21, 2016 at 11:55
  • 7
    @Altoyr yes, use your IDE, your favorite text editor or an online code prettifier. SO is not the place to format your code. :) At least, that was the officical stance for the last N times tab support was requested...
    – CodeCaster
    Jan 21, 2016 at 12:04
  • 2
    @Altoyr I added a simple bookmarklet for your tab wishes. CodeCaster thanks for the edit :-) Jan 21, 2016 at 12:33
  • Shouldn't Redo be Ctrl+Y?
    – Mike M.
    Jan 21, 2016 at 12:58
  • 1
    Yes it should be, must have copied over it or something. Jan 21, 2016 at 13:02
  • 1
    @CodeCaster, note that Altoyr says "OTHERS" malformed code. Meaning that it does not come from his wonderful editor. It is a pain to have to copy someone else's code to your editor, do the formatting and copy things back. That being said, with the "It's all text" extension, you can auto-edit in VIM. addons.mozilla.org/en-us/firefox/addon/its-all-text Jan 21, 2016 at 21:51
  • 3
    This does NOT answer the question, which was: WHY aren't the shortcuts not documented! Not, please document them. Flagging as NAA ;-) Jan 22, 2016 at 11:39
  • There is a discussion tag, so there is room for free input, and this is related to the question by answering an implied question to get a list of shortcuts Jan 22, 2016 at 11:42
  • @Jean-FrançoisCorbett I "answered" the question, specially for you :-) Jan 22, 2016 at 12:05
  • 2
    Much, MUCH better. Jan 22, 2016 at 12:45
  • @Altoyr You can try pasting the code in a stack snippet and using Shift+Tab to fix indentation. Of course it won't work for all languages.
    – Oriol
    Jan 23, 2016 at 18:08

You must log in to answer this question.

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