jerone / UserScripts

🐵 My UserScripts
https://github.com/jerone/UserScripts#readme
GNU General Public License v3.0
339 stars 39 forks source link

(Github Comment Enhancer) Keyboard shortcuts #19

Closed jerone closed 9 years ago

jerone commented 10 years ago

https://github.com/ccampbell/mousetrap https://github.com/jeresig/jquery.hotkeys

thomaslevesque commented 9 years ago

:+1:

jerone commented 9 years ago

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

The following shortcuts are supported:

*) 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 commented 9 years ago

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:

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 commented 9 years ago

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 commented 9 years ago

Perfect !

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

jerone commented 9 years ago

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 :smile:

thomaslevesque commented 9 years ago

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 commented 9 years ago

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

jerone commented 9 years ago

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 commented 9 years ago

Yes, it works :+1:

Thanks!

jerone commented 9 years ago

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

Yes, it works :+1:

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.