(Github Comment Enhancer) Keyboard shortcuts #19

Closed
jerone opened this Issue Aug 30, 2014 · 11 comments

Projects

None yet

2 participants

@jerone jerone added the enhancement label Aug 30, 2014
@thomaslevesque

👍

@jerone
Owner
jerone commented Apr 26, 2015

Took me some time to figure out, but I think I've got the shortcuts working great now.

The following shortcuts are supported:

  • Bold = ctrl+b*
  • Italic = ctrl+i*
  • Underline = ctrl+u
  • Strikethrough = ctrl+s
  • Header 1 = ctrl+1
  • Header 2 = ctrl+2
  • Header 3 = ctrl+3
  • Header 4 = ctrl+4
  • Header 5 = ctrl+5
  • Header 6 = ctrl+6
  • Link = ctrl+l*
  • Image = ctrl+g*
  • Unordered List = alt+ctrl+u
  • Ordered List = alt+ctrl+o
  • Task List = alt+ctrl+t
  • Code = ctrl+k*
  • Quote = ctrl+q*
  • Horizontal Rule = ctrl+r*
  • Table = alt+shift+t
  • Clear = alt+ctrl+x

*) Shortcut the same as on StackOverflow answer fields.

I'm not releasing this feature just yet, but if anyone interested you can try the development version: https://github.com/jerone/UserScripts/tree/Github_Comment_Enhancer/Github_Comment_Enhancer

@thomaslevesque

Awesome! I was considering trying to do it myself, but I'm not proficient in Javascript so I'm not sure I would have succeeded...

I noticed that some of the shortcuts you picked conflict with pre-defined browser shortcuts, which should be avoided if possible:

  • ctrl+c is traditionally reserved for "Copy", so it's probably not a good idea... Stackoverflow uses ctrl+k, which seems a good choice to me
  • ctrl+s is mapped to "Save" in most browsers
  • ctrl+t is mapped to "New tab" in most browsers
  • ctrl+shift+t is mapped to "Reopen closed tab" in most browsers

Also, I don't think that we need a shortcut for each and every command, just for the most common. For instance, to write a horizontal line you just need to type "***", so the shortcut isn't very useful; I'd rather have ctrl+l be used for Link (as on Stackoverflow), because it's more obvious than ctrl+shift+w, and not have any shortcut for Line.

@jerone jerone added a commit that referenced this issue Apr 26, 2015
@jerone Keyboard shortcuts (fixes #19); 1f22aad
@jerone
Owner
jerone commented Apr 26, 2015

Thank you for your feedback!

I noticed that some of the shortcuts you picked conflict with pre-defined browser shortcuts, which should be avoided if possible:

All shortcuts are caught in only the comment fields, where the default behavior is prevented. For example ctrl+s won't open the save dialog for the page when pressed in the comment field.

ctrl+c is traditionally reserved for "Copy", so it's probably not a good idea... Stackoverflow uses ctrl+k, which seems a good choice to me

Should have seen that!

I'd rather have ctrl+l be used for Link (as on Stackoverflow) [...]

Good suggestion to look at StackOverflow, didn't know they had shortcuts too.

I've updated above list with the new shortcuts.

@thomaslevesque

Perfect !

And thanks for writing this script, it makes writing on Github so much easier

@jerone
Owner
jerone commented Apr 26, 2015

Thanks for using! I've got more userscript for GitHub that make things just a bit easier.

If you've got other features or feedback, feel free to open an issue. And sometimes I need another push 😄

@jerone jerone self-assigned this Apr 26, 2015
@thomaslevesque

Is the user script supposed to work on Chrome as well? It shows the buttons, but they don't do anything and the keyboard shortcuts don't work.

@thomaslevesque

If I use Tampermonkey to install the script, the buttons work, but the shortcuts don't

@jerone
Owner
jerone commented Apr 27, 2015

Thanks for testing! There were some issues with Chrome that needed attention. One of those issues resulted in new shortcuts. I have updated above list with the new combinations.

It should now work in both Firefox and Chrome.

@thomaslevesque

Yes, it works 👍

Thanks!

@jerone
Owner
jerone commented Apr 27, 2015

@thomaslevesque commented on 27 apr. 2015 17:52 CEST:

Yes, it works 👍

Haha

The only one I'm not happy with is table alt+shift+t. But both ctrl+t & ctrl+shift+t can't be overridden in Chrome.

@jerone jerone closed this in 4669f16 May 24, 2015
@jerone jerone added a commit that referenced this issue May 24, 2015
@jerone Keyboard shortcuts (fixes #19); 67b2cc7
@jerone jerone added a commit that referenced this issue May 24, 2015
@jerone Keyboard shortcuts (fixes #19); 66432a2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment